Job command
#1

pawn Код:
CMD:loadpackages(playerid, params[])
{
    new string[128], packages;
    // L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
    if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 250) packages = 5;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 500) packages = 10;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 800) packages = 15;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1000) packages = 20;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1700) packages = 25;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker.");
    if(PlayerInfo[playerid][pTPackages] == 2) return SendClientMessage(playerid, COLOR_GREY, "You already have overloaded packages.");
    if(!IsPlayerInAnyVehicle(playerid) || !IsTruckerVehicle(GetPlayerVehicleID(playerid)) || !IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Trucker vehicle or you have no trailer attached.");
    if(!IsPlayerInRangeOfPoint(playerid, 5, 257.7331,1480.7288,10.5859)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a packages pickup.");
    if(PlayerInfo[playerid][pMoney] < packages*5) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money on you.");
    PlayerInfo[playerid][pTPackages] ++;
    GiveZaiatMoney(playerid, -(packages*5));
    PlayerInfo[playerid][pDeliverTruck] = GetPlayerVehicleID(playerid);
    TruckPackages[GetPlayerVehicleID(playerid)] = playerid;
    format(string, sizeof(string), "* %s has loaded %d products packages from the pickup.", RPN(playerid), packages);
    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    format(string, sizeof(string), "* You have loaded {FF6347}%d products{33CCFF} packages for {FF6347}$%d{33CCFF}, deliver them to the dropoff. (Checkpoint)", packages, packages*5);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    if(PlayerInfo[playerid][pTPackages] != 2)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You can overload packages by typing /loadpackages again, cops will be notified though.");
    }
    SetPlayerCheckpoint(playerid, 2222.5107,-2682.7368,13.5409, 2);
    if(PlayerInfo[playerid][pTPackages] == 2)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "* You have overloaded packages, the Police Department has been notified as a result.");
        SendCopMessage(COLOR_BLUE, "Products Depot: A truck has overloaded packages and is on it way to the dropoff now.");
    }
    return 1;
}
Whenever i type this command in in the correct place it just returns 'unknown command'

I don't have a clue what the problem could be, it works when i'm not in the correct place but returns in a message telling me im not in the correct place.

Any resolution?

Regards
Oscii
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)