-Blaze- Posted March 16, 2015 Share Posted March 16, 2015 Hello everybody , i'm trying to make a script where the last player in combat gets a reward. I'm using onVehicleExplode() to check on the number of alive players since it is a Shooter mode. How can i get the last player alive and set a variable to him so i may be able to give him money , exp ,etc.? Link to comment
xXMADEXx Posted March 16, 2015 Share Posted March 16, 2015 Inside the event, you can check the table size to see how many players are remaining. If it's only one, you can access it with variable[1]. Example: local players = getAlivePlayers ( ); -- Get players if ( #players == 1 ) then -- only one player is remaining local player = players [ 1 ]; -- 'player' variable is the winning player end Link to comment
-Blaze- Posted March 17, 2015 Author Share Posted March 17, 2015 Thanks , @xXMADEXx it works just fine. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now