SA-MP Forums Archive
Problem with spectating on killer - 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 spectating on killer (/showthread.php?tid=103354)



Problem with spectating on killer - Pawno_Master - 19.10.2009

Hello i have this code in my pawno

if(!IsPlayerInAnyVehicle(killerid)) {
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid); }
if(IsPlayerInAnyVehicle(killerid)) {
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, killerid);
SetTimerEx("spawntime",10000,false,"i",playerid);

public spawntime(playerid)
{
TogglePlayerSpectating(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetTimerEx("OnPlayerSpawn",1000,false,"i",playerid );
}

i use this code so the player wil spectate the killer for 10 secs the probvlem is sometimes it works and you spectate and than youll spawn but somethimes you spectate your killer but you wont ever spawn

what could be the problem




Re: Problem with spectating on killer - roschti - 19.10.2009

try this:

Код:
if(!IsPlayerInAnyVehicle(killerid)) {
  TogglePlayerSpectating(playerid, 1);
  PlayerSpectatePlayer(playerid, killerid); }
  if(IsPlayerInAnyVehicle(killerid)) {
  TogglePlayerSpectating(playerid, 1);
  PlayerSpectateVehicle(playerid, GetPlayerVehicleID(killerid));
  SetTimerEx("spawntime",10000,false,"i",playerid);

  public spawntime(playerid)
  {
  TogglePlayerSpectating(playerid,0);
  SetPlayerVirtualWorld(playerid,0);
  //SetTimerEx("OnPlayerSpawn",1000,false,"i",playerid); <- "OnPlayerSpawn" is called when you will spawn, not to spawn!
  SpawnPlayer(playerid);
  }