30.03.2014, 04:32
So I have a array of coordinates, simple as that. I'd like to detect if a player is in range of any of the coordinates of the array. But for some reason it's not working. It duplicates the action 5+ times, as if it's looping through players and not the positions.
pawn Код:
CMD:fish(playerid, params[])
{
if(GameProgress == 0) return SCM(playerid, COLOR_GREY, "Error: You can't fish when a game is not in progress.");
if(IsPlayerReady[playerid] == 0) return SCM(playerid, COLOR_GREY, "Error: You're not in a game.");
if(fish[playerid] == MAX_INVENTORY[playerid]) return SCM(playerid,COLOR_GREY, "Error: You can't hold any more fish.");
if(currentlyfishing[playerid] == 1) return SCM(playerid,COLOR_GREY, "Error: You're already fishing.");
for(new i = 0; i < sizeof(fishingspots); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, fishingspots[i][0], fishingspots[i][1], fishingspots[i][2]))
{
currentlyfishing[playerid] = 1;
SetTimerEx("FishTimer", 5000, false, "i", playerid);
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid,"BOMBER","BOM_Plant_Loop",4,1,0,0, 0,0,1);
}
}
return 1;
}