.:`=-~rANdOm~`-=:.

Tech Lounge => Programming => Topic started by: Krasher on May 22, 2010, 07:07:21 PM

Title: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Krasher 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.
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: » Magic « on June 05, 2010, 02:51:55 AM
KEEP GOING D:!
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Krasher on June 05, 2010, 12:10:16 PM
KEEP GOING D:!
I am going to add more today
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: » Magic « on June 05, 2010, 12:11:45 PM
I am going to add more today


Kthx
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Tomcat 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
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Peetah 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.
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Majoras mask 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")
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Peetah on June 05, 2010, 08:47:00 PM
Yup.
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Krasher on June 05, 2010, 08:47:11 PM
Nice good to see Krasher is helping out the community.
You just now realized?
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Peetah on June 05, 2010, 08:47:53 PM
Just a complement.
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: » Magic « on June 06, 2010, 01:08:07 PM
I also see what you did there


(http://farm3.static.flickr.com/2108/2062419359_369c3e731b.jpg?v=0)
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Tomcat on June 07, 2010, 04:26:13 PM
(http://img.moronail.net/img/6/4/2364.jpg)


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
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: » Magic « on July 10, 2010, 10:11:56 AM
Make moar plocks
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Peetah 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.
Title: Re: *Gmod* Lua - SUPER TUTORIAL!!
Post by: Tomcat 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