Problem with spectating on killer
#1

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

Reply
#2

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);
  }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)