SA-MP Forums Archive
player spectate, pls i need 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: player spectate, pls i need help (/showthread.php?tid=264013)



player spectate, pls i need help - handerson - 24.06.2011

Quote:

public OnPlayerDeath(playerid, killerid, reason)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);

how to make player will spectate killerid about 5 seconds, after that player will respawn

pls help


Re: player spectate, pls i need help - Calgon - 24.06.2011

pawn Код:
forward respawnFromSpec(playerid);
public respawnFromSpec(playerid) {
    TogglePlayerSpectating(playerid, false);
    SpawnPlayer(playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason) {
    TogglePlayerSpectating(playerid, true);
    PlayerSpectatePlayer(playerid, killerid);
    SetTimerEx("respawnFromSpec", 5000, false, "d", playerid);
    return 0;
}
This code should work, you might need to add your SetSpawnInfo code and whatnot though.