General > Developers Corner
Trying to learn lua a little
Cobalt:
That is WAY more complicated than it needs to be. Also it won't work at all. PlayerSpawn is serverside, and why are you looping through every player, what in the world are you doing??
This is literally all you need:
--- Code: ---hook.Add( "PlayerSpawn", "PlayerCheck", function( ply )
local lv = ply:getDarkRPVar( "level" )
if lv > 10 then
ply:SetHealth( lv * 10 )
end
end )
--- End code ---
JamminR:
Indeed, you could have kept your original code, just added a bit.
There are two ways to make sure your code is on server side.
1) /autorun/cl or /sv - obvious where.
OR
2) You used part of the idea already, but then, instead of going from from point A to point be in a straight line, you circumnavigated the globe going the same direction.
Simple use your code, but add like this
--- Code: ---if SERVER then
... your original code ...
end
--- End code ---
I've not tested your code, nor do I know DarkRP to know it will work, but, one step at a time, keep it simple, get it 'running' on server only.
Navigation
[0] Message Index
[*] Previous page
Go to full version