Hey guys I'm a complete noob with Lua Coding, but interested into learning it but I want to understand why this code isn't working
function GM:PlayerSpawn( ply )
if ply:Team() == TEAM_POLICE then
ply:SetArmor( 50 )
end
end
I've put this code in; lua/autorun/server, than darkrp/gamemode/init.lua but it's not working.
I'm not getting any errors or anything. I'm also using a custom HUD.
-Thanks in advance
[highlight](User was banned for this post ("Read the stickies before posting (again)" - Asaratha))[/highlight]
You're overriding the function that DarkRP uses to setup players when they spawn. Use hooks instead:
[code]
local function setPoliceArmor( ply )
if ply:Team() == TEAM_POLICE then
ply:SetArmor( 50 )
end
end
hook.Add("PlayerSpawn", "YourUniqueNameHere12460348256078", setPoliceArmor)
[/code]
It still isn't working, where should I place this code at? (Sorry, I'm very rubbish at placing codes in correct paths.)
Sorry, you need to Log In to post a reply to this thread.