27.03.2015, 00:31
Hi guys.
I have a array with e.g. 10 different objects and I want to detect if is player near one of them.
I used cycle for:
but it doesn't work. I tried a lot of other ways, but just one of them worked, this one ->
and It's not very good solution.
Do you have any suggestions?
Thank you.
I have a array with e.g. 10 different objects and I want to detect if is player near one of them.
I used cycle for:
Код:
for(new i = 0; i < sizeof(myObjArray); i++)
{
if(IsPlayerNearObject(playerid, myObjArray[i]))
{
...
}
}
Код:
if(IsPlayerNearObject(playerid, myObjArray[0]) ||
IsPlayerNearObject(playerid, myObjArray[1]) ||
IsPlayerNearObject(playerid, myObjArray[2]) ||
IsPlayerNearObject(playerid, myObjArray[3]) ||
IsPlayerNearObject(playerid, myObjArray[4]) ||
IsPlayerNearObject(playerid, myObjArray[5]) ||
IsPlayerNearObject(playerid, myObjArray[6]) ||
IsPlayerNearObject(playerid, myObjArray[7]) ||
IsPlayerNearObject(playerid, myObjArray[8]) ||
IsPlayerNearObject(playerid, myObjArray[9]))
{
...
}
Do you have any suggestions?
Thank you.


