SA-MP Forums Archive
OnPlayerDeath bug - 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: OnPlayerDeath bug (/showthread.php?tid=529751)



OnPlayerDeath bug - UserName31 - 03.08.2014

hey me and my brother was Dming in my server but seems after he die a couple of time the server wont respond to him like server will not give him server weapon will he cant use admin command but yes i can kill him and i can see all his movements i dont know if something is wrong with my OnPlayerDeath callback ?

the latest work before this happend
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
     new 
pname[24];
    new 
string[120];
    new 
killername[24];
    
Killz[killerid] ++; // The killer value will be increased
    
Deathz[playerid] ++; // The death value will be increased
    //  Killing Timer  
    //
    //
    
new rand4random(10000);
    
GivePlayerMoney(playerid, -rand4);
    
//SendClientMessage(playerid, COLOR_LIGHTBLUE, "[INFO]: "COL_LRED2"You have been charged $2,000 for medical services.");
    
SetPlayerWantedLevel(playerid0);
    if(!
IsPlayerConnected(killerid))
    {
        
format(stringsizeof(string), "[DEATH] %s killed himself."PlayerInfo(playerid));
        print(string);
        return 
1;
    }
    
    
TextDrawHideForPlayer(playeridLogin[playerid]);
    
TextDrawHideForPlayer(playerid, Continue[playerid]);
    
PlayerTextDrawHide(playeridHasAccount[playerid]);
    
PlayerTextDrawHide(playeridNewMem[playerid]);
    
//PlayerTextDrawHide(playerid, BOX1[playerid]);
    
PlayerTextDrawHide(playeridBOX2[playerid]);
    
PlayerTextDrawHide(playeridBOX3[playerid]);
    
PlayerTextDrawHide(playeridWelcomeiTD[playerid]);
    
PlayerTextDrawHide(playeridWelcomeiTD2[playerid]);
    
PlayerTextDrawHide(playeridstar1[playerid]);
    
PlayerTextDrawHide(playeridstar2[playerid]);
    
PlayerTextDrawHide(playeridPromtw[playerid]);
    
PlayerTextDrawHide(playeridPromtw2[playerid]);
    
PlayerTextDrawHide(playeridTIP[playerid]);
    
PlayerTextDrawHide(playeridCF[playerid]);
    
PlayerTextDrawHide(playeridJailS[playerid]);
    
TextDrawHideForPlayer(playeridRBINP);
    
TextDrawHideForPlayer(playeridRBMAINBOX);
    
TextDrawHideForPlayer(playeridRBNAME[playerid]);
    
TextDrawHideForPlayer(playeridRBCL);
    
TextDrawHideForPlayer(playeridRBCLR);
    
TextDrawHideForPlayer(playeridPBar[playerid]);
    
TextDrawHideForPlayer(playeridPBarBack);
    
TextDrawHideForPlayer(playeridSTCHECKPOINT);
    
    
//Death Info
    
TextDrawShowForPlayer(playeridDeathMainBox);
    
TextDrawShowForPlayer(playeridDeathMainBox2);
    
TextDrawShowForPlayer(playeridDeathInfo);
    
TextDrawShowForPlayer(playeridIfDM);
    new 
stringD[160];
    
format(stringD160"~y~~h~Death~r~:~w~%d",Deathz[playerid]);
    
TextDrawSetString(DeathA[playerid],stringD);
    
TextDrawShowForPlayer(playeridDeathA[playerid]);
    
//kills
    
format(stringD160"~y~~h~Kills~r~:~w~%d",Killz[playerid]);
    
TextDrawSetString(KillsA[playerid],stringD);
    
TextDrawShowForPlayer(playeridKillsA[playerid]);
    
//Killername
    
format(stringD160"~y~~h~Killed by~r~:~w~%s",PlayerName(killerid));
    
TextDrawSetString(Killedby[playerid],stringD);
    
TextDrawShowForPlayer(playeridKilledby[playerid]);
    
//
    
format(stringD160"~y~~h~Medical Fees~r~: ~g~$~w~~h~%d",rand4);
    
TextDrawSetString(MedsA[playerid],stringD);
    
TextDrawShowForPlayer(playeridMedsA[playerid]); 
all of it
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
     new 
pname[24];
    new 
string[120];
    new 
killername[24];
    
Killz[killerid] ++; // The killer value will be increased
    
Deathz[playerid] ++; // The death value will be increased
    //  Killing Timer  
    //
    //
    
new rand4random(10000);
    
GivePlayerMoney(playerid, -rand4);
    
//SendClientMessage(playerid, COLOR_LIGHTBLUE, "[INFO]: "COL_LRED2"You have been charged $2,000 for medical services.");
    
SetPlayerWantedLevel(playerid0);
    if(!
IsPlayerConnected(killerid))
    {
        
format(stringsizeof(string), "[DEATH] %s killed himself."PlayerInfo(playerid));
        print(string);
        return 
1;
    }
    
    
TextDrawHideForPlayer(playeridLogin[playerid]);
    
TextDrawHideForPlayer(playerid, Continue[playerid]);
    
PlayerTextDrawHide(playeridHasAccount[playerid]);
    
PlayerTextDrawHide(playeridNewMem[playerid]);
    
//PlayerTextDrawHide(playerid, BOX1[playerid]);
    
PlayerTextDrawHide(playeridBOX2[playerid]);
    
PlayerTextDrawHide(playeridBOX3[playerid]);
    
PlayerTextDrawHide(playeridWelcomeiTD[playerid]);
    
PlayerTextDrawHide(playeridWelcomeiTD2[playerid]);
    
PlayerTextDrawHide(playeridstar1[playerid]);
    
PlayerTextDrawHide(playeridstar2[playerid]);
    
PlayerTextDrawHide(playeridPromtw[playerid]);
    
PlayerTextDrawHide(playeridPromtw2[playerid]);
    
PlayerTextDrawHide(playeridTIP[playerid]);
    
PlayerTextDrawHide(playeridCF[playerid]);
    
PlayerTextDrawHide(playeridJailS[playerid]);
    
TextDrawHideForPlayer(playeridRBINP);
    
TextDrawHideForPlayer(playeridRBMAINBOX);
    
TextDrawHideForPlayer(playeridRBNAME[playerid]);
    
TextDrawHideForPlayer(playeridRBCL);
    
TextDrawHideForPlayer(playeridRBCLR);
    
TextDrawHideForPlayer(playeridPBar[playerid]);
    
TextDrawHideForPlayer(playeridPBarBack);
    
TextDrawHideForPlayer(playeridSTCHECKPOINT);
    
    
//Death Info
    
TextDrawShowForPlayer(playeridDeathMainBox);
    
TextDrawShowForPlayer(playeridDeathMainBox2);
    
TextDrawShowForPlayer(playeridDeathInfo);
    
TextDrawShowForPlayer(playeridIfDM);
    new 
stringD[160];
    
format(stringD160"~y~~h~Death~r~:~w~%d",Deathz[playerid]);
    
TextDrawSetString(DeathA[playerid],stringD);
    
TextDrawShowForPlayer(playeridDeathA[playerid]);
    
//kills
    
format(stringD160"~y~~h~Kills~r~:~w~%d",Killz[playerid]);
    
TextDrawSetString(KillsA[playerid],stringD);
    
TextDrawShowForPlayer(playeridKillsA[playerid]);
    
//Killername
    
format(stringD160"~y~~h~Killed by~r~:~w~%s",PlayerName(killerid));
    
TextDrawSetString(Killedby[playerid],stringD);
    
TextDrawShowForPlayer(playeridKilledby[playerid]);
    
//
    
format(stringD160"~y~~h~Medical Fees~r~: ~g~$~w~~h~%d",rand4);
    
TextDrawSetString(MedsA[playerid],stringD);
    
TextDrawShowForPlayer(playeridMedsA[playerid]);
    
    
///////////////////////
    
format(stringsizeof(string), "%s has killed %s (%s)"PlayerInfo(killerid),PlayerInfo(playerid), aWeaponNames[reason]);
    print(string);
    if(
gTeam[killerid] == Team_Cop || gTeam[killerid] == Team_Army || gTeam[killerid] == Team_FBI)
    {
        if(
gTeam[playerid] == Team_Cop || gTeam[playerid] == Team_Army || gTeam[playerid] == Team_FBI)
        {
            
format(string120"[TEAM KILL] %s was killed by %s (%s)"PlayerInfo(playerid), PlayerInfo(killerid), aWeaponNames[reason]);
            print(string);
            
DecreaseScore(killerid1);
            return 
1;
        }
        if(
gTeam[playerid] == Team_Civi)
        {
            new 
pwl GetPlayerWantedLevel(playerid);
            if(
pwl == 0)
            {
                
format(stringsizeof(string), "Police Officer %s has taken down innocent civillian %s with deadly force."PlayerInfo(killerid), PlayerInfo(playerid));
                
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
                print(string);
                
DecreaseScore(killerid1);
                return 
1;
            }
            if(
pwl == || pwl == 2)
            {
                
format(stringsizeof(string), "Police Officer %s has taken down least wanted player %s with deadly force"PlayerInfo(killerid), PlayerInfo(playerid));
                
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
                print(string);
                
DecreaseScore(killerid1);
                return 
1;
            }
            if(
pwl == || pwl == || pwl == 5)
            {
                
format(stringsizeof(string), "Police officer %s has taken down wanted suspect %s with deadly force"PlayerInfo(killerid), PlayerInfo(playerid));
                
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
                print(string);
                
IncreaseScore(killerid1);
                
GivePlayerMoney(killerid5000);
                return 
1;
            }
            if(
pwl == 6)
            {
                
format(stringsizeof(string), "Police Officer %s has taken down most wanted suspect %s with deadly force"PlayerInfo(killerid), PlayerInfo(playerid));
                
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
                print(string);
                
IncreaseScore(killerid2);
                
GivePlayerMoney(killerid10000);
                return 
1;
            }
            if(
InAdminMode[killerid] == 1)
    {
        
format(string,sizeof(string),"[ADMIN KILL] Administrator %s(%d) has killed %s(%d) while in admin mode.",killername,killerid,pname,playerid);
        
SendClientMessageToAll(COLOR_ADMIN,string);
        
SetPlayerColor(playerid,COLOR_DEADCONNECT);
        
SetPlayerWantedLevel(playerid,0);
        
SendDeathMessage(killerid,playerid,reason);
        return 
1;
    }
            if(
HasHit[playerid] >= 1)
    {
        
GivePlayerMoney(killerid,HitMoney[playerid]);
        
IncreaseWantedLevel(killerid,6);
        
format(string128"[[_Contract Kill_]] \nYou have killed %s(%d) for a hit contract and recieved $%d for the kill.",PlayerName(playerid),playerid,HitMoney[playerid]);
        
SendClientMessageToAll(COLOR_GREENstring);
        
/*format(string,sizeof(string),"[POLICE RADIO] Suspect %s(%d) has murdered %s(%d) and has been caught on CCTV. Arrest the suspect ASAP.",killername,killerid,pname,playerid);
          SendClientMessageToAllCops(string);*/
          
HasHit[playerid] =0;
          
HitMoney[playerid] =0;
        
SetPlayerWantedLevel(playerid,0);
        
SendDeathMessage(killerid,playerid,reason);
          return 
1;
    }
  }
}
     
AccountInfo[playerid][pHasSTDs] = 0;
     
AccountInfo[playerid][pCuffTimer] = 0;
    
AccountInfo[playerid][pLastVehicle] = 0;
    
SetPVarInt(playerid"InEvent"0);
    
AccountInfo[playerid][pCalledForMedic] = 0;
    
AccountInfo[playerid][pIsSick] = 0;
    
AccountInfo[playerid][pHasSecureWallet] =0;
    
playerCheckpoint[playerid] =0;
    
HasSecureWallet[playerid] =0;
    
IsSpawned[playerid] =0;
    
AttemptedToRobRecently[playerid] =0;
    
HasRobbedRecently[playerid] =0;
    
IsFrozen[playerid] =0;
    
IsKidnapped[playerid] =0;
    
InAdminMode[playerid] =0;
    
AccountInfo[playerid][pUsedHealme] = 0;
    return 
1;




Re: OnPlayerDeath bug - iOxide - 03.08.2014

I guess he got desynced? I'd recommend you to read this thread https://sampforum.blast.hk/showthread.php?pid=876854#pid876854


Re: OnPlayerDeath bug - UserName31 - 03.08.2014

Quote:
Originally Posted by iOxide
Посмотреть сообщение
I guess he got desynced? I'd recommend you to read this thread https://sampforum.blast.hk/showthread.php?pid=876854#pid876854
i just realize someything it only happens to id 3