Automatic Wanteds
#1

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.
Reply
#2

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.
Reply
#3

Tee and whats new?
Reply
#4

Remember to check if killerid is INVALID_PLAYER_ID or not.
Reply
#5

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.
Reply
#6

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

Yeah so:

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

Sincerely, Imagician.
Reply
#8

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

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)