SetTimerEx calls function twice?
#1

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

Something else must be causing it, try the code below.

PHP код:
// script
new Smack[MAX_PLAYERS];
// callback
Smack[playerid] = 1;
if(
FirstSpawn[playerid] != && Smack[playerid])
{
    
Smack[playerid] = 0;
    
PlayerInfo[playerid][pDeaths] += 1;
    
SetPlayerHealth(playerid25.0);
    
SetPlayerPos(playerid,DX,DY,DZ);
    
SetPlayerInterior(playerid,deathInt[playerid]);
    
SetPlayerVirtualWorld(playerid,worldInt[playerid]);
    
SetTimerEx("BWounded"500false"d"playerid);
    return 
1;

Reply
#3

Solved by relocating the code from setplayerspawn to OnPlayerSpawn. Appreciate the help, however.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)