SA-MP Forums Archive
Last Player Alive - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Last Player Alive (/showthread.php?tid=628242)



Last Player Alive - aoky - 07.02.2017

So the gamemode I'm using I want to add it so the last player alive gets a Deagle with 5 bullets and a knife. How can I do this? When a player dies, he spectates a player. I will rep anyone who helps!


Re: Last Player Alive - ranme15 - 08.02.2017

Код:
new playersAlive;
new winnerID;
 
When player respawns - playersAlive ++;
When player dies:
{
    playersAlive --;
    if(playersAlive == 1)
    {
        for(new i = 0, j = GetPlayerPoolSize(); i <= j; i ++)
        {  
            if(player[i][Alive])
            {
                GivePlayerWeapon(playerid, 24, 5);
                GivePlayerWeapon(playerid, 4, 1);
                break;
            }
        }
    }
}



Re: Last Player Alive - aoky - 08.02.2017

Doesn't work