return problem
#1

Cannot upload whole cmd cus is so huge but here is the error

Код:
C:\Users\Hellman\Desktop\New folder\pawno\include\/CRP/Publics/OnCommand.pwn(5683) : warning 209: function "cmd_v" should return a value
pawn Код:
new plname[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, plname, sizeof(plname));
                    new gps;
                    gps = strval(tmp);
                    new vehicle = GetPlayerVehicleID(playerid);
                    if(gps < 1 || gps > 5) { SendClientMessage(playerid, COLOR_INFO, "GPS level can't be below 1 or above 5 !"); return 1; }
                    if(VehicleInfo[vehicle][vGPS] >= gps) { format(string, sizeof(string), "You already own a GPS level %d or more !", gps); SendClientMessage(playerid, COLOR_LIGHTRED, string); return 1; }
                    new gpscost = gps*150;
                    /*if(VehicleInfo[vehicle][vOwned] == 0)
                    {
                        SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle");
                        return 1;
                    }*/

                    new playername[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, playername, sizeof(playername));
                    if(VehicleInfo[vehicle][vKey] == PlayerInfo[playerid][pCarKey] || (strcmp(plname, VehicleInfo[vehicle][vOwner], true) == 0))
                    {
                        if(GetPlayerCash(playerid) >= gpscost)
                        {
                            format(string, sizeof(string), "You have succefully brought GPS level %d for $%d.", gps, gpscost);
                            SendClientMessage(playerid, COLOR_GREEN, string);
                            GivePlayerCash(playerid, -gpscost);
                            VehicleInfo[vehicle][vGPS] = gps;
                            SaveVehicles(playerid, vehicle);
                            return 1;
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_LIGHTRED, "You can not afford this");
                            return 1;
                    }
                }
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Reply
#2

As i can see,you're opening 3 brackets but closing 5.
Reply
#3

nvm Logitech90 was first.
Reply
#4

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
As i can see,you're opening 3 brackets but closing 5.
Should i remove 2 of them?
Reply
#5

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
Should i remove 2 of them?
Код:
new plname[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, plname, sizeof(plname));
                    new gps;
                    gps = strval(tmp);
                    new vehicle = GetPlayerVehicleID(playerid);
                    if(gps < 1 || gps > 5) { SendClientMessage(playerid, COLOR_INFO, "GPS level can't be below 1 or above 5 !"); return 1; }
                    if(VehicleInfo[vehicle][vGPS] >= gps) { format(string, sizeof(string), "You already own a GPS level %d or more !", gps); SendClientMessage(playerid, COLOR_LIGHTRED, string); return 1; }
                    new gpscost = gps*150;
                    /*if(VehicleInfo[vehicle][vOwned] == 0)
                    {
                        SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle");
                        return 1;
                    }*/
                    new playername[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, playername, sizeof(playername));
                    if(VehicleInfo[vehicle][vKey] == PlayerInfo[playerid][pCarKey] || (strcmp(plname, VehicleInfo[vehicle][vOwner], true) == 0))
                    {
                        if(GetPlayerCash(playerid) >= gpscost)
                        {
                            format(string, sizeof(string), "You have succefully brought GPS level %d for $%d.", gps, gpscost);
                            SendClientMessage(playerid, COLOR_GREEN, string);
                            GivePlayerCash(playerid, -gpscost);
                            VehicleInfo[vehicle][vGPS] = gps;
                            SaveVehicles(playerid, vehicle);
                            return 1;
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_LIGHTRED, "You can not afford this");
                            return 1;
                    }
                }
            }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
Should i remove 2 of them?
Yes.

If you open a bracket,you've to close JUST one.

If you open two,close two brackets.

And so on.

Good code:

pawn Код:
if(PlayerInfo[playerid][blabla] == 0)
{
//Your things here.
}
Bad code:

pawn Код:
if(PlayerInfo[playerid][blabla] == 0)
{
//Your things here.
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)