OnPlayerDeath [DEBUG ERRORS]
#1

Hello!
please help me
How do i fix this?
pawn Код:
[20:12:33] [debug] Run time error 4: "Array index out of bounds"
[20:12:33] [debug]  Accessing element at index 65535 past array upper bound 500
[20:12:33] [debug] AMX backtrace:
[20:12:33] [debug] #0 0025d520 in public OnPlayerDeath (0x00000000, 0x0000ffff, 0x000000ff) from PHRP_1.7.amx

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    new
        string[128];

    if(IsPlayerConnected(killerid)) {
        new
            hour,
            minute,
            second,
            weaponname[32];

        gettime(hour,minute,second);
        FixHour(hour);
        hour = shifthour;
        GetWeaponName(reason, weaponname, sizeof(weaponname));
       


        if(GetPVarInt(playerid, "PBM") > 0 && GetPVarInt(killerid, "PBM") > 0) {
            SetPVarInt(killerid, "PBMK", GetPVarInt(playerid, "PBMK")+1);
            SetPVarInt(playerid, "PBMD", GetPVarInt(playerid, "PBMD")+1);

            format(string, sizeof(string), "%s has killed %s, with a %s in the paintball game.", GetPlayerNameEx(killerid), GetPlayerNameEx(playerid), weaponname);
            foreach(Player, i) {
                if(GetPVarInt(playerid, "PBM") == GetPVarInt(i, "PBM"))
                    SendClientMessage(i, COLOR_RED, string);
            }

            format(PlayerInfo[playerid][pKillLog9], 128, "%s", PlayerInfo[playerid][pKillLog8]);
            format(PlayerInfo[playerid][pKillLog8], 128, "%s", PlayerInfo[playerid][pKillLog7]);
            format(PlayerInfo[playerid][pKillLog7], 128, "%s", PlayerInfo[playerid][pKillLog6]);
            format(PlayerInfo[playerid][pKillLog6], 128, "%s", PlayerInfo[playerid][pKillLog5]);
            format(PlayerInfo[playerid][pKillLog5], 128, "%s", PlayerInfo[playerid][pKillLog4]);
            format(PlayerInfo[playerid][pKillLog4], 128, "%s", PlayerInfo[playerid][pKillLog3]);
            format(PlayerInfo[playerid][pKillLog3], 128, "%s", PlayerInfo[playerid][pKillLog2]);
            format(PlayerInfo[playerid][pKillLog2], 128, "%s", PlayerInfo[playerid][pKillLog1]);
            format(PlayerInfo[playerid][pKillLog1], 128, "%s", PlayerInfo[playerid][pKillLog0]);
            format(PlayerInfo[playerid][pKillLog0], 128, "(%d:%d:%d) %s killed me with %s (in paintball)", hour,minute,second,GetPlayerNameEx(killerid), weaponname);

            format(PlayerInfo[killerid][pKillLog9], 128, "%s", PlayerInfo[killerid][pKillLog8]);
            format(PlayerInfo[killerid][pKillLog8], 128, "%s", PlayerInfo[killerid][pKillLog7]);
            format(PlayerInfo[killerid][pKillLog7], 128, "%s", PlayerInfo[killerid][pKillLog6]);
            format(PlayerInfo[killerid][pKillLog6], 128, "%s", PlayerInfo[killerid][pKillLog5]);
            format(PlayerInfo[killerid][pKillLog5], 128, "%s", PlayerInfo[killerid][pKillLog4]);
            format(PlayerInfo[killerid][pKillLog4], 128, "%s", PlayerInfo[killerid][pKillLog3]);
            format(PlayerInfo[killerid][pKillLog3], 128, "%s", PlayerInfo[killerid][pKillLog2]);
            format(PlayerInfo[killerid][pKillLog2], 128, "%s", PlayerInfo[killerid][pKillLog1]);
            format(PlayerInfo[killerid][pKillLog1], 128, "%s", PlayerInfo[killerid][pKillLog0]);
            format(PlayerInfo[killerid][pKillLog0], 128, "(%d:%d:%d) killed %s with %s (in paintball)", hour,minute,second,GetPlayerNameEx(playerid), weaponname);
        } else {
            format(PlayerInfo[playerid][pKillLog9], 128, "%s", PlayerInfo[playerid][pKillLog8]);
            format(PlayerInfo[playerid][pKillLog8], 128, "%s", PlayerInfo[playerid][pKillLog7]);
            format(PlayerInfo[playerid][pKillLog7], 128, "%s", PlayerInfo[playerid][pKillLog6]);
            format(PlayerInfo[playerid][pKillLog6], 128, "%s", PlayerInfo[playerid][pKillLog5]);
            format(PlayerInfo[playerid][pKillLog5], 128, "%s", PlayerInfo[playerid][pKillLog4]);
            format(PlayerInfo[playerid][pKillLog4], 128, "%s", PlayerInfo[playerid][pKillLog3]);
            format(PlayerInfo[playerid][pKillLog3], 128, "%s", PlayerInfo[playerid][pKillLog2]);
            format(PlayerInfo[playerid][pKillLog2], 128, "%s", PlayerInfo[playerid][pKillLog1]);
            format(PlayerInfo[playerid][pKillLog1], 128, "%s", PlayerInfo[playerid][pKillLog0]);
            format(PlayerInfo[playerid][pKillLog0], 128, "(%d:%d:%d) %s killed me with %s", hour,minute,second,GetPlayerNameEx(killerid), weaponname);

            format(PlayerInfo[killerid][pKillLog9], 128, "%s", PlayerInfo[killerid][pKillLog8]);
            format(PlayerInfo[killerid][pKillLog8], 128, "%s", PlayerInfo[killerid][pKillLog7]);
            format(PlayerInfo[killerid][pKillLog7], 128, "%s", PlayerInfo[killerid][pKillLog6]);
            format(PlayerInfo[killerid][pKillLog6], 128, "%s", PlayerInfo[killerid][pKillLog5]);
            format(PlayerInfo[killerid][pKillLog5], 128, "%s", PlayerInfo[killerid][pKillLog4]);
            format(PlayerInfo[killerid][pKillLog4], 128, "%s", PlayerInfo[killerid][pKillLog3]);
            format(PlayerInfo[killerid][pKillLog3], 128, "%s", PlayerInfo[killerid][pKillLog2]);
            format(PlayerInfo[killerid][pKillLog2], 128, "%s", PlayerInfo[killerid][pKillLog1]);
            format(PlayerInfo[killerid][pKillLog1], 128, "%s", PlayerInfo[killerid][pKillLog0]);
            format(PlayerInfo[killerid][pKillLog0], 128, "(%d:%d:%d) killed %s with %s", hour,minute,second,GetPlayerNameEx(playerid), weaponname);
        }
    } else {
        if(GetPVarInt(playerid, "PBM") > 0) {
            format(string, sizeof(string), "%s has died.", GetPlayerNameEx(playerid));
            foreach(Player, i) {
                if(GetPVarInt(playerid, "PBM") == GetPVarInt(i, "PBM"))
                    SendClientMessage(i, COLOR_RED, string);
            }
        }
    }

    if(pBankRobbing[playerid] == 1)
    {
        RobberBusted[playerid] = 2;
        pBankRobbing[playerid] = 0;

        SendClientMessageToAll(COLOR_GREEN, "[BREAKING NEWS]: Bank Robberry News: The Suspect has been dead! Bank robberry failed");
        RobberBusted[playerid] = 0;
        pBankRobbing[playerid] = 0;
        KillTimer(RobbingTimer[playerid]);
    }

    IsCopDragging[playerid] = INVALID_PLAYER_ID;
    PlayerDraggedBy[playerid] = INVALID_PLAYER_ID;
    PlayerDragged[playerid] = 0;
    KillTimer(draggedtimer[playerid]);


    if(IsHunted[playerid] == 1)
    {
        if(killerid == INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "Father, Please forgive the hunted %s as he killed himself! What a dumb?", GetPlayerNameEx(playerid));
            SendClientMessageToAll(COLOR_YELLOW, string);
            IsHunted[playerid] = 0;
            HuntedExist = 0;
        }
        else
        {
            format(string, sizeof(string), "Father, Please forgive %s sins as he killed the hunted %s", GetPlayerNameEx(killerid), GetPlayerNameEx(playerid));
            SendClientMessageToAll(COLOR_YELLOW, string);

            IsHunted[playerid] = 0;
            HuntedExist = 0;
        }
    }

    if(GetPVarType(playerid, "SpecOff"))
    {
        SpawnPlayer(playerid);
        return 1;
    }


    pTazer[playerid] = 0;
    InsideShamal[playerid] = INVALID_VEHICLE_ID;
    DeletePVar(playerid, "SpeedRadar");
    DeletePVar(playerid, "UsingSprunk");
    DeletePVar(playerid, "usingfirstaid");
    KillTimer(GetPVarInt(playerid, "firstaid5"));

    if(GetPVarInt(playerid, "Injured") == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You appear to be stuck in limbo, medics have failed to revive you.");
        KillEMSQueue(playerid);
        ResetPlayerWeaponsEx(playerid);

        new Float:X, Float:Y, Float:Z;
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health-5);
        GetPlayerPos(playerid, X, Y, Z);
        SetPlayerPos(playerid, X, Y, Z+5);
        return 1;
    }

    // Determine if the player is in onplayerdeath
    SetPVarInt(playerid, "OPD", 1);

    if(GetPVarInt(playerid, "MovingStretcher") != -1)
    {
        KillTimer(GetPVarInt(playerid, "TickEMSMove"));
        DeletePVar(GetPVarInt(playerid, "MovingStretcher"), "OnStretcher");
        SetPVarInt(playerid, "MovingStretcher", -1);
    }

    new caller = Mobile[playerid];
    if(IsPlayerConnected(Mobile[playerid]))
    {
        SendClientMessage(caller,  COLOR_GRAD2, "The line went dead.");
        format(string, sizeof(string), "* %s puts away their cellphone.", GetPlayerNameEx(caller));
        ProxDetector(30.0, caller, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        CellTime[caller] = 0;
        Mobile[caller] = INVALID_PLAYER_ID;
    }
    Mobile[playerid] = INVALID_PLAYER_ID;
    CellTime[playerid] = 0;

    foreach(Player, i)
    {
        if(EMSAccepted[i] == playerid)
        {
            EMSAccepted[i] = 999;
            GameTextForPlayer(i, "~w~EMS Caller~n~~r~Has Died", 5000, 1);
            EMSCallTime[i] = 0;
            DisablePlayerCheckpoint(i);
        }
    }


    if(GetPVarInt(playerid, "EventToken") == 0)
    {
        if(GetPVarInt(playerid, "PBM") < 1)
        {
            if(PlayerInfo[playerid][pJailTime] == 0)
            {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], X, Y, Z, 1.0, -1, -1, -1, -1, -1, -1);

                if(AdminDuty[playerid] != 1)
                {
                    SetPVarInt(playerid, "Injured", 1);

                    new Float:mX, Float:mY, Float:mZ;
                    GetPlayerPos(playerid, mX, mY, mZ);

                    SetPVarFloat(playerid, "MedicX", mX);
                    SetPVarFloat(playerid, "MedicY", mY);
                    SetPVarFloat(playerid, "MedicZ", mZ);
                    SetPVarInt(playerid, "MedicVW", GetPlayerVirtualWorld(playerid));
                    SetPVarInt(playerid, "MedicInt", GetPlayerInterior(playerid));
                }
                else
                {
                    SetPVarInt(playerid, "AdminDeathVW", GetPlayerVirtualWorld(playerid));
                    SetPVarInt(playerid, "AdminDeathInt", GetPlayerInterior(playerid));

                    SpawnPlayer(playerid);
                }
            }
        }
    }

    if(GetPVarInt(playerid, "Injured") == 0)
    {
        if(GetPVarInt(playerid, "EventToken") >= 1 || GetPVarInt(playerid, "PBM") > 0)
        {
            ResetPlayerWeapons(playerid);
        }
        else
        {
            ResetPlayerWeaponsEx(playerid);
        }
    }
    if(PlayerInfo[killerid][pAdmin] < 6)
    {
        if(reason == 49)
        {
            format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just car rammed %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
            ABroadCast(COLOR_YELLOW, string, 1);
            //print(string);
        }
        if(reason == 50)
        {
            if(IsAHelicopter(GetPlayerVehicleID(killerid)))
            {
                format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just helibladed %s (ID %d).", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
                ABroadCast(COLOR_YELLOW, string, 1);
                //print(string);
            }
            else
            {
                if(GetPlayerWeapon(killerid) != 32 || GetPlayerWeapon(killerid) != 28 || GetPlayerWeapon(killerid) != 29)
                {
                    format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just carparked %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
                    ABroadCast(COLOR_YELLOW, string, 1);
                    //print(string);
                }
                else
                {
                    format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just drivershot %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
                    ABroadCast(COLOR_YELLOW, string, 1);
                    //print(string);
                }
            }
        }
    }
    if(gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
    {
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
    }

    ClearCrime(playerid);
    if(PlayerInfo[playerid][pHeadValue] >= 1) {
        if(IsPlayerConnected(killerid)) {
            if(GoChase[killerid] == playerid) {
                new
                    killer[MAX_PLAYER_NAME],
                    name2[MAX_PLAYER_NAME],
                    name[MAX_PLAYER_NAME];

                new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
                name = GetPlayerNameEx(playerid);
                killer = GetPlayerNameEx(killerid);
                GivePlayerCash(killerid, takemoney);
                GivePlayerCash(playerid, -takemoney);
                format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",killer,name,PlayerInfo[playerid][pHeadValue] / 4 * 2);
                SendFamilyMessage(4, COLOR_YELLOW, string);
                format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d.",takemoney);
                ResetPlayerWeaponsEx(playerid);
                SendClientMessage(playerid, COLOR_YELLOW, string);

                foreach(Player, i) {
                    name2 = GetPlayerNameEx(i);
                    if(!strcmp(PlayerInfo[playerid][pContractBy], name2, true)) {
                        if(!IsPlayerStreamedIn(i, playerid)) {
                            format(string, sizeof(string), "SMS: %s has been eliminated, Sender: MOLE (555)", name);
                            SendClientMessage(i, COLOR_YELLOW, string);
                        }
                    }
                }

                PlayerInfo[playerid][pHeadValue] = 0;
                strcpy(PlayerInfo[playerid][pContractBy], "Nobody", 64);
                strcpy(PlayerInfo[playerid][pContractDetail], "None", 64);
                PlayerInfo[killerid][pCHits] += 1;
                GotHit[playerid] = 0;
                GetChased[playerid] = 999;
                GoChase[killerid] = 999;
            }
        }
    }
    if(IsPlayerConnected(killerid)) {
        if(GoChase[playerid] == killerid) {
            new killer[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
            new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
            GivePlayerCash(killerid, takemoney);
            name = GetPlayerNameEx(playerid);
            killer = GetPlayerNameEx(killerid);
            format(string,128,"Hitman %s has failed the contract on %s and lost $%d.",name,killer,PlayerInfo[killerid][pHeadValue] / 4 * 2);
            SendFamilyMessage(4, COLOR_YELLOW, string);
            GivePlayerCash(playerid, -takemoney);
            format(string,128,"You have just killed a hitman and gained $%d, removing the contact on your head.",PlayerInfo[killerid][pHeadValue] / 4 * 2);
            SendClientMessage(killerid, COLOR_YELLOW, string);

            foreach(Player, i) {
                name2 = GetPlayerNameEx(i);
                if(!strcmp(PlayerInfo[killerid][pContractBy], name2, true)) {
                    if(!IsPlayerStreamedIn(i, killerid)) {
                        format(string, sizeof(string), "SMS: We failed with %s, you can try place another hit on the target, Sender: MOLE (555)", killer);
                        SendClientMessage(i, COLOR_YELLOW, string);
                    }
                }
            }

            PlayerInfo[killerid][pHeadValue] = 0;
            strcpy(PlayerInfo[killerid][pContractBy], "Nobody", 64);
            strcpy(PlayerInfo[killerid][pContractDetail], "None", 64);
            PlayerInfo[playerid][pFHits] += 1;
            GotHit[playerid] = 0;
            GetChased[killerid] = 999;
            GoChase[playerid] = 999;
        }
    }
    killerid = INVALID_PLAYER_ID;
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    return 1;
}
Reply
#2

You have to check if killerid is INVALID_PLAYER_ID before you use it on an array as an index.
Reply
#3

Quote:
Originally Posted by Chipardeur
Посмотреть сообщение
You have to check if killerid is INVALID_PLAYER_ID before you use it on an array as an index.
if killerid is not INVALID_PLAYER_ID*

In these:
pawn Код:
format(PlayerInfo[killerid][pKillLog9], 128, "%s", PlayerInfo[killerid][pKillLog8]);
format(PlayerInfo[killerid][pKillLog8], 128, "%s", PlayerInfo[killerid][pKillLog7]);
format(PlayerInfo[killerid][pKillLog7], 128, "%s", PlayerInfo[killerid][pKillLog6]);
format(PlayerInfo[killerid][pKillLog6], 128, "%s", PlayerInfo[killerid][pKillLog5]);
format(PlayerInfo[killerid][pKillLog5], 128, "%s", PlayerInfo[killerid][pKillLog4]);
format(PlayerInfo[killerid][pKillLog4], 128, "%s", PlayerInfo[killerid][pKillLog3]);
format(PlayerInfo[killerid][pKillLog3], 128, "%s", PlayerInfo[killerid][pKillLog2]);
format(PlayerInfo[killerid][pKillLog2], 128, "%s", PlayerInfo[killerid][pKillLog1]);
format(PlayerInfo[killerid][pKillLog1], 128, "%s", PlayerInfo[killerid][pKillLog0]);
both in if and else statement. And in this:
pawn Код:
if(PlayerInfo[killerid][pAdmin] < 6)
Reply
#4

Replace with:
Код:
public OnPlayerDeath(playerid, killerid, reason) {
    new
        string[128];

    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID) {
        new
            hour,
            minute,
            second,
            weaponname[32];

        gettime(hour,minute,second);
        FixHour(hour);
        hour = shifthour;
        GetWeaponName(reason, weaponname, sizeof(weaponname));
        


        if(GetPVarInt(playerid, "PBM") > 0 && GetPVarInt(killerid, "PBM") > 0) {
            SetPVarInt(killerid, "PBMK", GetPVarInt(playerid, "PBMK")+1);
            SetPVarInt(playerid, "PBMD", GetPVarInt(playerid, "PBMD")+1);

            format(string, sizeof(string), "%s has killed %s, with a %s in the paintball game.", GetPlayerNameEx(killerid), GetPlayerNameEx(playerid), weaponname);
            foreach(Player, i) {
                if(GetPVarInt(playerid, "PBM") == GetPVarInt(i, "PBM"))
                    SendClientMessage(i, COLOR_RED, string);
            }

            format(PlayerInfo[playerid][pKillLog9], 128, "%s", PlayerInfo[playerid][pKillLog8]);
            format(PlayerInfo[playerid][pKillLog8], 128, "%s", PlayerInfo[playerid][pKillLog7]);
            format(PlayerInfo[playerid][pKillLog7], 128, "%s", PlayerInfo[playerid][pKillLog6]);
            format(PlayerInfo[playerid][pKillLog6], 128, "%s", PlayerInfo[playerid][pKillLog5]);
            format(PlayerInfo[playerid][pKillLog5], 128, "%s", PlayerInfo[playerid][pKillLog4]);
            format(PlayerInfo[playerid][pKillLog4], 128, "%s", PlayerInfo[playerid][pKillLog3]);
            format(PlayerInfo[playerid][pKillLog3], 128, "%s", PlayerInfo[playerid][pKillLog2]);
            format(PlayerInfo[playerid][pKillLog2], 128, "%s", PlayerInfo[playerid][pKillLog1]);
            format(PlayerInfo[playerid][pKillLog1], 128, "%s", PlayerInfo[playerid][pKillLog0]);
            format(PlayerInfo[playerid][pKillLog0], 128, "(%d:%d:%d) %s killed me with %s (in paintball)", hour,minute,second,GetPlayerNameEx(killerid), weaponname);

            format(PlayerInfo[killerid][pKillLog9], 128, "%s", PlayerInfo[killerid][pKillLog8]);
            format(PlayerInfo[killerid][pKillLog8], 128, "%s", PlayerInfo[killerid][pKillLog7]);
            format(PlayerInfo[killerid][pKillLog7], 128, "%s", PlayerInfo[killerid][pKillLog6]);
            format(PlayerInfo[killerid][pKillLog6], 128, "%s", PlayerInfo[killerid][pKillLog5]);
            format(PlayerInfo[killerid][pKillLog5], 128, "%s", PlayerInfo[killerid][pKillLog4]);
            format(PlayerInfo[killerid][pKillLog4], 128, "%s", PlayerInfo[killerid][pKillLog3]);
            format(PlayerInfo[killerid][pKillLog3], 128, "%s", PlayerInfo[killerid][pKillLog2]);
            format(PlayerInfo[killerid][pKillLog2], 128, "%s", PlayerInfo[killerid][pKillLog1]);
            format(PlayerInfo[killerid][pKillLog1], 128, "%s", PlayerInfo[killerid][pKillLog0]);
            format(PlayerInfo[killerid][pKillLog0], 128, "(%d:%d:%d) killed %s with %s (in paintball)", hour,minute,second,GetPlayerNameEx(playerid), weaponname);
        } else {
            format(PlayerInfo[playerid][pKillLog9], 128, "%s", PlayerInfo[playerid][pKillLog8]);
            format(PlayerInfo[playerid][pKillLog8], 128, "%s", PlayerInfo[playerid][pKillLog7]);
            format(PlayerInfo[playerid][pKillLog7], 128, "%s", PlayerInfo[playerid][pKillLog6]);
            format(PlayerInfo[playerid][pKillLog6], 128, "%s", PlayerInfo[playerid][pKillLog5]);
            format(PlayerInfo[playerid][pKillLog5], 128, "%s", PlayerInfo[playerid][pKillLog4]);
            format(PlayerInfo[playerid][pKillLog4], 128, "%s", PlayerInfo[playerid][pKillLog3]);
            format(PlayerInfo[playerid][pKillLog3], 128, "%s", PlayerInfo[playerid][pKillLog2]);
            format(PlayerInfo[playerid][pKillLog2], 128, "%s", PlayerInfo[playerid][pKillLog1]);
            format(PlayerInfo[playerid][pKillLog1], 128, "%s", PlayerInfo[playerid][pKillLog0]);
            format(PlayerInfo[playerid][pKillLog0], 128, "(%d:%d:%d) %s killed me with %s", hour,minute,second,GetPlayerNameEx(killerid), weaponname);

            format(PlayerInfo[killerid][pKillLog9], 128, "%s", PlayerInfo[killerid][pKillLog8]);
            format(PlayerInfo[killerid][pKillLog8], 128, "%s", PlayerInfo[killerid][pKillLog7]);
            format(PlayerInfo[killerid][pKillLog7], 128, "%s", PlayerInfo[killerid][pKillLog6]);
            format(PlayerInfo[killerid][pKillLog6], 128, "%s", PlayerInfo[killerid][pKillLog5]);
            format(PlayerInfo[killerid][pKillLog5], 128, "%s", PlayerInfo[killerid][pKillLog4]);
            format(PlayerInfo[killerid][pKillLog4], 128, "%s", PlayerInfo[killerid][pKillLog3]);
            format(PlayerInfo[killerid][pKillLog3], 128, "%s", PlayerInfo[killerid][pKillLog2]);
            format(PlayerInfo[killerid][pKillLog2], 128, "%s", PlayerInfo[killerid][pKillLog1]);
            format(PlayerInfo[killerid][pKillLog1], 128, "%s", PlayerInfo[killerid][pKillLog0]);
            format(PlayerInfo[killerid][pKillLog0], 128, "(%d:%d:%d) killed %s with %s", hour,minute,second,GetPlayerNameEx(playerid), weaponname);
        }
    } else {
        if(GetPVarInt(playerid, "PBM") > 0) {
            format(string, sizeof(string), "%s has died.", GetPlayerNameEx(playerid));
            foreach(Player, i) {
                if(GetPVarInt(playerid, "PBM") == GetPVarInt(i, "PBM"))
                    SendClientMessage(i, COLOR_RED, string);
            }
        }
    }

    if(pBankRobbing[playerid] == 1)
    {
        RobberBusted[playerid] = 2;
        pBankRobbing[playerid] = 0;

        SendClientMessageToAll(COLOR_GREEN, "[BREAKING NEWS]: Bank Robberry News: The Suspect has been dead! Bank robberry failed");
        RobberBusted[playerid] = 0;
        pBankRobbing[playerid] = 0;
        KillTimer(RobbingTimer[playerid]);
    }

    IsCopDragging[playerid] = INVALID_PLAYER_ID;
    PlayerDraggedBy[playerid] = INVALID_PLAYER_ID;
    PlayerDragged[playerid] = 0;
    KillTimer(draggedtimer[playerid]);


    if(IsHunted[playerid] == 1)
    {
        if(killerid == INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "Father, Please forgive the hunted %s as he killed himself! What a dumb?", GetPlayerNameEx(playerid));
            SendClientMessageToAll(COLOR_YELLOW, string);
            IsHunted[playerid] = 0;
            HuntedExist = 0;
        }
        else
        {
            format(string, sizeof(string), "Father, Please forgive %s sins as he killed the hunted %s", GetPlayerNameEx(killerid), GetPlayerNameEx(playerid));
            SendClientMessageToAll(COLOR_YELLOW, string);

            IsHunted[playerid] = 0;
            HuntedExist = 0;
        }
    }

    if(GetPVarType(playerid, "SpecOff"))
    {
        SpawnPlayer(playerid);
        return 1;
    }


    pTazer[playerid] = 0;
    InsideShamal[playerid] = INVALID_VEHICLE_ID;
    DeletePVar(playerid, "SpeedRadar");
    DeletePVar(playerid, "UsingSprunk");
    DeletePVar(playerid, "usingfirstaid");
    KillTimer(GetPVarInt(playerid, "firstaid5"));

    if(GetPVarInt(playerid, "Injured") == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You appear to be stuck in limbo, medics have failed to revive you.");
        KillEMSQueue(playerid);
        ResetPlayerWeaponsEx(playerid);

        new Float:X, Float:Y, Float:Z;
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health-5);
        GetPlayerPos(playerid, X, Y, Z);
        SetPlayerPos(playerid, X, Y, Z+5);
        return 1;
    }

    // Determine if the player is in onplayerdeath
    SetPVarInt(playerid, "OPD", 1);

    if(GetPVarInt(playerid, "MovingStretcher") != -1)
    {
        KillTimer(GetPVarInt(playerid, "TickEMSMove"));
        DeletePVar(GetPVarInt(playerid, "MovingStretcher"), "OnStretcher");
        SetPVarInt(playerid, "MovingStretcher", -1);
    }

    new caller = Mobile[playerid];
    if(IsPlayerConnected(Mobile[playerid]))
    {
        SendClientMessage(caller,  COLOR_GRAD2, "The line went dead.");
        format(string, sizeof(string), "* %s puts away their cellphone.", GetPlayerNameEx(caller));
        ProxDetector(30.0, caller, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        CellTime[caller] = 0;
        Mobile[caller] = INVALID_PLAYER_ID;
    }
    Mobile[playerid] = INVALID_PLAYER_ID;
    CellTime[playerid] = 0;

    foreach(Player, i)
    {
        if(EMSAccepted[i] == playerid)
        {
            EMSAccepted[i] = 999;
            GameTextForPlayer(i, "~w~EMS Caller~n~~r~Has Died", 5000, 1);
            EMSCallTime[i] = 0;
            DisablePlayerCheckpoint(i);
        }
    }


    if(GetPVarInt(playerid, "EventToken") == 0)
    {
        if(GetPVarInt(playerid, "PBM") < 1)
        {
            if(PlayerInfo[playerid][pJailTime] == 0)
            {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], X, Y, Z, 1.0, -1, -1, -1, -1, -1, -1);

                if(AdminDuty[playerid] != 1)
                {
                    SetPVarInt(playerid, "Injured", 1);

                    new Float:mX, Float:mY, Float:mZ;
                    GetPlayerPos(playerid, mX, mY, mZ);

                    SetPVarFloat(playerid, "MedicX", mX);
                    SetPVarFloat(playerid, "MedicY", mY);
                    SetPVarFloat(playerid, "MedicZ", mZ);
                    SetPVarInt(playerid, "MedicVW", GetPlayerVirtualWorld(playerid));
                    SetPVarInt(playerid, "MedicInt", GetPlayerInterior(playerid));
                }
                else
                {
                    SetPVarInt(playerid, "AdminDeathVW", GetPlayerVirtualWorld(playerid));
                    SetPVarInt(playerid, "AdminDeathInt", GetPlayerInterior(playerid));

                    SpawnPlayer(playerid);
                }
            }
        }
    }

    if(GetPVarInt(playerid, "Injured") == 0)
    {
        if(GetPVarInt(playerid, "EventToken") >= 1 || GetPVarInt(playerid, "PBM") > 0)
        {
            ResetPlayerWeapons(playerid);
        }
        else
        {
            ResetPlayerWeaponsEx(playerid);
        }
    }
    if(PlayerInfo[killerid][pAdmin] < 6)
    {
        if(reason == 49)
        {
            format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just car rammed %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
            ABroadCast(COLOR_YELLOW, string, 1);
            //print(string);
        }
        if(reason == 50)
        {
            if(IsAHelicopter(GetPlayerVehicleID(killerid)))
            {
                format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just helibladed %s (ID %d).", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
                ABroadCast(COLOR_YELLOW, string, 1);
                //print(string);
            }
            else
            {
                if(GetPlayerWeapon(killerid) != 32 || GetPlayerWeapon(killerid) != 28 || GetPlayerWeapon(killerid) != 29)
                {
                    format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just carparked %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
                    ABroadCast(COLOR_YELLOW, string, 1);
                    //print(string);
                }
                else
                {
                    format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just drivershot %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
                    ABroadCast(COLOR_YELLOW, string, 1);
                    //print(string);
                }
            }
        }
    }
    if(gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
    {
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
    }

    ClearCrime(playerid);
    if(PlayerInfo[playerid][pHeadValue] >= 1) {
        if(IsPlayerConnected(killerid)) {
            if(GoChase[killerid] == playerid) {
                new
                    killer[MAX_PLAYER_NAME],
                    name2[MAX_PLAYER_NAME],
                    name[MAX_PLAYER_NAME];

                new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
                name = GetPlayerNameEx(playerid);
                killer = GetPlayerNameEx(killerid);
                GivePlayerCash(killerid, takemoney);
                GivePlayerCash(playerid, -takemoney);
                format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",killer,name,PlayerInfo[playerid][pHeadValue] / 4 * 2);
                SendFamilyMessage(4, COLOR_YELLOW, string);
                format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d.",takemoney);
                ResetPlayerWeaponsEx(playerid);
                SendClientMessage(playerid, COLOR_YELLOW, string);

                foreach(Player, i) {
                    name2 = GetPlayerNameEx(i);
                    if(!strcmp(PlayerInfo[playerid][pContractBy], name2, true)) {
                        if(!IsPlayerStreamedIn(i, playerid)) {
                            format(string, sizeof(string), "SMS: %s has been eliminated, Sender: MOLE (555)", name);
                            SendClientMessage(i, COLOR_YELLOW, string);
                        }
                    }
                }

                PlayerInfo[playerid][pHeadValue] = 0;
                strcpy(PlayerInfo[playerid][pContractBy], "Nobody", 64);
                strcpy(PlayerInfo[playerid][pContractDetail], "None", 64);
                PlayerInfo[killerid][pCHits] += 1;
                GotHit[playerid] = 0;
                GetChased[playerid] = 999;
                GoChase[killerid] = 999;
            }
        }
    }
    if(IsPlayerConnected(killerid)) {
        if(GoChase[playerid] == killerid) {
            new killer[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
            new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
            GivePlayerCash(killerid, takemoney);
            name = GetPlayerNameEx(playerid);
            killer = GetPlayerNameEx(killerid);
            format(string,128,"Hitman %s has failed the contract on %s and lost $%d.",name,killer,PlayerInfo[killerid][pHeadValue] / 4 * 2);
            SendFamilyMessage(4, COLOR_YELLOW, string);
            GivePlayerCash(playerid, -takemoney);
            format(string,128,"You have just killed a hitman and gained $%d, removing the contact on your head.",PlayerInfo[killerid][pHeadValue] / 4 * 2);
            SendClientMessage(killerid, COLOR_YELLOW, string);

            foreach(Player, i) {
                name2 = GetPlayerNameEx(i);
                if(!strcmp(PlayerInfo[killerid][pContractBy], name2, true)) {
                    if(!IsPlayerStreamedIn(i, killerid)) {
                        format(string, sizeof(string), "SMS: We failed with %s, you can try place another hit on the target, Sender: MOLE (555)", killer);
                        SendClientMessage(i, COLOR_YELLOW, string);
                    }
                }
            }

            PlayerInfo[killerid][pHeadValue] = 0;
            strcpy(PlayerInfo[killerid][pContractBy], "Nobody", 64);
            strcpy(PlayerInfo[killerid][pContractDetail], "None", 64);
            PlayerInfo[playerid][pFHits] += 1;
            GotHit[playerid] = 0;
            GetChased[killerid] = 999;
            GoChase[playerid] = 999;
        }
    }
    killerid = INVALID_PLAYER_ID;
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)