event question
#1

I have a timer going and on every hour it tps everyone to a certain spots gives them all guns and they are to kill each other, when they join they get this variable tfight[playerid] ++;
Now I want to know how to tell who the last man alive is?

Here is my code

Код:
public fight()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    TogglePlayerControllable(i, 1);
		ResetPlayerWeapons(i);
		GivePlayerWeapon(i, 24, 99999);
		GivePlayerWeapon(i, 25, 99999);
		GivePlayerWeapon(i, 34, 99999);
		tfight[i] ++;
		if(gTeam[i] == 0)// fast food
		{
		    SetPlayerPos(i, changeme);
		}
		if(gTeam[i] == 1)//elvis
		{
		    SetPlayerPos(i, changeme);

		}
		if(gTeam[i] == 2)//medic
		{
		    SetPlayerPos(i, changeme);
  		}
  		if(gTeam[i] == 3)//sp
		{
		    SetPlayerPos(i, changeme);
		}
		if(gTeam[i] == 4)//wigger
		{
		    SetPlayerPos(i, changeme);
		}
		if(gTeam[i] == 5)//beachbums
		{
		    SetPlayerPos(i, changeme);
		}
		if(gTeam[i] == 6)// Rednecks
		{
		    SetPlayerPos(changeme);
		}
	}
	return 1;
}
Reply
#2

Im guessing, make it get the number of players that are there and when each dies make it one less until it gets to one.

(no clue how)
Reply
#3

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
(no clue how)
Essentially you had no reason to post then
Reply
#4

pawn Код:
new lastman[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    lastman[playerid] = 0;
    return 1;
}

public fight()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        TogglePlayerControllable(i, 1);
        ResetPlayerWeapons(i);
        GivePlayerWeapon(i, 24, 99999);
        GivePlayerWeapon(i, 25, 99999);
        GivePlayerWeapon(i, 34, 99999);
        tfight[i] ++;
        lastman[i]=1;
        if(gTeam[i] == 0)// fast food
        {
            SetPlayerPos(i, changeme);
        }
        if(gTeam[i] == 1)//elvis
        {
            SetPlayerPos(i, changeme);

        }
        if(gTeam[i] == 2)//medic
        {
            SetPlayerPos(i, changeme);
        }
        if(gTeam[i] == 3)//sp
        {
            SetPlayerPos(i, changeme);
        }
        if(gTeam[i] == 4)//wigger
        {
            SetPlayerPos(i, changeme);
        }
        if(gTeam[i] == 5)//beachbums
        {
            SetPlayerPos(i, changeme);
        }
        if(gTeam[i] == 6)// Rednecks
        {
            SetPlayerPos(changeme);
        }
    }
    return 1;
}
The players with lastman == 1 are last players alive.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)