This is my broken code:
[CODE]function PLAYER:Loadout()
self.Player:RemoveAllAmmo()
if ( ply:IsAdmin() true ) ) then
self.Player:Give( "gmod_tool" )
self.Player:Give( "weapon_physcannon" )
self.Player:Give( "gmod_camera" )
self.Player:Give( "weapon_physgun" )
end[/CODE]
My players aren't allowed physguns so I made this little code for it so that admins can.
I get this error:
[CODE][ERROR] gamemodes/sandbox/gamemode/player_class/player_sandbox.lua:87: function arguments expected near ')'
1. unknown - gamemodes/sandbox/gamemode/player_class/player_sandbox.lua:0
[/CODE]
Help?
[editline]August 7 2013[/editline]
Thanks to all the help from Bloodwave we got a working one for all of you going to this topic. The working on is:
[CODE]function GM:PlayerLoadout( ply )
ply:RemoveAllAmmo()
if ( ply:IsAdmin() ) then
ply:Give( "gmod_tool" )
ply:Give( "weapon_physcannon" )
ply:Give( "gmod_camera" )
ply:Give( "weapon_physgun" )
end
end[/CODE]
You forgot to end the function
[B]Edit:[/B]
Also that was written completely wrong.
[lua]function PLAYER:Loadout()
self:RemoveAllAmmo()
if (self:IsAdmin()) then
self:Give( "gmod_tool" )
self:Give( "weapon_physcannon" )
self:Give( "gmod_camera" )
self:Give( "weapon_physgun" )
end
end[/lua]
Thanks for your reply, but it didn't work.
I'm pretty sure its GM:PlayerLoadout( ply ) and not defined inside the player metatable.
[lua]
function GM:PlayerLoadout( ply )
ply:RemoveAllAmmo()
if ( ply:IsAdmin() ) then
ply:Give( "gmod_tool" )
ply:Give( "weapon_physcannon" )
ply:Give( "gmod_camera" )
ply:Give( "weapon_physgun" )
end
end
[/lua]
If you've defined the GM:PlayerSpawn( ply ) you need to include this function for it to run properly.
[QUOTE=Bloodwave;41740657]I'm pretty sure its GM:PlayerLoadout( ply ) and not defined inside the player metatable.
[lua]
function GM:PlayerLoadout( ply )
ply:RemoveAllAmmo()
if ( ply:IsAdmin() ) then
ply:Give( "gmod_tool" )
ply:Give( "weapon_physcannon" )
ply:Give( "gmod_camera" )
ply:Give( "weapon_physgun" )
end
end
[/lua]
If you've defined the GM:PlayerSpawn( ply ) you need to include this function for it to run properly.[/QUOTE]
This fixed the error of my loadouts completely not working, but did not give admins the physgun.
I thought he was trying to write meta functions, not use the default game mode functions.
[QUOTE=Dreken;41740962]I thought he was trying to write meta functions, not use the default game mode functions.[/QUOTE]
All I wanna do is make a loadout for admins only that includes the physgun
[QUOTE=theone01143;41740695]This fixed the error of my loadouts completely not working, but did not give admins the physgun.[/QUOTE]
If the function actually works, but its not giving admins the physgun or the tool gun, then that means they're not declared as a admin in LUA, what admin mod do you use.
[QUOTE=Bloodwave;41741231]If the function actually works, but its not giving admins the physgun or the tool gun, then that means they're not declared as a admin in LUA, what admin mod do you use.[/QUOTE]
Evolve and ulx.
[editline]7th August 2013[/editline]
I was just on my server and some dude crashed it now its working
Sorry, you need to Log In to post a reply to this thread.