Problem with F4 and spectate if suicide - 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: Problem with F4 and spectate if suicide (
/showthread.php?tid=90635)
Problem with F4 and spectate if suicide -
TheKingWillem - 09.08.2009
Quote:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == playerid)
{
SendClientMessage(playerid, COLORHERE, "You killed yourself");
SetTimerEx("StopSpeccing", 10000, false, "i", playerid);
}
else
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
SetTimerEx("StopSpeccing", 10000, false, "i", playerid);
}
}
|
This is under OnPlayerDeath, and i have to callback funtion of StopSpeccing at the bottom etc.. But when i get killed, and press F4 first, it doesn't go to the class selection, and if i do suicide it doesn't wait 10 seconds at all, it just respawns..
Re: Problem with F4 and spectate if suicide -
Weirdosport - 09.08.2009
When making my spectate script, I found it better to use OnPlayerStateChange, rather than OnPlayerSpawn and OnPlayerDeath.
Re: Problem with F4 and spectate if suicide -
TheKingWillem - 09.08.2009
Can you be a bit more specific? If you are trying to help me ofcourse.
Re: Problem with F4 and spectate if suicide -
Weirdosport - 09.08.2009
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_WASTED)
{
}
}
I just found that this worked more reliably...
I'm not 100% sure what the problem is, do you wish for the spectator to witness the class selection, or just go back to speccing once the player has spawned?
Re: Problem with F4 and spectate if suicide -
TheKingWillem - 09.08.2009
I just want when a player is killed, you have to go to spectate, it does that fine, but when i press f4 first, it doesn't to to the class selection menu, it just spectates and the respawns. And if i do suicide, it doesn't spectate at all, but f4 works there...