Spectate Random Player - 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: Spectate Random Player (
/showthread.php?tid=147789)
Spectate Random Player -
Jokerstyle - 14.05.2010
as the title says, I want that when a player dies, he spectates a random player.
That's what I have:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128];
format(string, sizeof(string), "This mission does not allow respawn, wait till the round is over!");
TextDrawSetString(Textdraw3, string);
TextDrawShowForAll(Text:Textdraw3);
SetTimer("KillTextdrawAll", 4000, false);
TogglePlayerSpectating(playerid, +1);
PlayerSpectatePlayer(playerid, killerid);
return 1;
}
and
Код:
stock GetRandomPlayer()
{
new yplayer[MAX_PLAYERS+1];
for (new y = 0; y != MAX_PLAYERS; y ++) {
if (IsPlayerConnected(y)) {
yplayer[0] ++;
yplayer[yplayer[0]] = y;
}
}
return yplayer[random(yplayer[0])+1];
}
Well my problem is that I don't know how to implent the stock into the
Код:
TogglePlayerSpectating(playerid, +1);
PlayerSpectatePlayer(playerid, killerid);
thing
Re: Spectate Random Player -
Killa_ - 14.05.2010
pawn Код:
TextDrawShowForAll(Textdraw3);
pawn Код:
new RandomId = GetRandomPlayer();
TogglePlayerSpectating(playerid,1);
PlayerSpectatePlayer(playerid, RandomId);
?
Re: Spectate Random Player -
Jokerstyle - 14.05.2010
Quote:
Originally Posted by Killa_
pawn Код:
new RandomId = GetRandomPlayer(); TogglePlayerSpectating(playerid,1); PlayerSpectatePlayer(playerid, RandomId);
?
|
//EDIT: Thank you it's wokrking
Re: Spectate Random Player -
Torran - 14.05.2010
pawn Код:
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, GetRandomPlayer());