SetTimerEx calls function twice? - 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)
+--- Thread: SetTimerEx calls function twice? (
/showthread.php?tid=615035)
SetTimerEx calls function twice? -
-eXo - 16.08.2016
Solved by relocating the code from setplayerspawn to OnPlayerSpawn. Appreciate the help, however.
Код:
if(FirstSpawn[playerid] != 1)
{
PlayerInfo[playerid][pDeaths] += 1;
SetPlayerHealth(playerid, 25.0);
SetPlayerPos(playerid,DX,DY,DZ);
SetPlayerInterior(playerid,deathInt[playerid]);
SetPlayerVirtualWorld(playerid,worldInt[playerid]);
SetTimerEx("BWounded", 500, false, "d", playerid);
return 1;
}
Код:
public BWounded(playerid){
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~You are wounded ...", 30000, 3);
ApplyAnimation(playerid, "PED", "KO_shot_front", 4.1, 0, 1, 1, 1, 3000000, 1);
Attach3DTextLabelToPlayer(InjuredLabel[playerid], playerid, 0.0, 0.0, 0.7);
SendClientMessage(playerid, COLOR_WHITE, "You are wounded.");
SendClientMessage(playerid, COLOR_WHITE, "You cannot /death yet.");
isWounded[playerid] = 1;
acceptTimer[playerid] = SetTimerEx("AcceptDeath", 30000, false, "d", playerid);
}
Re: SetTimerEx calls function twice? -
Logic_ - 16.08.2016
Something else must be causing it, try the code below.
PHP код:
// script
new Smack[MAX_PLAYERS];
// callback
Smack[playerid] = 1;
if(FirstSpawn[playerid] != 1 && Smack[playerid])
{
Smack[playerid] = 0;
PlayerInfo[playerid][pDeaths] += 1;
SetPlayerHealth(playerid, 25.0);
SetPlayerPos(playerid,DX,DY,DZ);
SetPlayerInterior(playerid,deathInt[playerid]);
SetPlayerVirtualWorld(playerid,worldInt[playerid]);
SetTimerEx("BWounded", 500, false, "d", playerid);
return 1;
}
Re: SetTimerEx calls function twice? -
-eXo - 16.08.2016
Solved by relocating the code from setplayerspawn to OnPlayerSpawn. Appreciate the help, however.