Wanted Problem
#1

I have a big problem with Wanted system , work only if you kill an civil or Cop

I can't make when a player kill other player to give the killer Wanted 1 , except the cops

This is all the OnPlayerDeath

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2)
	    {
	        undercover[playerid] = 0;
	        return 1;
		}
	}
	new name[MAX_PLAYER_NAME];
	new string[256];
	//new dmessage[128];
	//new deathreason[20];
	new victimteam;
	new killerteam;
	victimteam = PlayerInfo[playerid][pTeam];
	killerteam = PlayerInfo[killerid][pTeam];
	new playercash;
	new Float:px,Float:py,Float:pz;

	gPlayerSpawned[playerid] = 0;
	GetPlayerName(playerid, name, sizeof(name));
	PlayerInfo[playerid][pLocal] = 255;
	GetPlayerPos(playerid, px, py, pz);
	if(killerid != 255)
	{
		if(GetPlayerState(killerid) == 2)
		{
			SendClientMessage(killerid, COLOR_YELLOW, "DriveBy Kill, dont abuse it!");
			return 1;
		}
	}
	if(reason == 38)
	{
		new kstring[128];
		new kickname[MAX_PLAYER_NAME];
		if(IsPlayerConnected(killerid))
		{
			GetPlayerName(killerid, kickname, sizeof(kickname));
			format(string, 256, "AdmWarning: [%d]%s just killed a player with minigun, be sure he's not fake-killing.",killerid,kickname);
			ABroadCast(COLOR_YELLOW,string,1);
			printf("%s", kstring);
		}
	}
	if(IsPlayerInArea(playerid, -2116.569, -139.7016, -1923.435, 357.3639))
    {
        if(PlayerInfo[killerid][pMember] == 1 || PlayerInfo[killerid][pMember] == 2 || PlayerInfo[killerid][pMember] == 3 || PlayerInfo[killerid][pLeader] == 1 || PlayerInfo[killerid][pLeader] == 2 || PlayerInfo[killerid][pLeader] == 3)
        {
            return 1;
		}
        else if(PlayerInfo[killerid][pMember] >= 4 || PlayerInfo[killerid][pLeader] >= 4 || PlayerInfo[killerid][pMember] == 0 || PlayerInfo[killerid][pLeader] == 0)
        {
			new KK[MAX_PLAYER_NAME];
	       	GetPlayerName(killerid, KK, sizeof(KK));
			ResetPlayerWeapons(killerid);
			SetPlayerInterior(killerid, 6);
			SetPlayerPos(killerid,264.6288,77.5742,1001.0391);
			PlayerInfo[killerid][pJailTime] = 800;
			PlayerInfo[killerid][pJailed] = 1;
			SetTimerEx("jailtime", 8000, 0, "d", playerid);
			format(string, 256, "<< Player %s has been jailed for killing in the NO DM Zone >>",KK);
			SendClientMessageToAll(COLOR_LIGHTRED, string);
		}
    }
	if (gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
	{
		DisablePlayerCheckpoint(playerid);
		gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
	}
	new caller = Mobile[playerid];
	if(caller != 255)
	{
		if(caller < 255)
		{
			SendClientMessage(caller,  COLOR_GRAD2, "   The line just went dead....");
			CellTime[caller] = 0;
			CellTime[playerid] = 0;
			Mobile[caller] = 255;
		}
		Mobile[playerid] = 255;
		CellTime[playerid] = 0;
	}
	ClearCrime(playerid);
	if(PlayerPaintballing[playerid] != 0)
	{
	    PlayerPaintballKills[killerid] ++;
	    if(PlayerPaintballKills[killerid] > PaintballWinnerKills)
	    {
	        new killer[MAX_PLAYER_NAME];
	        PaintballWinner = killerid;
	        PaintballWinnerKills = PlayerPaintballKills[killerid];
	        GetPlayerName(killerid, killer, sizeof(killer));
	        for(new i = 0; i < MAX_PLAYERS; i++)
	        {
	            if(IsPlayerConnected(i))
	            {
	                if(PlayerPaintballing[i] != 0)
	                {
	                    format(string, sizeof(string), "* %s is in the lead with %d Kills.",killer,PaintballWinnerKills);
						SendClientMessage(i, COLOR_WHITE, string);
	                }
	            }
	        }
	    }
	    return 1;
	}
	if(PlayerInfo[playerid][pHeadValue] > 0)
	{
	    if(IsPlayerConnected(killerid))
	    {
		    if(gTeam[killerid] == 10 || PlayerInfo[killerid][pLeader] == 8)
		    {
		        if(GoChase[killerid] == playerid)
		        {
		            ConsumingMoney[killerid] = 1;
					new killer[MAX_PLAYER_NAME];
					GetPlayerName(killerid, killer, sizeof(killer));
					GivePlayerMoneyEx(killerid, PlayerInfo[playerid][pHeadValue]);
					format(string,128,"<< Hitman %s has fulfilled the contract on %s and collected %s >>",killer,name,FormatMoney(PlayerInfo[playerid][pHeadValue]));
					SendFamilyMessage(8, COLOR_YELLOW, string);
					PlayerInfo[playerid][pHeadValue] = 0;
					GotHit[playerid] = 0;
					GetChased[playerid] = 999;
					GoChase[killerid] = 999;
				}
			}
		}
	}
	if(victimteam >= 4)
	{
	    if(IsPlayerConnected(killerid))
	    {
			//new killer[MAX_PLAYER_NAME];
			//GetPlayerName(killerid, killer, sizeof(killer));
			new slice = 100; //$100
			playercash = GetPlayerMoneyEx(playerid);
			if(gTeam[killerid] != 2) { WantedPoints[killerid] += 2; } //+ 2 wanted points
			if(SafeTime[playerid] <= 0)
			{
				if(gTeam[killerid] != gTeam[playerid])
				{
					if(GetPlayerState(killerid) == 1)
					{
						PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 2;
					}
					else
					{
						PlayerInfo[killerid][pKills]++;
					}
					PlayerInfo[playerid][pKills]--;
				}
			}
			/*if (strlen(deathreason) > 0)// patch
			{
				if (((gTeam[killerid]) == 1) || ((gTeam[killerid]) == 3 && civnokill) || gTeam[killerid] == gTeam[playerid])//med kill criminal
				{
					format(string, sizeof(string), ".: %s murdered %s. (%s) :.", killer, name, deathreason);
				}
				else
				{
					format(string, sizeof(string), ".: %s murdered %s. (%s) for $%d :.", killer, name, deathreason, slice);
				}

			}
			else
			{
				if (((gTeam[killerid]) == 1) || ((gTeam[killerid]) == 3 && civnokill || gTeam[killerid] == gTeam[playerid]))
				{
					format(string, sizeof(string), ".: %s murdered %s :.", killer, name);
				}
				else
				{
					format(string, sizeof(string), ".: %s murdered %s for $%d :.", killer, name, slice);
				}
			}*/
			if (((gTeam[killerid]) == 1) || ((gTeam[killerid]) == 3 && civnokill) || (gTeam[killerid] == gTeam[playerid] && gTeam[playerid] != 4))
			{
				slice = 0;
			}
			if (((gTeam[killerid]) != 4) && ((gTeam[killerid]) == gTeam[playerid]))//no team kill
			{
				slice = 0;
			}
			if (playercash > 0)
			{
				GivePlayerMoneyEx(playerid, -slice);
			}
			else
			{
				slice = slice+500;
			}
			GivePlayerMoneyEx(killerid, slice);
			//GameTextForPlayer(playerid, dmessage, 5000, 2);
			PlayerPlaySound(killerid, 1083, 0.0, 0.0, 0.0);
			if (((gTeam[killerid]) == 3) && reason != 49)
			{
				SetPlayerCriminal(killerid,255, "First Degree Murder");
			}
			else if (((gTeam[killerid]) == 3) && reason == 49)
			{
				SetPlayerCriminal(killerid,255, "Hit And Run");
			}
		}
	}
	else if (victimteam == 2)
	{
	    if(IsPlayerConnected(killerid))
	    {
			//new killer[MAX_PLAYER_NAME];
			//GetPlayerName(killerid, killer, sizeof(killer));
			// Cop kill
			PlayerInfo[playerid][pKills]--;
			if (gTeam[killerid] == 2)//cops kill cop
			{
				//format(string,128,".: Officer %s murdered Officer %s (%s) and was sued for $%d :.",killer,name,deathreason,suecost);
				PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
				GivePlayerMoneyEx(killerid, -suecost);
				GivePlayerMoneyEx(playerid, suecost+100);//+100pays hospital bill
			}
			else
			{
				//format(string,128,".: %s murdered Officer %s (%s) :.",killer,name,deathreason);
		    }
			if (gTeam[killerid] >= 3)
			{
			    WantedPoints[killerid] += 2; //+ 2 wanted points
				if(reason != 49)
				{
					SetPlayerCriminal(killerid,255, "First Degree Murder");
				}
				else if (reason == 49)
				{
					SetPlayerCriminal(killerid,255, "Hit And Run");
				}
			}
			if(gTeam[killerid] >= 5 && SafeTime[playerid] <= 0)
			{
				if(GetPlayerState(killerid) == 1)
				{
					PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+2;
				}
				else
				{
					PlayerInfo[killerid][pKills]++;
				}
				WantedPoints[killerid]+=2;
			}
			//BroadCast(COLOR_RED, string);
		}
	}
	else if (victimteam == 3)
	{
	    if(IsPlayerConnected(killerid))
	    {
			if ((gTeam[killerid]) == 2)//cops kill civ
			{
			    if(WantedLevel[playerid] < 1)
			    {
					PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
					GivePlayerMoneyEx(killerid, -suecost);
					GivePlayerMoneyEx(playerid, suecost+100);//+100pays hospital bill
				}
			}
			else
			{
				WantedPoints[killerid] += 2;
		    }
			if (((gTeam[killerid]) >= 16 || (gTeam[killerid]) == 1) && reason != 49)
			{
				SetPlayerCriminal(killerid,255, "First Degree Murder");
			}
			else if (((gTeam[killerid]) >= 16 || (gTeam[killerid]) == 1) && reason == 49)
			{
				SetPlayerCriminal(killerid,255, "Hit And Run");
			}
		}
	}
	else if (victimteam == 1)
	{
	    if(IsPlayerConnected(killerid))
	    {
			if ((gTeam[killerid]) == 2)//cops kill civ
			{
				PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
				GivePlayerMoneyEx(killerid, -suecost);
				GivePlayerMoneyEx(playerid, suecost+100);//+100pays hospital bill
			}
			else if ((gTeam[killerid]) == 1)//med kill civ
			{
				PlayerPlaySound(killerid, 1084, 0.0, 0.0, 0.0);
				GivePlayerMoneyEx(killerid, -suecost);
				GivePlayerMoneyEx(playerid, suecost+100);//+100pays hospital bill
		    }
			if (((gTeam[killerid]) == 4) && reason != 49)
			{
				SetPlayerCriminal(killerid,255, "First Degree Murder");
			}
			else if (((gTeam[killerid]) == 3) && reason == 49)
			{
				SetPlayerCriminal(killerid,255, "Hit And Run");
			}
		}
	}
	if (victimteam >= 3 && WantedPoints[playerid] > 0 && killerteam == 2)
	{
	    SetPlayerFree(playerid,killerid, "Got Killed");
	}
	killerid = INVALID_PLAYER_ID;
	SetPlayerColor(playerid,COLOR_GRAD2);
	return 1;
}
This part was edited by someone else .

I want when a player kill another player to give him wanted 1 and 1 star.

I have also problems at /suspect comand for cops

1)Whwn I give wanted oven 6 the stars appear only 6 stars
2) The maximum wanted is 10 , but if you give to a player wanted 6 and then give him again wanted (eg . 8 ) the wanted level pass the maximum level

Код:
	if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (IsACop(playerid))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        result[0] = toupper(result[0]);
                        if(!strlen(result)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
                        if (gTeam[playa] == 2 || IsACop(playa)) return SendClientMessage(playerid, -1, "You can't Suspect a Cop!");
                        if(money > 10) return SendClientMessage(playerid, COLOR_GREY, "Maximum wanted level is 10!");
                        if(money == 0) return SendClientMessage(playerid, COLOR_GREY, "Minimum wanted level is 0!");
                        if(WantedLevel[playa] > 9) return SendClientMessage(playerid, COLOR_GREY, "That player have Maxim Wanted Level! (Wanted 10)");
                        WantedLevel[playa] += money;
                        new wl = WantedLevel[playa];
			SetPlayerWantedLevel(playa, wl);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "You commited a crime ( %s ) [+%d],Raportat de: %s",result,money,sendername);
                        SendClientMessage(playa, COLOR_LIGHTRED, string);
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3)
                                {
                                    format(string, sizeof(string), "HQ: All units APB: Reporter: %s.",sendername);
                                    SendClientMessage(i, 0x0000C1FF, string);
                                    format(string, sizeof(string), "HQ: Crime: %s[+%d], Suspect: %s. ",result,money,giveplayer);
                                    SendClientMessage(i, 0x0000C1FF, string);
                                }
                            }
                        }
                    }
                }
            } else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop!");
        }
        return 1;
    }
Reply
#2

For the thingy you said..that you can only see 6 stars...add command /checkwanted and use GetPlayerWantedLevel...simple
Reply
#3

Quote:
Originally Posted by wumpyc
Посмотреть сообщение
For the thingy you said..that you can only see 6 stars...add command /checkwanted and use GetPlayerWantedLevel...simple
If you see y allready done this ...

Can enybody help me?
Reply
#4

For your first issue just use:
pawn Код:
SetPlayerWantedLevel(killerid, PlayerInfo[killerid][pWanted]+1);
It's pretty obvious how that works, but if you need more detail let me know.


- Camacorn
Reply
#5

Ok , I think i resolved , i changed the wanted system and I realize that was symple but I didn't test it , when I can test it I will .
Reply
#6

Quote:
Originally Posted by rAzvAn18
Посмотреть сообщение
I have a big problem with Wanted system , work only if you kill an civil or Cop


2) The maximum wanted is 10 , but if you give to a player wanted 6 and then give him again wanted (eg . 8 ) the wanted level pass the maximum level

Код:
	if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (IsACop(playerid))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        result[0] = toupper(result[0]);
                        if(!strlen(result)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
                        if (gTeam[playa] == 2 || IsACop(playa)) return SendClientMessage(playerid, -1, "You can't Suspect a Cop!");
                        if(money > 10) return SendClientMessage(playerid, COLOR_GREY, "Maximum wanted level is 10!");
                        if(money == 0) return SendClientMessage(playerid, COLOR_GREY, "Minimum wanted level is 0!");
                        if(WantedLevel[playa] > 9) return SendClientMessage(playerid, COLOR_GREY, "That player have Maxim Wanted Level! (Wanted 10)");
                        WantedLevel[playa] += money;
                        new wl = WantedLevel[playa];
			SetPlayerWantedLevel(playa, wl);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "You commited a crime ( %s ) [+%d],Raportat de: %s",result,money,sendername);
                        SendClientMessage(playa, COLOR_LIGHTRED, string);
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3)
                                {
                                    format(string, sizeof(string), "HQ: All units APB: Reporter: %s.",sendername);
                                    SendClientMessage(i, 0x0000C1FF, string);
                                    format(string, sizeof(string), "HQ: Crime: %s[+%d], Suspect: %s. ",result,money,giveplayer);
                                    SendClientMessage(i, 0x0000C1FF, string);
                                }
                            }
                        }
                    }
                }
            } else return SendClientMessage(playerid, COLOR_GREY, "You are not a Cop!");
        }
        return 1;
    }
Can enybody help me with this ?
Reply
#7

Help plz !
Reply
#8

I rozolved thaks for help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)