01.02.2014, 13:12
You're sending the message inside a loop. It will send the message X times the amount of business the player is not in range of.
This can be solved by doing all the code processing Outside the loop by this way:
The following code gets the ID of the business the player is in range of and will store it in a variable ('i')
You're also eating a lot of resources by creating a 500 cell string inside the loop. I am sure 500 cells are not needed for such a little message.
P.S: I defined as 'i' so you don't have to change most of the code.
This can be solved by doing all the code processing Outside the loop by this way:
The following code gets the ID of the business the player is in range of and will store it in a variable ('i')
pawn Код:
new i = 0;
for(new a; a < MAX_BUSINESSES; a++)
{
if(!IsPlayerInRangeOfPoint(playerid, 10.0, bInfo[a][Position][0], bInfo[a][Position][1], bInfo[a][Position][2]))
continue;
i= a;
}
if(!i)
return SendClientMessage(playerid, COLOR_PINK2, "Error: you are not near any property");
P.S: I defined as 'i' so you don't have to change most of the code.