Help. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help. (
/showthread.php?tid=135600)
Help. -
RawrTheory - 21.03.2010
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?
Re: Help. -
RawrTheory - 21.03.2010
Minor bump.
Re: Help. -
Fabio11 - 21.03.2010
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 ^^
Re: Help. -
RawrTheory - 21.03.2010
Код:
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)
Re: Help. -
Fabio11 - 21.03.2010
pawn Код:
for(new i=0;i<=MAX_PLAYERS; i++)
Must be inside a
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;
}