Else statement problem.
#1

HI!

The problem is:
When i type the key_submission (2), i give the message "No suspects in range." even if is a suspect with 3 wanted near at me,how to solve it?

Code:
if((newkeys == KEY_SUBMISSION) && isLEO(playerid))
    {
        foreach(new i : Player)
        {
            new msg[100];
            if(GetDistanceBetweenPlayers(playerid, i) < 7.0 && Player[i][playerWanted] <= 5 && Player[i][playerWanted] >= 1)
            {
                format(msg, 100, "/ticket %d", i);
            	return CallLocalFunction("OnPlayerCommandText", "ds", playerid, msg);
			}
			if(GetDistanceBetweenPlayers(playerid, i) < 7.0 && Player[i][playerWanted] >= 6)
			{
			    format(msg, 100, "/arrest %d", i);
			    return CallLocalFunction("OnPlayerCommandText", "ds", playerid, msg);
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "No suspects in range.");
				return 1;
			}
        }
    }
Reply
#2

Try this, not sure if works but you could try.

https://pastebin.com/3fgadv9N
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)