Arrest cmd bugged - 
NoahF -  08.07.2014
SO I debugged the Arrest command, and the debug messages I put stop at this line:
Код:
if(GetDistanceBetweenPlayers(playerid, CriminalID) < 5.0)
 
Re: Arrest cmd bugged - 
greentarch -  08.07.2014
Can you post the function "GetDistanceBetweenPlayers"?
Re: Arrest cmd bugged - 
BroZeus -  08.07.2014
and also some lines after and above it..
Re: Arrest cmd bugged - 
NoahF -  08.07.2014
Sure.
Код:
forward Float:GetDistanceBetweenPlayers(player1,player2);
public Float:GetDistanceBetweenPlayers(player1,player2)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(player1) || !IsPlayerConnected(player2))
    {
        return -1.00;
    }
    GetPlayerPos(player1,x1,y1,z1);
    GetPlayerPos(player2,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
 
Код:
	if(gTeam[playerid] != POL && gTeam[playerid] != SECSRV && gTeam[playerid] != ARMY && gTeam[playerid] != SWAT) return SendClientMessage(playerid, COLOR_RED, "You are not a Law Enforcement Officer!");
    print("This part works.");
	if(sscanf(params, "u", CriminalID)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /arrest [ID]");
	print("this part works.");
	if(CriminalID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot arrest yourself, how is that possible?!");
	print("This part works.");
	if(!IsPlayerConnected(CriminalID)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected.");
	print("This part works.");
	if(GetDistanceBetweenPlayers(playerid, CriminalID) < 5.0)
	{
		new WantedLvl;
        print("This part works.");
		WantedLvl = GetPlayerWantedLevel(CriminalID);
        print("This part works.");
		if(WantedLvl >= 3)
		{
			print("This part works.");
			SetTimerEx("UnjailTimer", 120000, false, "i", CriminalID);
 
Re: Arrest cmd bugged - 
BroZeus -  08.07.2014
try using a stock for it
and the fucntion u use is way long
i have a simpler function for it use this
pawn Код:
forward Float:GetDistanceBetweenPlayers(player1,player2);
public Float:GetDistanceBetweenPlayers(player1,player2)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(player1) || !IsPlayerConnected(player2))
    {
        return -1.00;
    }
    GetPlayerPos(player1,x1,y1,z1);
    GetPlayerPos(player2,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
 replace the above code with this --
pawn Код:
stock GetDistanceBetweenPlayers(player1, player2)
{
    if(!IsPlayerConnected(player1) || !IsPlayerConnected(player2))
    {
        return -1;
    }
    new Float:x,Float:y,Float:z;
    GetPlayerPos(player2, x, y, z);
    return GetPlayerDistanceFromPoint(player1, x, y, z);
}
 
Re: Arrest cmd bugged - 
NoahF -  08.07.2014
With your stock I get a tag mismatch on this line:
return GetPlayerDistanceFromPoint(player1, x, y, z);
Re: Arrest cmd bugged - 
NoahF -  10.07.2014
EDIT: FIXED.