What is wrong with wanted ..
#3

hm...
Код:
if(gTeam[i] == 3 && CrimInRange(50.0, playerid,i))
{
	count = 1;
}
this loop through all players looks ok, but it can be stopped as soon it found a player in range, to save some redundant time, since count=1; only needs to get set once.


Код:
WantedLevel[playerid] += 0;
WantedPoints[playerid] += 0;
return 1;
? adding 0 to a wantedlevel will result in the same wantedlevel. also the return 1; will break the entire function,try:
Код:
WantedLevel[playerid] += 1;
WantedPoints[playerid] += 2;
//without the return 1; so the callback can go on...
Код:
if(WantedLevel[playerid] > 0)
{
	WantedLevel[playerid] -= 1;
	WantedPoints[playerid] -= 2;
	new string[255];
	new wlevel = WantedLevel[playerid];
	format(string, sizeof(string), "Current Wanted Level: %d", wlevel);
	SendClientMessage(playerid, COLOR_YELLOW, string);
	return 1;
}
you dont get your wantedlevel printed coz it only prints out if the playerid's wanted > 0, an innocent player should get at least a "you are not wanted".

long words, short sense. i fixed the code a bit more, give it a try. sry if i fucked it up entirely
Код:
public playerwanted(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		new count;
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(gTeam[i] == 3 && CrimInRange(50.0, playerid,i))
			{
				count = 1;
				continue;
			}
		}
		if(count == 1)
		{
			WantedLevel[playerid] += 1;
			WantedPoints[playerid] += 2;
		}
		new string[128];
		if(WantedLevel[playerid] > 0)
		{
			WantedLevel[playerid] -= 1;
			WantedPoints[playerid] -= 2;
			format(string, sizeof(string), "Current Wanted Level: %d", WantedLevel[playerid]);
		}
		else
		{
			format(string, sizeof(string), "You are innocent atm.");
		}
		SendClientMessage(playerid, COLOR_YELLOW, string);
	}
	return 1;
}
edit: may i ask what the function should do? i mean, is it meant to work like a cops /report or a general /info purpose? the WantedLevel[playerid]+=0; looks odd
Reply


Messages In This Thread
What is wrong with wanted .. - by qUick1337 - 06.07.2011, 23:42
Re: What is wrong with wanted .. - by Shadoww5 - 07.07.2011, 00:08
Re: What is wrong with wanted .. - by Babul - 07.07.2011, 00:37
Re: What is wrong with wanted .. - by qUick1337 - 07.07.2011, 01:02
Re: What is wrong with wanted .. - by qUick1337 - 07.07.2011, 10:59

Forum Jump:


Users browsing this thread: 1 Guest(s)