[AJUDA] Server cai quando uma pessoa morre
#4

Quote:
Originally Posted by makino
Посмотреть сообщение
posta o onplayerdead
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    acResetWeapons(playerid);
    esconderRadar(playerid);
    new string[128], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], deathreason[20];
    new y, m, d, h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(killerid, name2, sizeof(name2));
    if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
    if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);
    if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);
    if(IsPlayerAttachedObjectSlotUsed(playerid,4)) RemovePlayerAttachedObject(playerid,4);
    if(IsPlayerAttachedObjectSlotUsed(playerid,5)) RemovePlayerAttachedObject(playerid,5);
    if(IsPlayerAttachedObjectSlotUsed(playerid,6)) RemovePlayerAttachedObject(playerid,6);
    if(IsPlayerAttachedObjectSlotUsed(playerid,7)) RemovePlayerAttachedObject(playerid,7);
    if(IsPlayerAttachedObjectSlotUsed(playerid,8)) RemovePlayerAttachedObject(playerid,8);
    if(IsPlayerAttachedObjectSlotUsed(playerid,9)) RemovePlayerAttachedObject(playerid,9);
    ResetPlayerWeapons(playerid);
    Delete3DTextLabel(Description[playerid]);
    Update3DTextLabelText(Description[playerid], 0x00000000, " ");
    Attach3DTextLabelToPlayer(Description[playerid],playerid, 0.0, 0.0, 0.6)
    Description[playerid] = Create3DTextLabel(" ", 0x00000000, 0.0, 0.0, 0.0, 50.0, -1, 0);

    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
    morteInfo[playerid][mPosX] = Pos[0];
    morteInfo[playerid][mPosY] = Pos[1];
    morteInfo[playerid][mPosZ] = Pos[2];
    morteInfo[playerid][mVirWorld] = GetPlayerVirtualWorld(playerid);
    morteInfo[playerid][mInterior] = GetPlayerInterior(playerid);
    Morto[playerid] = 1;

    if(killerid != INVALID_PLAYER_ID)
    {
        if(reason == 0) { deathreason = "Melee"; }
        else if(reason == 36 || reason == 35 || reason == 40 || reason == 16) { deathreason = "Explosion"; }
        else if(reason == 18 || reason == 37) { deathreason = "Fire"; }
        else if(reason == 51) { deathreason = "Explosion"; }
        else if(reason == 50) { deathreason = "Heli-Kill"; }
        else { GetWeaponName(reason, deathreason, sizeof(deathreason)); }
        format(string, sizeof(string),"[AV] %s (%d) foi morto por %s (%d) - %s", name,playerid,name2,killerid,deathreason);
        ProxDetector(60.0, playerid, string,COLOR_GRAD2,COLOR_GRAD2,COLOR_GRAD2,COLOR_GRAD2,COLOR_GRAD2);
    }
    else
    {
        new text[30];
        if(reason == 51) { text = "Explosao"; }
        else if(reason == 53) { text = "Drowned"; }
        else if(reason == 54) { text = "Colisao"; }
        else { text = "Death"; }
        format(string, sizeof(string),"[AV] %s (%d) foi morto pelo servidor. (%s)",name,playerid, text);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }

    if(Attached[playerid] == 1) StopPlayerHoldingObject(playerid);
    TextDrawHideForPlayer(playerid, Textdraw39[playerid]);
    gPlayerSpawned[playerid] = 0;

    if(PlayerInfo[playerid][pAdminDuty] >= 1) { PlayerInfo[playerid][pAdminDuty] = 0; }
    MedicBill[playerid] = 1;
    if(gPlayerUsingLoopingAnim[playerid]) {
        gPlayerUsingLoopingAnim[playerid] = 0;
        TextDrawHideForPlayer(playerid,txtAnimHelper);
    }
    if(PlayerInfo[playerid][pRegularRank] > 0) { SetPlayerHealth(playerid, 100.0); }
    else { SetPlayerHealth(playerid, 50.0+PlayerInfo[playerid][pSHealth]); }
    gPlayerSpawned[playerid] = 1;
    SafeTime[playerid] = 60;
    Checked[playerid] = 1;
    PlayerGotSpottedRecently[playerid] = 1;
    SetTimerEx("ResetAcWarn",20000,false, "i", playerid);
    if (reason == 22)
    {
        if (PlayerInfo[killerid][pPistSkill] >= 0 && PlayerInfo[killerid][pPistSkill] <= 1000)
        {
            PlayerInfo[killerid][pPistSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }
    if (reason == 23)
    {
        if (PlayerInfo[killerid][pSilenSkill] >= 0 && PlayerInfo[killerid][pSilenSkill] <= 1000)
        {
            PlayerInfo[killerid][pSilenSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }
    if (reason == 24)
    {
        if (PlayerInfo[killerid][pDesertSkill] >= 0 && PlayerInfo[killerid][pDesertSkill] <= 1000)
        {
            PlayerInfo[killerid][pDesertSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }

    if (reason == 25)
    {
        if (PlayerInfo[killerid][pShotgSkill] >= 0 && PlayerInfo[killerid][pShotgSkill] <= 1000)
        {
            PlayerInfo[killerid][pShotgSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }
    if (reason == 26)
    {
        if (PlayerInfo[killerid][pSawnSkill] >= 0 && PlayerInfo[killerid][pSawnSkill] <= 800)
        {
            PlayerInfo[killerid][pSawnSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }
    if (reason == 27)
    {
        if (PlayerInfo[killerid][pCombSkill] >= 0 && PlayerInfo[killerid][pCombSkill] <= 1000)
        {
            PlayerInfo[killerid][pCombSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }

    if (reason == 28 || reason == 32)
    {
        if (PlayerInfo[killerid][pUziSkill] >= 0 && PlayerInfo[killerid][pUziSkill] <= 800)
        {
            PlayerInfo[killerid][pUziSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }

    if (reason == 29)
    {
        if (PlayerInfo[killerid][pSmgSkill] >= 0 && PlayerInfo[killerid][pSmgSkill] <= 1000)
        {
            PlayerInfo[killerid][pSmgSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }

    if (reason == 30)
    {
        if (PlayerInfo[killerid][pAkSkill] >= 0 && PlayerInfo[killerid][pAkSkill] <= 1000)
        {
            PlayerInfo[killerid][pAkSkill] += 2;
            SetPlayerSkills(killerid);
        }
    }

    if (reason == 31)
    {
        if (PlayerInfo[killerid][pM4Skill] >= 0 && PlayerInfo[killerid][pM4Skill] <= 1000)
        {
            PlayerInfo[killerid][pM4Skill] += 2;
            SetPlayerSkills(killerid);
        }
    }


    if (gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 20)
    {
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
    }
    new caller = Mobile[playerid];
    if(caller != 255)
    {
        if(caller < 255)
        {
            SendClientMessage(caller,  COLOR_GRAD2, "[AV] Linha caiu (...)");
            CellTime[caller] = 0;
            CellTime[playerid] = 0;
            Mobile[caller] = 255;
        }
        Mobile[playerid] = 255;
        CellTime[playerid] = 0;
    }
    ClearCrime(playerid);

    if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0)
    {
        if (BusrouteEast[playerid][0] != 0) BusrouteEnd(playerid, BusrouteEast[playerid][1]);
        else if (BusrouteWest[playerid][0] != 0) BusrouteEnd(playerid, BusrouteWest[playerid][1]);
        else BusrouteEnd(playerid, 0);
    }
    if(FarmerVar[playerid] != 0)
    {
        FarmerVar[playerid] = 0;
        DisablePlayerCheckpoint(playerid);
    }
    if(DrugFarmerVar[playerid] != 0)
    {
        DrugFarmerVar[playerid] = 0;
        DisablePlayerCheckpoint(playerid);
    }
    if(SmugglerWork[playerid] != 0)
    {
        SmugglerWork[playerid] = 0;
        DisablePlayerCheckpoint(playerid);
    }
    killerid = INVALID_PLAYER_ID;
    SetRealMoney(playerid, ScriptMoney[playerid]);
    SetPlayerColor(playerid,0xBBBBBB00);
    SafeResetPlayerWeapons(playerid);
    return 0x01;
}
Olha ae.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)