Jump to content
  • 0

Contracte pe playerii afk


TrueCross

Question

Salut, am incercat sa fac ca atunci cund un player este afk, daca primeste damage de la un hitman sa se rezolve contractul, dar tot nu merge.

De exemplu daca hitmanul trage in el, el primeste contractul cand playerul revine de pe AFK si doar daca este aproape de el, la fel si la PD, idei?

Am bagat asta la: OnPlayerGiveDamge

 

if(AFK[damagedid] >= 1)
    {
        if(playerVariables[damagedid][pHeadValue] > 0)
        {
             if(IsPlayerConnected(playerid))
               {
                if(playerVariables[playerid][pGroup] == 12)
                {
                      if(GoChase[playerid] == damagedid)
                     {
                        playerVariables[playerid][pMoney] += playerVariables[damagedid][pHeadValue];
                        format(string,128,"%s has succesfully completed the contract on %s for $%s, distance: %.0fm.",attacker,victim,NumberFormat(playerVariables[damagedid][pHeadValue]), GetDistanceBetweenPlayers(playerid, damagedid));
                        SendToGroup(12, COLOR_TEAL, string);
                        playerVariables[damagedid][pHeadValue] = -1;
                        GotHit[damagedid] = 0;
                        GetChased[damagedid] = 999;
                        GoChase[playerid] = 999;
                    }
                }
            }
         }
         if(playerVariables[damagedid][pWarrants] >= 1)
        {
             new wakavictim[MAX_PLAYER_NAME];
               new wakavictim2[MAX_PLAYER_NAME];
            new price = playerVariables[damagedid][pWarrants] * 5000;
            GetPlayerName(damagedid, wakavictim, MAX_PLAYER_NAME);
            if(IsPlayerConnected(playerid))
            {
                if((playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 || playerVariables[playerid][pGroup] == 5) && CrimInRange(50.0, damagedid,playerid))
                {
                    GetPlayerName(playerid, wakavictim2, MAX_PLAYER_NAME);
                    format(string, sizeof(string), "~b~Running suspect bonus!");
                    GameTextForPlayer(playerid, string, 5000, 1);
                    playerVariables[playerid][pMoney] += price;
                    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
                    format(szMessage, sizeof(szMessage), "Ai primit $%d pentru prinderea suspectului %s!",price, wakavictim);
                    SCM(playerid,COLOR_BLUE,szMessage);
                    playerVariables[damagedid][pMoney] -= price;
                    playerVariables[damagedid][pPrisonID] = 3;
                    playerVariables[damagedid][pRob] = 0;
                    format(szMessage, sizeof(szMessage), "* %s is now in jail! Thanks to: %s!", wakavictim, wakavictim2);
                    nearByMessage(damagedid, COLOR_PURPLE, szMessage);
                    playerVariables[damagedid][pPrisonTime] = (playerVariables[damagedid][pWarrants])*(300);
                    format(string, sizeof(string), "* You where killed and arrested for %d seconds and lost you %d$.", playerVariables[damagedid][pPrisonTime], price);
                    SendClientMessage(damagedid, COLOR_LIGHTRED, string);
                    format(szMessage, sizeof(szMessage), "Dispatch: %s (%d) has been killed by %s and will be in jail for %d seconds.",wakavictim, damagedid, wakavictim2, playerVariables[damagedid][pPrisonTime]);
                    sendDepartmentMessage(COLOR_RADIOCHAT, szMessage);
                     playerVariables[damagedid][pWarrants] = 0;
                    SetPlayerWantedLevel(damagedid, 0);
                    format(playerVariables[damagedid][pCrimeReason], 250, "");
                    WantedTime[damagedid] = -1;
                }
            }
        }

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.