• Need Help Deathrun
    5 replies, posted
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?
1. [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. 2. [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] 3. No. 4. [url=http://www.facepunch.com/threads/1121514]WolfDJ.[/url]
[QUOTE=.\\Shadow};35843487]1. [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. 2. [lua] function GM:OnRoundResult( result, resulttext ) self.BaseClass:OnRoundResult( result, resulttext ) if result == TEAM_RUN then for _,v in pairs(player.GetAll()) do if v:Alive() and v:Team() == TEAM_RUN then v:GiveScrapMetal( 5, "Winner" ) end end elseif result == TEAM_DEATH then for _,v in pairs(player.GetAll()) do if v:Alive() and v:Team() == TEAM_DEATH then v:GiveScrapMetal( 5, "Winner" ) end end end end[/lua] 3. No. 4. [url=http://www.facepunch.com/threads/1121514]WolfDJ.[/url][/QUOTE] 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
[QUOTE=Senor_Penguin;35847702]lua/autorun/server[/QUOTE] 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.
Sorry, you need to Log In to post a reply to this thread.