SA-MP Forums Archive
tele to chiliad after death for 10 seconds ? - 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: tele to chiliad after death for 10 seconds ? (/showthread.php?tid=181908)



tele to chiliad after death for 10 seconds ? - Rocky Balboa - 07.10.2010

as the player dies ... then when he spawns he goes to chiliad ...and then after 10 seconds he respawns aat the normal place ...i tried a timer ..but it wasn't working for everyone .. it was working only for playerid 0.


Re: tele to chiliad after death for 10 seconds ? - Dime - 07.10.2010

Use timer


Re: tele to chiliad after death for 10 seconds ? - [L3th4l] - 07.10.2010

under OnPlayerDeath:
pawn Код:
SetPlayerSpawn(playerid, CHILLIADCOORDS);
SetTimerEx("Respawn", 10000, "i", 0, playerid);

---

forward Respawn(playerid);
public Respawn(playerid)
{
    SetPlayerPos(playerid, YOURNORMALPOSCOORDS");
    return 1;
}



Re: tele to chiliad after death for 10 seconds ? - Lenny the Cup - 07.10.2010

SA-MP timers are inefficient, use this instead:

pawn Код:
SetPlayerPos(playerid, chilliadcoords);
CreatePVarInt(playerid, "DeathTimer", gettime()+10);
And put this in OnPlayerUpdate:
pawn Код:
if(GetPVarInt(playerid, "DeathTimer"))
{
    if(GetPVarInt(playerid, "DeathTimer") < gettime())
    {
        SetPlayerPos(playerid, normal, spawn, coords);
        DeletePVar(playerid, "DeathTimer");
    }
}
Good luck


Re: tele to chiliad after death for 10 seconds ? - Rocky Balboa - 08.10.2010

nop,the pvar didnt work ...and the timer instead of spawning me .. it spawned another person ... so that way failed too,is there another way ?


Re: tele to chiliad after death for 10 seconds ? - Rocky Balboa - 08.10.2010

btw .. can anyone explain me whats the "gettime()" is for and the "+10" is for and when you get hte pvar why is it "< gettime() "?maybe i made them wrong ?and where do it put the .. setpvarinit ? on playerdeath ?


Re: tele to chiliad after death for 10 seconds ? - Rocky Balboa - 09.10.2010

anyone ?


Re: tele to chiliad after death for 10 seconds ? - WillyP - 09.10.2010

onplayerdeath
setplayerpos(chilliadpos)
settimer(timername,10000,true

public timername

code here