Jump to content
  • 0

Question

Posted

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;
                }
            }
        }

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.