I am trying to make a script that gives guns to certain groups. I have been learning a little bit of lua from jay but I seem to be stumped on this one. Help is greatly appreciated.
local function StartingGuns( ply )
ply:StripWeapons()
ply:Give( "weapon_physcannon" )
ply:Give( "weapon_physgun" )
ply:Give( "gmod_tool" )
ply:Give( "gmod_camera" )
if ply:IsUserGroup("admin") then
ply:Give( "weapon_punisher" )
ply:Give( "ulx_gun" )
end
if ply:IsUserGroup("superadmin") then
ply:Give( "weapon_punisher" )
ply:Give( "ulx_gun" )
ply:Give( "weapon_ar2" )
end
if ply:IsUserGroup("owner") then
ply:Give( "weapon_punisher" )
ply:Give( "ulx_gun" )
ply:Give( "weapon_haxgun" )
ply:Give( "weapon_ar2")
end
end
hook.Add( "PlayerLoadout", "StartingGuns", StartingGuns)
local function FirstSpawn( ply )
if ply:isAdmin or ply:isSuperAdmin then
ply:PrintMessage( HUD_PRINTTALK, "Major Pain: Oh hai thar admin! Lolz" )
end
end
hood.Add( "PlayerInitialSpawn", "FirstSpawn", FirstSpawn)
local function Spawn
if ply:IsUserGroup("owner") then
ply:SetGravity( 0, 90 )
ply:SetWalkSpeed( 325 )
ply:SetRunSpeed( 1000 )
end
end
hook.Add( "PlayerSpawn", "PlayerSpawn", Spawn)
I put the "Oh hai thar admin" thing for testing purposes.