delay death bug?
#1

I'm not sure if this is a bug in my script or what but every time I died or get killed. It loads up 1-2 seconds before I actually drop dead from the floor. Like, I died already but I can still run around for a couple of seconds lol.

EDIT: Tried #include "fixes.inc" but it didn't fix the problem.

Any idea guys? This is my OnPlayerDeath
PHP код:
public OnPlayerDeathplayeridkilleridreason )
{
    
SendDeathMessagekilleridplayeridreason );
    
DestroyVehObjectplayerid );
    
    
DisablePlayerRaceCheckpointplayerid ); // Anti CPR Bug
    
    
SetPlayerWantedLevel(killeridGetPlayerWantedLevel(killerid)+1);
    
SetPlayerWantedLevel(playerid,0);
    if ( 
IsPlayerConnectedkillerid ) )
        
PlayerInfokillerid ][ Kills ]     ++;
    
PlayerInfoplayerid ][ Deaths ]        ++;
    
PlayerInfoplayerid ][ KillingSpree ]     = 0;
    if(
gPlayerUsingLoopingAnim[playerid])
    {
        
gPlayerUsingLoopingAnim[playerid] = 0;
        
TextDrawHideForPlayer(playerid,txtAnimHelper);
    }
    
    if( 
DuelInfo[player1] == playerid ||  DuelInfo[player2] == playerid)
    {
        if(
DuelInfo[stat]==2)
        {
            if(
playerid == DuelInfo[player1]) EndDuel(DuelInfo[player2],DuelInfo[player1]);
              else if(
playerid == DuelInfo[player2]) EndDuel(DuelInfo[player1],DuelInfo[player2]);
        }
        else
        {
              
RemoveFromDuel(playerid,1);
                
DuelInfo[stat]=0,DuelInfo[player1]=-225,DuelInfo[player2]=-1;
        }
    }
    new 
weaponid;
    if(
AInfo[playerid][Ach15] != 1)
    {
        if(
PlayerInfoplayerid ][ ActionID ] == 14)
        {
            if(
weaponid == 4)
            {
                new 
str250 ];
                
PlayerTextDrawSetPreviewModel(killeridPropTD[killerid][6], 325);
                
format(str,sizeof(str),"~l~Cookies: +5");
                
PlayerTextDrawSetString(killerid,PropTD[killerid][1],str);
                
format(str,sizeof(str),"~l~Score: +10");
                
PlayerTextDrawSetString(killerid,PropTD[killerid][2],str);
                
format(str,sizeof(str),"~l~Money: +$200000");
                
PlayerTextDrawSetString(killerid,PropTD[killerid][0],str);
                
PlayerTextDrawSetString(killerid,PropTD[killerid][7],"~r~A~g~c~y~h~b~i~r~e~g~v~b~e~y~m~r~e~g~n~b~t Unlocked!");
                
PlayerTextDrawSetString(killerid,PropTD[killerid][5],"_~n~_~n~_~n~_");
                
PlayerTextDrawShow(killerid,PropTD[killerid][0]);
                
PlayerTextDrawShow(killerid,PropTD[killerid][1]);
                
PlayerTextDrawShow(killerid,PropTD[killerid][2]);
                
PlayerTextDrawShow(killerid,PropTD[killerid][7]);
                
PlayerTextDrawShow(killerid,PropTD[killerid][5]);
                
PlayerTextDrawShow(killerid,PropTD[killerid][6]);
                
PlayerInfokillerid ][ Cookies ] += 5;
                
SetTimerEx("HideAcheveTD",9000,false,"i",killerid);
                
AInfo[killerid][Ach15] = 1;
                
AInfo[killerid][AchsCompleted]++;
                
SendFormattedMessageToAll(0xFF0000FF"ACHS: {8CAB62}%s(%i) has unlocked the Silent Killer' achievement!"GetPName(killerid), killerid);
                
GivePlayerMoney(killerid200000), GivePlayerScore(killerid2);
                if(
AInfo[playerid][AchsCompleted] >= 16)
                {
                    
GivePlayerMoney(playerid10000000), GivePlayerScore(killerid2);
                    
SendFormattedMessageToAll(0xFF0000FF"ACHS: {8CAB62}%s(%i) has unlocked all of the achievements!"GetPName(killerid), killerid);
                    return 
1;
                }
            }
        }
    }
    if(
GetPVarInt(playerid,"InDerby")) Remove_From_Derby(playerid,1);
    if( 
GetPVarInt(playerid,"PINEVENT"))
    {
               
SetPlayerSkin(playerid,SavedSKIN[playerid]);
               
DeletePVar(playerid,"PINEVENT");
                
Iter_RemovePlayerInQPplayerid );
               
PlayerInfoplayerid ][ ActionID ] = 0;
                  
PlayerInfoplayerid ][ DM_Event ] = ( );
               
LoadPlayerCoords(playerid);
                
SetPlayerVirtualWorld(playerid,0);
                
SpawnInDMplayerid ] = " ";
    }
    if(
GetPVarInt(playerid,"InParkour"))
    {
             
DestroyVehicleBP1Vehplayerid ] );
            
DeletePVar(playerid,"InParkour");
            
ResetPlayerWeaponsplayerid );
            
LoadPlayerCoords(playerid);
            
PlayerInfoplayerid ][ ActionID ] = 0;
            
SpawnInDMplayerid ] = " ";
               
SetPlayerVirtualWorldplayerid);
    }
    if(
GetPVarInt(playerid,"InParkour3"))
    {
             
DestroyVehicleBP3Vehplayerid ] );
            
DeletePVar(playerid,"InParkour3");
            
ResetPlayerWeaponsplayerid );
            
LoadPlayerCoords(playerid);
            
PlayerInfoplayerid ][ ActionID ] = 0;
            
SpawnInDMplayerid ] = " ";
               
SetPlayerVirtualWorldplayerid);
    }
    if(
GetPVarInt(playerid,"InParkour4"))
    {
             
DestroyVehicleBP4Vehplayerid ] );
            
DeletePVar(playerid,"InParkour4");
            
ResetPlayerWeaponsplayerid );
            
LoadPlayerCoords(playerid);
            
PlayerInfoplayerid ][ ActionID ] = 0;
            
SpawnInDMplayerid ] = " ";
               
SetPlayerVirtualWorldplayerid);
    }
    if(
GetPVarInt(playerid,"InParkour2"))
    {
             
DestroyVehiclebp2vehplayerid ] );
            
DeletePVar(playerid,"InParkour2");
            
ResetPlayerWeaponsplayerid );
            
LoadPlayerCoords(playerid);
            
PlayerInfoplayerid ][ ActionID ] = 0;
            
SpawnInDMplayerid ] = " ";
               
SetPlayerVirtualWorldplayerid);
    }
    if(
GetPVarInt(playerid,"Dive1"))
    {
            
DeletePVar(playerid,"Dive1");
            
PlayerInfoplayerid ][ ActionID ] = 0;
    }
    if(
GetPVarInt(playerid,"Dive2"))
    {
            
DeletePVar(playerid,"Dive2");
            
PlayerInfoplayerid ][ ActionID ] = 0;
    }
    if(
GetPVarInt(playerid,"Dive3"))
    {
            
DeletePVar(playerid,"Dive3");
            
PlayerInfoplayerid ][ ActionID ] = 0;
    }
    if(
GetPVarInt(playerid,"QuadParkour"))
    {
             
DestroyVehicleQuadVehplayerid ] );
            
DeletePVar(playerid,"QuadParkour");
            
ResetPlayerWeaponsplayerid );
            
LoadPlayerCoords(playerid);
            
Iter_RemovePlayerInQPplayerid );
            
PlayerInfoplayerid ][ ActionID ] = 0;
            
SpawnInDMplayerid ] = " ";
               
SetPlayerVirtualWorldplayerid);
    }
    if(
GetPVarInt(playerid,"INHAY"))
    {
            
DeletePVar(playerid,"INHAY");
            
ResetPlayerWeaponsplayerid );
            
LoadPlayerCoords(playerid);
            
Iter_RemovePlayerInHayplayerid );
            
PlayerInfoplayerid ][ ActionID ] = 0;
            
SpawnInDMplayerid ] = " ";
               
SetPlayerVirtualWorldplayerid);
    }
    if(
GetPVarInt(playerid,"Signed4Lms") && (LMS 1))
    {
        
Remove_From_Lms(playerid,1);
      }
      if(
GetPVarInt(playerid,"inFallout") && FallOut 1)
      {
        
RemoveFromFallout(playerid,0);
      }
    new 
FloatXFloat:YFloat:Z;
    
GetPlayerPosplayeridXY);
    
SetPlayerPosplayeridXY0.1 );
    
gsString] = EOS;
    if ( 
PlayerInfoplayerid ][ ActionID ] == )
    {
        
PlayerInfoplayerid ][ DERBY_Event ] = 0;
         
PlayerInfoplayerid ][ ActionID ] = 0;
        
Iter_Remove(PlayerInDerbyplayerid);
        
PlayerInfoplayerid ][ ActionID ] = 0;
        
BloodringFullPlayerInfoplayerid ][ PlayerInBloodring ] ] = 0;
           
PlayerInfoplayerid ][ PlayerInBloodring ] = -1;
           
SetPlayerInteriorplayerid);
           
SetPlayerVirtualWorldplayerid);
           if(
Iter_Count(PlayerInDerby) == )
           {
            
Iter_Clear(PlayerInDerby);
            
DerbyPlaying     0;
            
DerbyOn         0;
            
RespawnBloodrings( );
        }
    }
    if ( 
PlayerInfoplayerid ][ DM_Event ] == && PlayerInfoplayerid ][ ActionID ] == )
    {
        if ( 
IsPlayerConnectedkillerid ) )
        {
               
gsString] = EOS;
            
formatgsStringsizeofgsString ), "~g~~h~Wonderful~w~~h~, you killed ~r~~h~%s ~w~~h~!~n~~w~~h~+~g~~h~$~w~~h~5000 and +2 score"PlayerNameplayerid ) );
            
InfoTD_MSGkillerid5000gsString );
            
GivePlayerMoneykillerid5000 );
            
GivePlayerHealkillerid25 );
            
gsString] = EOS;
            
formatgsStringsizeofgsString ), "~r~~h~%s~w~ killed you!"PlayerNamekillerid ) );
            
InfoTD_MSGplayerid5000gsString );
        }
    }
    if ( 
PlayerInfoplayerid ][ DM_Event ] == || PlayerInfoplayerid ][ ActionID ] == )
    {
        if ( 
IsPlayerConnectedkillerid ) )
        {
               
gsString] = EOS;
               
PlayerInfokillerid ][ eKills ]++;
            
PlayerInfoplayerid ][ eDeaths ]++;
            
formatgsStringsizeofgsString ), "~g~~h~Wonderful~w~~h~, you killed ~r~~h~%s ~w~~h~!~n~~w~~h~+~g~~h~$~w~~h~5000 and +2 score"PlayerNameplayerid ) );
            
InfoTD_MSGkillerid5000gsString );
            
GivePlayerMoneykillerid5000 );
            
GivePlayerHealkillerid25 );
            
gsString] = EOS;
            
formatgsStringsizeofgsString ), "~r~~h~%s~w~ killed you! :("PlayerNamekillerid ) );
            
InfoTD_MSGplayerid5000gsString );
            foreach( 
Player)
                
FormatMSGi, ~1""R"[DM-Event] "GRI"%s killed %s ("O"%s"GRI") "YE"[%s]"PlayerNamekillerid ), PlayerNameplayerid ), GetWeaponreason ), SpawnInDMkillerid ] );
        }
    }
    if ( 
PlayerInfoplayerid ][ ActionID ] == && PlayerInfoplayerid ][ DM_Event ] == )
    {
        if ( 
IsPlayerConnectedkillerid ) )
        {
               
gsString] = EOS;
               
PlayerInfokillerid ][ eKills ]++;
            
PlayerInfoplayerid ][ eDeaths ]++;
            
formatgsStringsizeofgsString ), "~g~~h~Wonderful~w~~h~, you killed ~r~~h~%s ~w~~h~!~n~~w~~h~+~g~~h~$~w~~h~6000 and +2 score"PlayerNameplayerid ) );
            
InfoTD_MSGkillerid5000gsString );
            
GivePlayerMoneykillerid6000 );
            
GivePlayerHealkillerid25 );
            
gsString] = EOS;
            
formatgsStringsizeofgsString ), "~r~~h~%s~w~ killed you!"PlayerNamekillerid ) );
            
InfoTD_MSGplayerid5000gsString );
            foreach( 
Player)
                
FormatMSGi, ~1""G"[DM-Info] "GRI"%s killed %s ("O"%s"GRI") "YE"[%s]"PlayerNamekillerid ), PlayerNameplayerid ), GetWeaponreason ), SpawnInDMkillerid ] );
        }
    }
     if( 
PlayerInfoplayerid ][ ActionID ] == )
    {
        
JoinCount--;
        
PlayerInfoplayerid ][ ActionID ] = ( );
        
DestroyVehicle(CreatedRaceVeh[playerid]);
        
DisablePlayerRaceCheckpoint(playerid);
        for ( new 
011i++ )
            
PlayerTextDrawHideplayeridRace_InfoTD] );
        
CPProgess[playerid] = 0;
        
KillTimerInfoTimerplayerid ] );
        
Iter_Remove(GodCarplayerid);
        
#if defined RACE_IN_OTHER_WORLD
        
SetPlayerVirtualWorld(playeridRaceWorld);
        
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), RaceWorld);
        
#endif
    
}
    if ( 
IsPlayerConnectedkillerid ) )
    {
        if ( 
PlayerInfokillerid ][ PGoted ] == playerid )
        {
            
Announcekillerid"~r~~h~You have been jailed (3 Mins)!~n~~w~Next time don't make /go + ~r~~h~kill!"3000);
            
gTimekillerid ][ ] = 2;
            
gTimekillerid ][ ] = 60;
            
TextDrawSetStringJailed_TD"Jailed for:" );
            
TextDrawShowForPlayerkilleridJailed_TD );
            
TextDrawShowForPlayerkilleridJailed_Backround );
            
PlayerTextDrawShowkilleridJail_Time );
            
SetTimerEx"JailPlayer"50000"i"killerid );
            
SetTimerEx"Jail1"10000"i"killerid );
            
SetTimerEx"ShowJailLeftTime"10000"i"killerid );
            
PlayerInfokillerid ][ Jailed ] = 1;
            
PlayerInfokillerid ][ PGoted ] = -1;
            
KillTimerGotoTimerkillerid ] );
            return ( 
);
        }
    }
    if ( 
IsPlayerConnectedkillerid ) )
    {
        if ( 
PlayerInfokillerid ][ KillingSpree ] != PlayerInfokillerid ][ bKillingSpree ] )
            
PlayerInfokillerid ][ KillingSpree ]++;
        else
        {
            
PlayerInfokillerid ][ bKillingSpree ]++;
            
PlayerInfokillerid ][ KillingSpree ]++;
        }
        
formatgsStringsizeofgsString ), "~g~~h~Killing Spree: ~r~~h~%d"PlayerInfokillerid ][ KillingSpree ] );
        
AnnouncekilleridgsString2000);
        
CheckPlayerQuakeplayeridkillerid );
        if ( 
PlayerInfokillerid ][ KillingSpree ] >= )
         {
             foreach( 
Player)
            
FormatMSGi, ~1"{DBED15}** {%06x}%s(%d) {BABABA}is on a kill streak with %d kills!"GetPlayerColorkillerid ) >>> 8PlayerNamekillerid ), killeridPlayerInfokillerid ][ KillingSpree ] );
         }
    }
    if ( 
IsPlayerConnectedkillerid ) )
    {
        if ( 
PlayerInfokillerid ][ ActionID ] == )
        {
            if ( 
IsPlayerInRangeOfPointkillerid80.02748.7576,-1752.1027,49.8003 ) )
            {
                
PlayerInfokillerid ][ Cookies ] += 2;
                
formatgsStringsizeofgsString ), "~g~~h~Won: ~y~+~r~2~y~ Cookies" );
                
InfoTD_MSGkillerid4000gsString );
                
PlayerInfoplayerid ][ ActionID ] = 0;
            }
        }
    }
    
    if ( 
IsPlayerConnectedkillerid ) )
    {
        if ( 
PlayerInfokillerid ][ GID ] != )
        {
            if ( 
PlayerInfokillerid ][ GID ] != PlayerInfoplayerid ][ GID ] )
            {
                
formatgsQuery128"UPDATE `groups` SET `groupPoints` = `groupPoints`+1 WHERE `id` = '%d'"PlayerInfokillerid ][ GID ] );
                
mysql_querygsQueryTHREAD_NONEkillerid );
            }
        }
    }
    if ( 
PlayerInfoplayerid ][ HaveGPS ] )
    {
        
KillTimerGPSTimerplayerid ] );
        
PlayerInfoplayerid ][ HaveGPS ] = false;
        
GPSTimerplayerid ] = 0;
    }
    if ( 
IsPlayerConnectedkillerid ) )
    {
        if ( 
reason <= 46 && hitplayerid ] != )
        {
            
formatgsStringsizeofgsString ), "{FF0000}%s (%i) {33CCFF}killed {FF0000}%s (%i) {33CCFF}and recieved {FF0000}$%i {33CCFF}for a completed hit"PlayerNamekillerid ), killeridPlayerNameplayerid ), playeridhitplayerid ] );
            
SendClientMessageToAllCOLOR_LIGHTBLUEgsString );
            
GivePlayerMoneykilleridhitplayerid ] );
            
GivePlayerMoneyhiterplayerid ], - hitplayerid ] );
            
hitplayerid ] = 0;
            if(
AInfo[playerid][Ach16] != 1)
            {
                if(
PlayerInfoplayerid ][ KillingSpree ] >= 20)
                {
                    new 
str250 ];
                    
PlayerTextDrawSetPreviewModel(playeridPropTD[playerid][6], 325);
                    
format(str,sizeof(str),"~l~Cookies: +5");
                    
PlayerTextDrawSetString(playerid,PropTD[playerid][1],str);
                    
format(str,sizeof(str),"~l~Score: +10");
                    
PlayerTextDrawSetString(playerid,PropTD[playerid][2],str);
                    
format(str,sizeof(str),"~l~Money: +$200000");
                    
PlayerTextDrawSetString(playerid,PropTD[playerid][0],str);
                    
PlayerTextDrawSetString(playerid,PropTD[playerid][7],"~r~A~g~c~y~h~b~i~r~e~g~v~b~e~y~m~r~e~g~n~b~t Unlocked!");
                    
PlayerTextDrawSetString(playerid,PropTD[playerid][5],"_~n~_~n~_~n~_");
                    
PlayerTextDrawShow(playerid,PropTD[playerid][0]);
                    
PlayerTextDrawShow(playerid,PropTD[playerid][1]);
                    
PlayerTextDrawShow(playerid,PropTD[playerid][2]);
                    
PlayerTextDrawShow(playerid,PropTD[playerid][7]);
                    
PlayerTextDrawShow(playerid,PropTD[playerid][5]);
                    
PlayerTextDrawShow(playerid,PropTD[playerid][6]);
                    
PlayerInfoplayerid ][ Cookies ] += 5;
                    
SetTimerEx("HideAcheveTD",9000,false,"i",playerid);
                    
AInfo[playerid][Ach16] = 1;
                    
AInfo[playerid][AchsCompleted]++;
                    
SendFormattedMessageToAll(0xFF0000FF"ACHS: {8CAB62}%s(%i) has unlocked the 'Hitman' achievement!"GetPName(playerid), playerid);
                    
GivePlayerMoney(playerid200000), GivePlayerScore(playerid2);
                    if(
AInfo[playerid][AchsCompleted] >= 16)
                    {
                        
GivePlayerMoney(playerid10000000), GivePlayerScore(playerid2);
                        
SendFormattedMessageToAll(0xFF0000FF"ACHS: {8CAB62}%s(%i) has unlocked all of the achievements!"GetPName(playerid), playerid);
                        return 
1;
                    }
                }
            }
        }
        else if ( 
hitplayerid ] != )
        {
            
formatgsStringsizeofgsString ), "The hit on {FF0000}%s (%i) {33CCFF}has been cancelled {FF0000}(died)"PlayerNameplayerid ), playerid );
            
SendClientMessageToAllCOLOR_LIGHTBLUEgsString );
            
hitplayerid ] = 0;
        }
    }
    foreach(new 
xPlayer)
    if ( 
GetPlayerState) == PLAYER_STATE_SPECTATING && PlayerInfo][ SpecID ] == playerid )
            
AdvanceSpectate);
    return ( 
);

Reply
#2

If you're using a timer at all to initiate the death system, you could try using the gettickcount method instead. If you aren't however, just try making some optimizations to the code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)