Author Topic: *Gmod* Lua - SUPER TUTORIAL!!  (Read 3656 times)

0 Members and 1 Guest are viewing this topic.

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
*Gmod* Lua - SUPER TUTORIAL!!
« on: May 22, 2010, 07:07:21 PM »
Garry's Mod - Lua

A simple hello program.

Code: [Select]
print( "Hello BIATCH" )
FUCK THAT

Btw, I am going to assume you know some basic Lua.

-=Basic GMod Lua Functions=-
-=Gamemode=-
GM:PlayerInitialSpawn( ply ) -- Allows you to edit the players spawn.
GM:PlayerLoadout( ply ) -- The players initial loadout (Ex. Weapons).

-=Player=-
ply:SetHealth( <number> ) -- Easy enough to understand am I right?
ply:SetMaxSpeed( <lowernumber>, <highernumber> ) -- First number is the players normal walk speed, second is the players sprint (shift) speed.
ply:PrintMessage( HUD_PRINTTALK, "Message Here" ) -- Displays a message written in the string.
ply:IsAdmin() -- Is the player admin?
ply:IsPlayer() -- Is the motherfucker a player?
ply:FindHood -- WHERE THE HOOD, WHERE THE HOOD, WHERE THE HOOD AT? (NOT A REAL FUNCTION.)


Section 1: SWEPS!
Description: Weapon Scripts.
« Last Edit: June 05, 2010, 12:23:07 PM by «-= Kräsh∑r =-» »
-Admin Application-

Follow the rules or I will you.

Offline » Magic «

  • Who dares wins
  • WaffleBBQrz
  • ******
  • Posts: 4020
  • Karma: +101/-34
  • Gender: Male
  • Prepare for the worst :D
    • View Profile
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #1 on: June 05, 2010, 02:51:55 AM »
KEEP GOING D:!
Copyright© .:~`=-rANdOm-=`~:. GameServer's Administration Team 2008/2009/2010


bubbly bubbly so darn bubbly

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #2 on: June 05, 2010, 12:10:16 PM »
KEEP GOING D:!
I am going to add more today
-Admin Application-

Follow the rules or I will you.

Offline » Magic «

  • Who dares wins
  • WaffleBBQrz
  • ******
  • Posts: 4020
  • Karma: +101/-34
  • Gender: Male
  • Prepare for the worst :D
    • View Profile
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #3 on: June 05, 2010, 12:11:45 PM »
Copyright© .:~`=-rANdOm-=`~:. GameServer's Administration Team 2008/2009/2010


bubbly bubbly so darn bubbly

Offline Tomcat

  • Smartical
  • Übermensch
  • *****
  • Posts: 1694
  • Karma: +42/-13
  • Gender: Male
  • OMG IS DAT A CHEEZEBURGER
    • View Profile
    • Rnd Upload
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #4 on: June 05, 2010, 03:08:42 PM »
ply:isTomcat()


LUA ERRORS OH SHITZ


Error (no function Ply:isTomcat())
SHUTTING GMOD DOWN OF SHEAR AWESOMENESS

Quote
Andrew: your mom spazzes
.:RND`=- Tomcat: not me
Tomcat: andrew
Tomcat: dont go there
.:RND`=- Tomcat: i will rape you all they way back to 1980

Offline Peetah

  • Unnecessary encouragement guy.
  • Übermensch
  • *****
  • Posts: 877
  • Karma: +16/-4
  • Gender: Male
  • And God saw that it was Good.
    • View Profile
    • Youtube Account
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #5 on: June 05, 2010, 08:22:03 PM »
Nice good to see Krasher is helping out the community.
Also add some other useful functions like; set gravity, strip weapons, give weapon.
Keep up the great work young man.





Offline Majoras mask

  • Sr. Member
  • ****
  • Posts: 449
  • Karma: +15/-2
  • Gender: Male
    • View Profile
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #6 on: June 05, 2010, 08:36:21 PM »
Nice good to see Krasher is helping out the community.
Also add some other useful functions like; set gravity, strip weapons, give weapon.
Keep up the great work young man.
Like this:O?

   ply:SetGravity( 0.90 )
   ply:SetMaxHealth( 100, true )
   ply:SetWalkSpeed( 325 )
   ply:SetRunSpeed( 525 )
-----------------------------------------------
   ply:Stripweapons()
   ply:Give("weapon_crowbar")
   ply:Give("weapon_pistol")
you got it


Offline Peetah

  • Unnecessary encouragement guy.
  • Übermensch
  • *****
  • Posts: 877
  • Karma: +16/-4
  • Gender: Male
  • And God saw that it was Good.
    • View Profile
    • Youtube Account
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #7 on: June 05, 2010, 08:47:00 PM »
Yup.





Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #8 on: June 05, 2010, 08:47:11 PM »
Nice good to see Krasher is helping out the community.
You just now realized?
-Admin Application-

Follow the rules or I will you.

Offline Peetah

  • Unnecessary encouragement guy.
  • Übermensch
  • *****
  • Posts: 877
  • Karma: +16/-4
  • Gender: Male
  • And God saw that it was Good.
    • View Profile
    • Youtube Account
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #9 on: June 05, 2010, 08:47:53 PM »
Just a complement.





Offline » Magic «

  • Who dares wins
  • WaffleBBQrz
  • ******
  • Posts: 4020
  • Karma: +101/-34
  • Gender: Male
  • Prepare for the worst :D
    • View Profile
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #10 on: June 06, 2010, 01:08:07 PM »
I also see what you did there


Copyright© .:~`=-rANdOm-=`~:. GameServer's Administration Team 2008/2009/2010


bubbly bubbly so darn bubbly

Offline Tomcat

  • Smartical
  • Übermensch
  • *****
  • Posts: 1694
  • Karma: +42/-13
  • Gender: Male
  • OMG IS DAT A CHEEZEBURGER
    • View Profile
    • Rnd Upload
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #11 on: June 07, 2010, 04:26:13 PM »



every single Ply function is easy as hell


Code: [Select]
Player:AddCleanup


Player:AddCount


Player:AddFrozenPhysicsObject


Player:Alive


Player:Armor


Player:ChatPrint


Player:CheckLimit


Player:ConCommand


Player:Crouching


Player:Deaths


Player:DebugInfo


Player:FlashlightIsOn


Player:Frags


Player:Freeze


Player:GetActiveWeapon


Player:GetAimVector


Player:GetAIM


Player:GetAmmoCount


Player:GetCanWalk


Player:GetCanZoom


Player:GetClientsideVehicle


Player:GetCount


Player:GetCurrentCommand


Player:GetCursorAimVector


Player:GetEmail


Player:GetEyeTraceNoCursor


Player:GetEyeTrace


Player:GetFOV


Player:GetGTalk


Player:GetInfoNum


Player:GetInfo


Player:GetJumpPower


Player:GetLocation


Player:GetMaxSpeed


Player:GetMSN


Player:GetName


Player:GetObserverMode


Player:GetObserverTarget


Player:GetPData


Player:GetRagdollEntity


Player:GetScriptedVehicle


Player:GetShootPos


Player:GetStepSize


Player:GetTool


Player:GetVehicle


Player:GetViewModel


Player:GetViewOffsetDucked


Player:GetViewOffset


Player:GetWeapons


Player:GetWebsite


Player:GetXFire


Player:InVehicle


Player:IsAdmin


Player:IsBot


Player:IsFrozen


Player:IsNPC


Player:IsPlayer


Player:IsSuperAdmin


Player:IsUserGroup


Player:IsVehicle


Player:IsWeapon


Player:KeyDownLast


Player:KeyDown


Player:KeyPressed


Player:KeyReleased


Player:LagCompensation


Player:LimitHit


Player:Name


Player:Nick


Player:PacketLoss


Player:PhysgunUnfreeze


Player:Ping


Player:PrintMessage


Player:ResetHull


Player:SetCanWalk


Player:SetCanZoom


Player:SetClientsideVehicle


Player:SetDSP


Player:SetDuckSpeed


Player:SetEyeAngles


Player:SetHullDuck


Player:SetHull


Player:SetPData


Player:SetScriptedVehicle


Player:SetStepSize


Player:SetUnDuckSpeed


Player:SetViewOffsetDucked


Player:SetViewOffset


Player:SteamID


Player:Team


Player:UnfreezePhysicsObjects


Player:UniqueID


Player:UniqueIDTable


Player:UserID


Player:ViewPunch


Player:ViewPunchReset


Player:__gc


Player:__index


Player:__newindex


Player:__tostring
Server
State    Method Name   
Player:AddDeaths


Player:AddFrags


Player:AllowImmediateDecalPainting


Player:Ban


Player:CreateRagdoll


Player:CreateSharedTable


Player:CrosshairDisable


Player:CrosshairEnable


Player:DetonateTripmines


Player:DrawViewModel


Player:DrawWorldModel


Player:DropNamedWeapon


Player:DropWeapon


Player:EnterVehicle


Player:EquipSuit


Player:ExitVehicle


Player:Flashlight


Player:GetAllowFullRotation


Player:GetAvoidPlayers


Player:GetNoCollideWithTeammates


Player:GetSharedTable


Player:GetViewEntity


Player:GetWeapon


Player:GiveAmmo


Player:Give


Player:GodDisable


Player:GodEnable


Player:HasWeapon


Player:IPAddress


Player:Kick


Player:KillSilent


Player:Kill


Player:LastHitGroup


Player:Lock


Player:PlayScene


Player:PlayStepSound


Player:RemoveAllAmmo


Player:RemoveAmmo


Player:SelectWeapon


Player:SendHint


Player:SendLua


Player:SetAllowFullRotation


Player:SetAmmo


Player:SetArmor


Player:SetAvoidPlayers


Player:SetCrouchedWalkSpeed


Player:SetDeaths


Player:SetFOV


Player:SetFrags


Player:SetJumpPower


Player:SetMaxSpeed


Player:SetNoCollideWithTeammates


Player:SetRunSpeed


Player:SetSuppressPickupNotices


Player:SetTeam


Player:SetUserGroup


Player:SetViewEntity


Player:SetWalkSpeed


Player:ShouldDropWeapon


Player:SnapEyeAngles


Player:SpectateEntity


Player:Spectate


Player:SprintDisable


Player:SprintEnable


Player:StopZooming


Player:StripAmmo


Player:StripWeapons


Player:StripWeapon


Player:SuppressHint


Player:TimeConnected


Player:TraceHullAttack


Player:UnLock


Player:UnSpectate
Client
State    Method Name   
Player:AddPlayerOption


Player:GetFriendStatus


Player:IsMuted


Player:IsSpeaking


Player:IsVoiceAudible


Player:SetMuted

Quote
Andrew: your mom spazzes
.:RND`=- Tomcat: not me
Tomcat: andrew
Tomcat: dont go there
.:RND`=- Tomcat: i will rape you all they way back to 1980

Offline » Magic «

  • Who dares wins
  • WaffleBBQrz
  • ******
  • Posts: 4020
  • Karma: +101/-34
  • Gender: Male
  • Prepare for the worst :D
    • View Profile
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #12 on: July 10, 2010, 10:11:56 AM »
Make moar plocks
Copyright© .:~`=-rANdOm-=`~:. GameServer's Administration Team 2008/2009/2010


bubbly bubbly so darn bubbly

Offline Peetah

  • Unnecessary encouragement guy.
  • Übermensch
  • *****
  • Posts: 877
  • Karma: +16/-4
  • Gender: Male
  • And God saw that it was Good.
    • View Profile
    • Youtube Account
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #13 on: July 10, 2010, 08:25:53 PM »
Well Lua is pretty much the easiest form of coding there is.
Try C# or C++. Learn C# first.





Offline Tomcat

  • Smartical
  • Übermensch
  • *****
  • Posts: 1694
  • Karma: +42/-13
  • Gender: Male
  • OMG IS DAT A CHEEZEBURGER
    • View Profile
    • Rnd Upload
Re: *Gmod* Lua - SUPER TUTORIAL!!
« Reply #14 on: July 11, 2010, 11:25:43 AM »
Like this:O?

   ply:SetGravity( 0.90 )
   ply:SetMaxHealth( 100, true )
   ply:SetWalkSpeed( 325 )
   ply:SetRunSpeed( 525 )
-----------------------------------------------
   ply:Stripweapons()
   ply:Give("weapon_crowbar")
   ply:Give("weapon_pistol")


you would need a function and an activator to do that

Quote
Andrew: your mom spazzes
.:RND`=- Tomcat: not me
Tomcat: andrew
Tomcat: dont go there
.:RND`=- Tomcat: i will rape you all they way back to 1980