Fish cmds problem
#1

Problem
Код:
../gamemodes/OnPlayerCommandZCMD.pwn(3095) : warning 209: function "cmd_fish" should return a value
../gamemodes/OnPlayerCommandZCMD.pwn(3096) : error 010: invalid function or declaration
../gamemodes/OnPlayerCommandZCMD.pwn(3100) : error 010: invalid function or declaration
I have a return?


pawn Код:
}
COMMAND:fish(playerid, params[])
{
        if(IsAtFishPlace(playerid))
        {
            if(Died[playerid] == 1) { SendClientMessage(playerid, COLOR_WHITE, "Cannot use this command while dead."); return 1; }
            if(JustFished[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "Please wait 4 seconds between each /fish. ");
                return 1;
            }
            if(PlayerInfo[playerid][pFish] == 20)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You can not carry anymore fish use /sellfish");
                return 1;
            }
            JustFished[playerid] = 1;
            SetTimerEx("FishReset", 4000, false, "i", playerid);
            new FishRand = random(9);
            if(FishRand == 0)
            {
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Pike");
                PlayerInfo[playerid][pFish] += 1;
            }
            if(FishRand == 1)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
            }
            if(FishRand == 2)
            {
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Sardine");
                PlayerInfo[playerid][pFish] += 1;
            }
            if(FishRand == 3)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
            }
            if(FishRand == 4)
            {
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Sardine");
                PlayerInfo[playerid][pFish] += 1;
            }
            if(FishRand == 5)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
            }
            if(FishRand == 6)
            {
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Bass");
                PlayerInfo[playerid][pFish] += 1;
            }
            if(FishRand == 7)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
            }
            if(FishRand == 8)
            {
                PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Bass");
                PlayerInfo[playerid][pFish] += 1;
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Reply
#2

pawn Код:
COMMAND:fish(playerid, params[])
{
    if(IsAtFishPlace(playerid))
    {
        if(Died[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Cannot use this command while dead.");
            return 1;
        }
        if(JustFished[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "Please wait 4 seconds between each /fish. ");
            return 1;
        }
        if(PlayerInfo[playerid][pFish] == 20)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You can not carry anymore fish use /sellfish");
            return 1;
        }
        JustFished[playerid] = 1;
        SetTimerEx("FishReset", 4000, false, "i", playerid);
        new FishRand = random(9);
        if(FishRand == 0)
        {
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Pike");
            PlayerInfo[playerid][pFish] += 1;
        }
        if(FishRand == 1)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
        }
        if(FishRand == 2)
        {
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Sardine");
            PlayerInfo[playerid][pFish] += 1;
        }
        if(FishRand == 3)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
        }
        if(FishRand == 4)
        {
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Sardine");
            PlayerInfo[playerid][pFish] += 1;
        }
        if(FishRand == 5)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
        }
        if(FishRand == 6)
        {
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Bass");
            PlayerInfo[playerid][pFish] += 1;
        }
        if(FishRand == 7)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You didn't catch anything.");
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught nothing.");
        }
        if(FishRand == 8)
        {
            PlayerActionMessage(playerid,15.0,"rolls back the line and caught a Bass");
            PlayerInfo[playerid][pFish] += 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Indent your code properly next time...
Reply
#3

What have I done wrong when I put it?
Reply
#4

you have double brackets '}'
Reply
#5

If you indent your code properly, it would look like this

pawn Код:
}
    COMMAND:fish(playerid, params[])
    {
        if(IsAtFishPlace(playerid))
        {
            ...
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Reply
#6

Okej, working now, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)