Set Health for player using steamID?

Alright, I’m a noob at coding in lua but I would like to know if this would work to give 200 health to a player with that steam ID.
[lua]function donatorHealth( ply )
if ply:SteamID == steamidhere then
ply:SetMaxHealth(200)
ply:SetHealth(200)
end
end
function donatorHealth()[/lua]

FUUUUUUUUUUUUUUUU WIZARD! :stuck_out_tongue:

[lua]
hook.Add(“PlayerSpawn”, “donator_health_stuff”, function(ply)
if ply:SteamID() == <steamID> then
ply:SetMaxHealth(200)
ply:SetHealth(200)
end
end)
[/lua]

Your donatorHealth function takes a ply argument that you never provide.

This helped me also. How would you add multiple Steam Id’s? Thanks again.

[lua]
hook.Add(“PlayerSpawn”, “donator_health_stuff”, function(ply)
local donators = { <steamID_1>, <steamID_2>, <etc> }

if table.HasValue(donators, ply:SteamID()) then
    ply:SetMaxHealth(200)
    ply:SetHealth(200)
end

end)
[/lua]

This is extremely weird, but when the code is added (init.lua) it messes the game up and spawns you with a weapon in a Deathrun Gamemode. We removed it and it worked perfectly, but why is it now working?

Check for errors in the console.

Alright, testing now.

[editline]8th May 2012[/editline]

There aren’t any errors in the console… Is there any other way we can give donators 200 HP?
Thanks!

What’s your code. (post it with steamid’s and all, we don’t care)

I’ve tried the following…

[lua]
hook.Add(“PlayerSpawn”, “donator_health_stuff”, function(ply)
if ply:SteamID() == STEAM_0:0:31436899 then
ply:SetMaxHealth(200)
ply:SetHealth(200)
end
end)[/lua]

Put the SteamID in quotes. It’s a string.

What admin mod are you using? I’ll write you a quick code using that to not use shit coding.

im using valve ban and kick system can you please rite it up for me 2 i have the same problem