How do I make a function that gives all the players scrap metal every 5 minutes they’ve been on the server using the goldenforge point addon?
-
[lua]
function GM:PlayerSpawn( ply )
self.BaseClass:PlayerSpawn( ply )if ply:IsAdmin() then
ply:SetMaxHealth(200)
ply:SetHealth(200)
end
end[/lua]
PlayerInitialSpawn is only called when the player first connects to the server.
[lua]
function GM:OnRoundResult( result, resulttext )
self.BaseClass:OnRoundResult( result, resulttext )
for _,v in pairs( player.GetAll() ) do
if v:Alive() and v:Team() == result then
v:GiveScrapMetal( 5, "Winner" )
end
end
end[/lua]
-
No.
Thanks so much for the help!
[editline]5th May 2012[/editline]
What files do I add those functions into? Sorry for being a noob xD
Where would you add those functions? What folder and file?
lua/autorun/server
Those are gamemode functions… If you placed them inside lua/autorun/server, “GM” would not exist at the time of their loading (and I believe you have to use “GAMEMODE”, not “GM”, if it’s not inside a gamemode file).
He has to place them inside a serverside gamemode file.