21.07.2016, 22:22
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
EDIT: Tried #include "fixes.inc" but it didn't fix the problem.
Any idea guys? This is my OnPlayerDeath
PHP код:
public OnPlayerDeath( playerid, killerid, reason )
{
SendDeathMessage( killerid, playerid, reason );
DestroyVehObject( playerid );
DisablePlayerRaceCheckpoint( playerid ); // Anti CPR Bug
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid)+1);
SetPlayerWantedLevel(playerid,0);
if ( IsPlayerConnected( killerid ) )
PlayerInfo[ killerid ][ Kills ] ++;
PlayerInfo[ playerid ][ Deaths ] ++;
PlayerInfo[ playerid ][ 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(PlayerInfo[ playerid ][ ActionID ] == 14)
{
if(weaponid == 4)
{
new str[ 250 ];
PlayerTextDrawSetPreviewModel(killerid, PropTD[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]);
PlayerInfo[ killerid ][ 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(killerid, 200000), GivePlayerScore(killerid, 2);
if(AInfo[playerid][AchsCompleted] >= 16)
{
GivePlayerMoney(playerid, 10000000), GivePlayerScore(killerid, 2);
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_Remove( PlayerInQP, playerid );
PlayerInfo[ playerid ][ ActionID ] = 0;
PlayerInfo[ playerid ][ DM_Event ] = ( 0 );
LoadPlayerCoords(playerid);
SetPlayerVirtualWorld(playerid,0);
SpawnInDM[ playerid ] = " ";
}
if(GetPVarInt(playerid,"InParkour"))
{
DestroyVehicle( BP1Veh[ playerid ] );
DeletePVar(playerid,"InParkour");
ResetPlayerWeapons( playerid );
LoadPlayerCoords(playerid);
PlayerInfo[ playerid ][ ActionID ] = 0;
SpawnInDM[ playerid ] = " ";
SetPlayerVirtualWorld( playerid, 0 );
}
if(GetPVarInt(playerid,"InParkour3"))
{
DestroyVehicle( BP3Veh[ playerid ] );
DeletePVar(playerid,"InParkour3");
ResetPlayerWeapons( playerid );
LoadPlayerCoords(playerid);
PlayerInfo[ playerid ][ ActionID ] = 0;
SpawnInDM[ playerid ] = " ";
SetPlayerVirtualWorld( playerid, 0 );
}
if(GetPVarInt(playerid,"InParkour4"))
{
DestroyVehicle( BP4Veh[ playerid ] );
DeletePVar(playerid,"InParkour4");
ResetPlayerWeapons( playerid );
LoadPlayerCoords(playerid);
PlayerInfo[ playerid ][ ActionID ] = 0;
SpawnInDM[ playerid ] = " ";
SetPlayerVirtualWorld( playerid, 0 );
}
if(GetPVarInt(playerid,"InParkour2"))
{
DestroyVehicle( bp2veh[ playerid ] );
DeletePVar(playerid,"InParkour2");
ResetPlayerWeapons( playerid );
LoadPlayerCoords(playerid);
PlayerInfo[ playerid ][ ActionID ] = 0;
SpawnInDM[ playerid ] = " ";
SetPlayerVirtualWorld( playerid, 0 );
}
if(GetPVarInt(playerid,"Dive1"))
{
DeletePVar(playerid,"Dive1");
PlayerInfo[ playerid ][ ActionID ] = 0;
}
if(GetPVarInt(playerid,"Dive2"))
{
DeletePVar(playerid,"Dive2");
PlayerInfo[ playerid ][ ActionID ] = 0;
}
if(GetPVarInt(playerid,"Dive3"))
{
DeletePVar(playerid,"Dive3");
PlayerInfo[ playerid ][ ActionID ] = 0;
}
if(GetPVarInt(playerid,"QuadParkour"))
{
DestroyVehicle( QuadVeh[ playerid ] );
DeletePVar(playerid,"QuadParkour");
ResetPlayerWeapons( playerid );
LoadPlayerCoords(playerid);
Iter_Remove( PlayerInQP, playerid );
PlayerInfo[ playerid ][ ActionID ] = 0;
SpawnInDM[ playerid ] = " ";
SetPlayerVirtualWorld( playerid, 0 );
}
if(GetPVarInt(playerid,"INHAY"))
{
DeletePVar(playerid,"INHAY");
ResetPlayerWeapons( playerid );
LoadPlayerCoords(playerid);
Iter_Remove( PlayerInHay, playerid );
PlayerInfo[ playerid ][ ActionID ] = 0;
SpawnInDM[ playerid ] = " ";
SetPlayerVirtualWorld( playerid, 0 );
}
if(GetPVarInt(playerid,"Signed4Lms") && (LMS > 1))
{
Remove_From_Lms(playerid,1);
}
if(GetPVarInt(playerid,"inFallout") && FallOut > 1)
{
RemoveFromFallout(playerid,0);
}
new Float: X, Float:Y, Float:Z;
GetPlayerPos( playerid, X, Y, Z );
SetPlayerPos( playerid, X, Y, Z + 0.1 );
gsString[ 0 ] = EOS;
if ( PlayerInfo[ playerid ][ ActionID ] == 4 )
{
PlayerInfo[ playerid ][ DERBY_Event ] = 0;
PlayerInfo[ playerid ][ ActionID ] = 0;
Iter_Remove(PlayerInDerby, playerid);
PlayerInfo[ playerid ][ ActionID ] = 0;
BloodringFull[ PlayerInfo[ playerid ][ PlayerInBloodring ] ] = 0;
PlayerInfo[ playerid ][ PlayerInBloodring ] = -1;
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
if(Iter_Count(PlayerInDerby) == 0 )
{
Iter_Clear(PlayerInDerby);
DerbyPlaying = 0;
DerbyOn = 0;
RespawnBloodrings( );
}
}
if ( PlayerInfo[ playerid ][ DM_Event ] == 0 && PlayerInfo[ playerid ][ ActionID ] == 0 )
{
if ( IsPlayerConnected( killerid ) )
{
gsString[ 0 ] = EOS;
format( gsString, sizeof( gsString ), "~g~~h~Wonderful~w~~h~, you killed ~r~~h~%s ~w~~h~!~n~~w~~h~+~g~~h~$~w~~h~5000 and +2 score", PlayerName( playerid ) );
InfoTD_MSG( killerid, 5000, gsString );
GivePlayerMoney( killerid, 5000 );
GivePlayerHeal( killerid, 25 );
gsString[ 0 ] = EOS;
format( gsString, sizeof( gsString ), "~r~~h~%s~w~ killed you!", PlayerName( killerid ) );
InfoTD_MSG( playerid, 5000, gsString );
}
}
if ( PlayerInfo[ playerid ][ DM_Event ] == 1 || PlayerInfo[ playerid ][ ActionID ] == 6 )
{
if ( IsPlayerConnected( killerid ) )
{
gsString[ 0 ] = EOS;
PlayerInfo[ killerid ][ eKills ]++;
PlayerInfo[ playerid ][ eDeaths ]++;
format( gsString, sizeof( gsString ), "~g~~h~Wonderful~w~~h~, you killed ~r~~h~%s ~w~~h~!~n~~w~~h~+~g~~h~$~w~~h~5000 and +2 score", PlayerName( playerid ) );
InfoTD_MSG( killerid, 5000, gsString );
GivePlayerMoney( killerid, 5000 );
GivePlayerHeal( killerid, 25 );
gsString[ 0 ] = EOS;
format( gsString, sizeof( gsString ), "~r~~h~%s~w~ killed you! :(", PlayerName( killerid ) );
InfoTD_MSG( playerid, 5000, gsString );
foreach( Player, i )
FormatMSG( i, ~1, ""R"[DM-Event] "GRI"%s killed %s ("O"%s"GRI") "YE"[%s]", PlayerName( killerid ), PlayerName( playerid ), GetWeapon( reason ), SpawnInDM[ killerid ] );
}
}
if ( PlayerInfo[ playerid ][ ActionID ] == 7 && PlayerInfo[ playerid ][ DM_Event ] == 0 )
{
if ( IsPlayerConnected( killerid ) )
{
gsString[ 0 ] = EOS;
PlayerInfo[ killerid ][ eKills ]++;
PlayerInfo[ playerid ][ eDeaths ]++;
format( gsString, sizeof( gsString ), "~g~~h~Wonderful~w~~h~, you killed ~r~~h~%s ~w~~h~!~n~~w~~h~+~g~~h~$~w~~h~6000 and +2 score", PlayerName( playerid ) );
InfoTD_MSG( killerid, 5000, gsString );
GivePlayerMoney( killerid, 6000 );
GivePlayerHeal( killerid, 25 );
gsString[ 0 ] = EOS;
format( gsString, sizeof( gsString ), "~r~~h~%s~w~ killed you!", PlayerName( killerid ) );
InfoTD_MSG( playerid, 5000, gsString );
foreach( Player, i )
FormatMSG( i, ~1, ""G"[DM-Info] "GRI"%s killed %s ("O"%s"GRI") "YE"[%s]", PlayerName( killerid ), PlayerName( playerid ), GetWeapon( reason ), SpawnInDM[ killerid ] );
}
}
if( PlayerInfo[ playerid ][ ActionID ] == 8 )
{
JoinCount--;
PlayerInfo[ playerid ][ ActionID ] = ( 0 );
DestroyVehicle(CreatedRaceVeh[playerid]);
DisablePlayerRaceCheckpoint(playerid);
for ( new i = 0; i < 11; i++ )
PlayerTextDrawHide( playerid, Race_InfoTD[ i ] );
CPProgess[playerid] = 0;
KillTimer( InfoTimer[ playerid ] );
Iter_Remove(GodCar, playerid);
#if defined RACE_IN_OTHER_WORLD
SetPlayerVirtualWorld(playerid, RaceWorld);
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), RaceWorld);
#endif
}
if ( IsPlayerConnected( killerid ) )
{
if ( PlayerInfo[ killerid ][ PGoted ] == playerid )
{
Announce( killerid, "~r~~h~You have been jailed (3 Mins)!~n~~w~Next time don't make /go + ~r~~h~kill!", 3000, 4 );
gTime[ killerid ][ 0 ] = 2;
gTime[ killerid ][ 1 ] = 60;
TextDrawSetString( Jailed_TD, "Jailed for:" );
TextDrawShowForPlayer( killerid, Jailed_TD );
TextDrawShowForPlayer( killerid, Jailed_Backround );
PlayerTextDrawShow( killerid, Jail_Time );
SetTimerEx( "JailPlayer", 5000, 0, "i", killerid );
SetTimerEx( "Jail1", 1000, 0, "i", killerid );
SetTimerEx( "ShowJailLeftTime", 1000, 0, "i", killerid );
PlayerInfo[ killerid ][ Jailed ] = 1;
PlayerInfo[ killerid ][ PGoted ] = -1;
KillTimer( GotoTimer[ killerid ] );
return ( 1 );
}
}
if ( IsPlayerConnected( killerid ) )
{
if ( PlayerInfo[ killerid ][ KillingSpree ] != PlayerInfo[ killerid ][ bKillingSpree ] )
PlayerInfo[ killerid ][ KillingSpree ]++;
else
{
PlayerInfo[ killerid ][ bKillingSpree ]++;
PlayerInfo[ killerid ][ KillingSpree ]++;
}
format( gsString, sizeof( gsString ), "~g~~h~Killing Spree: ~r~~h~%d", PlayerInfo[ killerid ][ KillingSpree ] );
Announce( killerid, gsString, 2000, 1 );
CheckPlayerQuake( playerid, killerid );
if ( PlayerInfo[ killerid ][ KillingSpree ] >= 2 )
{
foreach( Player, i )
FormatMSG( i, ~1, "{DBED15}** {%06x}%s(%d) {BABABA}is on a kill streak with %d kills!", GetPlayerColor( killerid ) >>> 8, PlayerName( killerid ), killerid, PlayerInfo[ killerid ][ KillingSpree ] );
}
}
if ( IsPlayerConnected( killerid ) )
{
if ( PlayerInfo[ killerid ][ ActionID ] == 6 )
{
if ( IsPlayerInRangeOfPoint( killerid, 80.0, 2748.7576,-1752.1027,49.8003 ) )
{
PlayerInfo[ killerid ][ Cookies ] += 2;
format( gsString, sizeof( gsString ), "~g~~h~Won: ~y~+~r~2~y~ Cookies" );
InfoTD_MSG( killerid, 4000, gsString );
PlayerInfo[ playerid ][ ActionID ] = 0;
}
}
}
if ( IsPlayerConnected( killerid ) )
{
if ( PlayerInfo[ killerid ][ GID ] != 0 )
{
if ( PlayerInfo[ killerid ][ GID ] != PlayerInfo[ playerid ][ GID ] )
{
format( gsQuery, 128, "UPDATE `groups` SET `groupPoints` = `groupPoints`+1 WHERE `id` = '%d'", PlayerInfo[ killerid ][ GID ] );
mysql_query( gsQuery, THREAD_NONE, killerid );
}
}
}
if ( PlayerInfo[ playerid ][ HaveGPS ] )
{
KillTimer( GPSTimer[ playerid ] );
PlayerInfo[ playerid ][ HaveGPS ] = false;
GPSTimer[ playerid ] = 0;
}
if ( IsPlayerConnected( killerid ) )
{
if ( reason <= 46 && hit[ playerid ] != 0 )
{
format( gsString, sizeof( gsString ), "{FF0000}%s (%i) {33CCFF}killed {FF0000}%s (%i) {33CCFF}and recieved {FF0000}$%i {33CCFF}for a completed hit", PlayerName( killerid ), killerid, PlayerName( playerid ), playerid, hit[ playerid ] );
SendClientMessageToAll( COLOR_LIGHTBLUE, gsString );
GivePlayerMoney( killerid, hit[ playerid ] );
GivePlayerMoney( hiter[ playerid ], - hit[ playerid ] );
hit[ playerid ] = 0;
if(AInfo[playerid][Ach16] != 1)
{
if(PlayerInfo[ playerid ][ KillingSpree ] >= 20)
{
new str[ 250 ];
PlayerTextDrawSetPreviewModel(playerid, PropTD[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]);
PlayerInfo[ playerid ][ 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(playerid, 200000), GivePlayerScore(playerid, 2);
if(AInfo[playerid][AchsCompleted] >= 16)
{
GivePlayerMoney(playerid, 10000000), GivePlayerScore(playerid, 2);
SendFormattedMessageToAll(0xFF0000FF, "ACHS: {8CAB62}%s(%i) has unlocked all of the achievements!", GetPName(playerid), playerid);
return 1;
}
}
}
}
else if ( hit[ playerid ] != 0 )
{
format( gsString, sizeof( gsString ), "The hit on {FF0000}%s (%i) {33CCFF}has been cancelled {FF0000}(died)", PlayerName( playerid ), playerid );
SendClientMessageToAll( COLOR_LIGHTBLUE, gsString );
hit[ playerid ] = 0;
}
}
foreach(new x: Player)
if ( GetPlayerState( x ) == PLAYER_STATE_SPECTATING && PlayerInfo[ x ][ SpecID ] == playerid )
AdvanceSpectate( x );
return ( 1 );
}