My /fishing command isn't working with an array.
#2

When they actually fish, you need to break the loop.

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);
            break; //The player IS in range, so stop the loop.
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)