Error gets spammed
#2

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')

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");
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.
Reply


Messages In This Thread
Error gets spammed - by ZBits - 01.02.2014, 13:07
Re: Error gets spammed - by CuervO - 01.02.2014, 13:12
Re: Error gets spammed - by ZBits - 01.02.2014, 13:25
Re: Error gets spammed - by CuervO - 01.02.2014, 13:29
Re: Error gets spammed - by ZBits - 01.02.2014, 23:38
Re: Error gets spammed - by CuervO - 02.02.2014, 00:22
Re: Error gets spammed - by ZBits - 02.02.2014, 00:25
Re: Error gets spammed - by ZBits - 02.02.2014, 00:31
Re: Error gets spammed - by CuervO - 02.02.2014, 00:32
Re: Error gets spammed - by ZBits - 02.02.2014, 00:35

Forum Jump:


Users browsing this thread: 2 Guest(s)