getmission
#1

Hello!

i cant get this cmd code to compile without errors/warning, what am i doing wrong?

pawn Код:
COMMAND:getmission(playerid, params[]) //warning 209: function "cmd_getmission" should return a value
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 433)
            {
                if(ccargado[playerid] == 0 && enrep[playerid] == 0 && enload[playerid] == 0)
                {
                    if(GetPlayerTeam(playerid) == 0)
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,405.7452,2442.8865,16.5000,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    if(GetPlayerTeam(playerid) == 1)
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,1664.6863,1337.0352,10.7705,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    if(GetPlayerTeam(playerid) == 2)
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,1921.9943,-2235.5515,13.5469,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    if(GetPlayerTeam(playerid) == 3)
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,-1441.6310,-206.0983,6.0000,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "Your Truck is fully loaded!");
                    return 1;
                    }
                }
                else // error 010: invalid function or declaration
                {
                    SendClientMessage(playerid, COLOR_RED, "You have to be the driver!");
                    return 1; // error 010: invalid function or declaration
                }
            }
            else // error 010: invalid function or declaration
            {
                SendClientMessage(playerid, COLOR_RED, "You have to be in a delivery truck!");
                return 1; // error 010: invalid function or declaration
            }
        }
        else // error 010: invalid function or declaration
        {
            SendClientMessage(playerid, COLOR_RED, "You have to be in a Truck!");
            return 1; // error 010: invalid function or declaration
        }
    }
return 1; // error 010: invalid function or declaration
}
Reply
#2

You appear to have missing brackets all over the place.
Reply
#3

pawn Код:
COMMAND:getmission(playerid, params[]) //warning 209: function "cmd_getmission" should return a value
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 433)
            {
                if(ccargado[playerid] == 0 && enrep[playerid] == 0 && enload[playerid] == 0)
                {
                    if(GetPlayerTeam(playerid) == 0)
                    {
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,405.7452,2442.8865,16.5000,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    else if(GetPlayerTeam(playerid) == 1)
                    {
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,1664.6863,1337.0352,10.7705,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    else if(GetPlayerTeam(playerid) == 2)
                    {
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,1921.9943,-2235.5515,13.5469,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    else if(GetPlayerTeam(playerid) == 3)
                    {
                        enload[playerid] = 1;
                        SetPlayerCheckpoint(playerid,-1441.6310,-206.0983,6.0000,10);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
                    }
                    else SendClientMessage(playerid, COLOR_RED, "Your Truck is fully loaded!");
                }
                else return SendClientMessage(playerid, COLOR_RED, "You have to be the driver!");
            }
            else return SendClientMessage(playerid, COLOR_RED, "You have to be in a delivery truck!");
        }
        else return SendClientMessage(playerid, COLOR_RED, "You have to be in a Truck!");
    }
    return 1; // error 010: invalid function or declaration
}
Reply
#4

pawn Код:
COMMAND:getmission(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have to be in a Truck!");
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 433) return SendClientMessage(playerid, COLOR_RED, "You have to be in a delivery truck!");
    if(ccargado[playerid] == 0 && enrep[playerid] == 0 && enload[playerid] == 0)
    {
        switch(GetPlayerTeam(playerid))
        {
            case 0:
            {
                SetPlayerCheckpoint(playerid,405.7452,2442.8865,16.5000,10);
                enload[playerid] = 1;
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
            }
            case 1:
            {
                SetPlayerCheckpoint(playerid,1664.6863,1337.0352,10.7705,10);
                enload[playerid] = 1;
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
            }
            case 2:
            {
                SetPlayerCheckpoint(playerid,1921.9943,-2235.5515,13.5469,10);
                enload[playerid] = 1;
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
            }
            case 3:
            {
                SetPlayerCheckpoint(playerid,-1441.6310,-206.0983,6.0000,10);
                enload[playerid] = 1;
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Go to the red marker to load the truck");
            }
            default:
            {
                SendClientMessage(playerid, COLOR_RED, "Your Truck is fully loaded!");
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You have to be the driver!");
    }
    return 1;
}
Reply
#5

Thanks guys! works perfect not
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)