#1

Alright well...

I want to make it so whenever someone dies, they spectate the alive players until a new round has started. How would I do such a thing?
Reply
#2

Minor bump.
Reply
#3

pawn Код:
// Top
new Spectating[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    Spectating[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, killerid);
    Spectating[playerid] = 1;
    return 1;
}

// When new round starts
for(new i=0;i<=MAX_PLAYERS; i++)
{
    if(Spectating[i] == 1)
    {
        TogglePlayerSpectating(i, 0);
        SpawnPlayer(i);
        Spectating[i] = 0;
    }
}
Hope it helped ^^
Reply
#4

Код:
C:\Users\Chrispy\Documents\SA-MP Server\gamemodes\Battle_Of_The_Riches.pwn(94) : error 010: invalid function or declaration
C:\Users\Chrispy\Documents\SA-MP Server\gamemodes\Battle_Of_The_Riches.pwn(96) : error 010: invalid function or declaration
94:
Код:
for(new i=0;i<=MAX_PLAYERS; i++)
96:
Код:
	if(Spectating[i] == 1)
Reply
#5

pawn Код:
for(new i=0;i<=MAX_PLAYERS; i++)
Must be inside a
pawn Код:
public
or inside a command. Like this:

pawn Код:
if(strcmp(cmd, "/alive", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            for(new i=0;i<=MAX_PLAYERS; i++)
            {
                if(Spectating[i] == 1)
                {
                    TogglePlayerSpectating(i, 0);
                    SpawnPlayer(i);
                    Spectating[i] = 0;
                    SendClientMessageToAll(COLOR_RED,"All players alive!");
                }
            }
        } else return 0;
    return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)