• Superadmin spawn with weapon
    5 replies, posted
Hey, i'm new to this stuff and i'm learning how to create a file in autorun to give a weapon to a defined group But this isnt working :/ why? This is a file in gmod server folder\lua\autorun startupweapons.lua function dararmas( ply ) if ply:IsUserGroup("superadmin") then ply:Give("weapon...") end end Why isnt it working?
Because you're not hooking it to anything. hook it to PlayerSpawn, and also make the function local. For future reference put your code in [noparse][code][/code][/noparse] tags, please. [editline]4th September 2014[/editline] Also make sure it is wrapped in if (SERVER) then ..yourstuff.. end or in lua/autorun/server.
[QUOTE=crazyscouter;45885485]Because you're not hooking it to anything. hook it to PlayerSpawn, and also make the function local. For future reference put your code in [noparse][code][/code][/noparse] tags, please. [editline]4th September 2014[/editline] Also make sure it is wrapped in if (SERVER) then ..yourstuff.. end or in lua/autorun/server.[/QUOTE] How can i "hook to playerspawn"
You should research the wiki before you do anything.. Google is also a great tool for you. [code]hook.Add("PlayerSpawn", "RandomUniqueName", function(ply) if (ply:IsSuperAdmin()) then ply:Give("BLAH") end end) [/code]
[QUOTE=crazyscouter;45885581]You should research the wiki before you do anything.. Google is also a great tool for you. [code]hook.Add("PlayerSpawn", "RandomUniqueName", function(Tly) if (ply:IsSuperAdmin()) then ply:Give("BLAH") end end) [/code][/QUOTE] Thanks!
PlayerLoadout already exists for that kind of stuff too. [CODE] hook.Add("PlayerLoadout", "RandomUniqueName", function(ply) if (ply:IsSuperAdmin()) then ply:Give("BLAH") return true --hides default loadout end end) [/CODE]
Sorry, you need to Log In to post a reply to this thread.