• Deathrun Point Rewards
    7 replies, posted
Hey everyone, I was wondering if there was a way to reward players who won on Deathrun with _Undefined's Pointshop? If so, thanks a bunch! :D
Pointshop Documentation: [url]http://pointshop.burt0n.net/[/url] [code]PS_GivePoints(number) [/code] -Serverside for giving points to a player Theres a few ways for checking for the winner(s) I used a different way and just looped through all the players and gave points to the ones alive for a fair share.... If your not willing to attempt to code it then use [url]https://scriptfodder.net/jobs/[/url] unless someone posts the code out of gratitude here.
So how could I specify who I want to give the points to? Example: "winner"
winner:PS_GivePoints( 1 ), assuming winner is an actual player and not a team ID or etc
[code]if SERVER then AddCSLuaFile() hook.Add( "OnRoundSet", "Round Set", function( round, winner ) if round == ROUND_ENDING then winner:PS_GivePoints(500) print( "The winner is "..winner.."!" ) end end ) end[/code] This isn't working... What do I need to fix ? :/
[lua] if winner ~= 123 then for k, v in pairs( team.GetPlayers( winner ) ) do if not v:Alive() then continue end v:PS_GivePoints( 500 ) end end [/lua]
[CODE]-snip-[/CODE] Will this work?
[CODE]//lua/autorun hook.Add( "OnRoundSet", "GivePointsDR", function ( round ) if ( round == ROUND_ENDING ) then for _, ply in pairs( player.GetAll() ) do if ply:Alive() then ply:PS_GivePoints( 20 ) ply:ChatPrint( "You got 20 points for finishing a round alive!" ) else ply:PS_GivePoints( 10 ) ply:ChatPrint( "You got 10 points for finishing a round!" ) end end end end ) hook.Add( "DoPlayerDeath", "Give Points", function( vict, att, dmginfo ) if not (IsValid(att) and att:IsPlayer() and att:Team() != vict:Team()) then return end att:PS_GivePoints( 5, "You got 5 points for killing a player!" ) end )[/CODE] I made this for my server so here you can use it. Edit: Woops. Didn't see what you wanted exactly. My codes there if you wanna use it.
Sorry, you need to Log In to post a reply to this thread.