SA-MP Forums Archive
Automatic Wanteds - 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: Automatic Wanteds (/showthread.php?tid=283971)



Automatic Wanteds - imagician - 17.09.2011

Hi guys.
In my automatic Wanted award there is a problem.
If a Hitman has a contract and kills someone, he gets 2 Wanteds, but I would be happy that he gets only 1 Wanted.
Can someone help me please?
Here is my code:

if(!IsACop(killerid) && GotHit[killerid] == 0)
{
WantedLevel[killerid]+=1;
SetPlayerCriminal(killerid, 255, "Mord");
}
else if(!IsACop(killerid) && GotHit[killerid] == 1)
{
SetPlayerCriminal(killerid, 255, "Mord (Auftrag)");
}

under OnPlayerDeath

Sincerely, Imagician.


Re: Automatic Wanteds - Tee - 17.09.2011

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(!IsACop(killerid) && GotHit[killerid] == 0)
    {
        WantedLevel[killerid] = 1;
        SetPlayerCriminal(killerid, 255, "Mord");
    }
    else if(!IsACop(killerid) && GotHit[killerid] == 1)
    {
        SetPlayerCriminal(killerid, 255, "Mord (Auftrag)");
    }
    return 1;
}
I'm guessing you don't use SetPlayerWantedLevel.


Re: Automatic Wanteds - imagician - 17.09.2011

Tee and whats new?


Re: Automatic Wanteds - =WoR=Varth - 17.09.2011

Remember to check if killerid is INVALID_PLAYER_ID or not.


Re: Automatic Wanteds - imagician - 17.09.2011

Can someone please improve my code so that it works?
I want that when a Hitman has a contract and kills someone, he gets a Wanted and if you have no contract, 2 Wanteds.


Re: Automatic Wanteds - grand.Theft.Otto - 17.09.2011

Do you have a hitman variable? Like IsHitman[playerid] for example.


Re: Automatic Wanteds - imagician - 17.09.2011

Yeah so:

if(PlayerInfo[killerid][pLeader] == 8 || PlayerInfo[playerid] == 8 )

Sincerely, Imagician.


Re: Automatic Wanteds - Tee - 17.09.2011

Quote:
Originally Posted by imagician
Посмотреть сообщение
Tee and whats new?
WantedLevel[killerid] = 1;


Re: Automatic Wanteds - imagician - 17.09.2011

Read my problem:

Can someone please improve my code so that it works?
I want that when a Hitman has a contract and kills someone, he gets a Wanted and if the Hitman has no contract and kills someone, he gets 2 Wanteds.


Re: Automatic Wanteds - grand.Theft.Otto - 17.09.2011

Hmm, try this, but change it to your hitman variable IF you want or leave it to mine:

pawn Код:
// top of script

new IsHitman[MAX_PLAYERS];

// in your " choose skill " menu or whatever/wherever you choose hitman skill

IsHitman[playerid] = 1;

// onplayerdeath

new plwl = GetPlayerWantedLevel(killerid);
new str[128];
if(!IsACop(killerid) && GotHit[killerid] == 0 && IsHitman[killerid] == 0)
{
    SetPlayerWantedLevel(killerid, plwl += 1);
    SetPlayerCriminal(killerid, 255, "Mord");
    format(str,128,"Wanted Level %d",plwl); SendClientMessage(killerid,COLOR,str);
}
else if(!IsACop(killerid) && GotHit[killerid] == 1 && IsHitman[killerid] == 1)
{
    SetPlayerWantedLevel(killerid, plwl += 1);
    SetPlayerCriminal(killerid, 255, "Mord (Auftrag)");
    format(str,128,"Wanted Level %d",plwl); SendClientMessage(killerid,COLOR,str);
}