loadpackages dont work
#1

Can Somebody tell me whats wrong in this CMD ??
When im out of Trucker veh it says your net in vehicle when i hop in trucker veh
its unknown command :/
pawn Code:
CMD:loadpackages(playerid, params[])
{
    new string[128], packages;
    // L1: 0 | L2: 100 | L3: 300 | L4: 700 | L5: 1200
    if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100) packages = 5;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300) packages = 10;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700) packages = 15;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200) packages = 20;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200) 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))) return SendClientMessage(playerid, COLOR_GREY, "You are not in a Trucker vehicle.");
    if(!IsPlayerInRangeOfPoint(playerid, 5, 844.6911,-598.9043,18.4219)) 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;
}
Here is my trucker veh:
pawn Code:
JobInfo[JOB_TRUCKER][jCars][0] = CreateVehicle(414,789.8238,-608.8157,16.1695,1.6426,0,1,1200); // T1
and:
pawn Code:
stock IsTruckerVehicle(vehicleid)
{
    for(new i=0; i<10; i++)
    {
        if(vehicleid == JobInfo[JOB_TRUCKER][jCars][i]) return 1;
    }
    return 0;
}
Reply
#2

Any help ??
Reply
#3

1. Please dont Bump the threads by double posting.

2. Tried to fix your command a bit. Just changed some stuff. Try using it. [UNTESTED]

pawn Code:
CMD:loadpackages(playerid, params[])
{
    if(IsTruckerVehicle(GetPlayerVehicleID(playerid))) {
    new string[128], packages;
    if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100) packages = 5;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300) packages = 10;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700) packages = 15;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200) packages = 20;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200) 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.");
     return SendClientMessage(playerid, COLOR_GREY, "You are not in a Trucker vehicle.");
    if(!IsPlayerInRangeOfPoint(playerid, 5, 844.6911,-598.9043,18.4219)) 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 SendClientMessage(playerid, COLOR_LIGHTRED, "<!> You need to be in a Trucker vehicle to use this command!");
    return 1;
}
Reply
#4

I think its working but how to add dynamic vehicles i add thoes codes Up there /\
But then all objects and pickups was invisable

EDIT: Nope still saying unknown cmd and my antihack says im hacking now
Reply
#5

New errors !
Code:
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(6589) : warning 225: unreachable code
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(6611) : warning 225: unreachable code
pawn Code:
6589         if(!IsPlayerInRangeOfPoint(playerid, 5, 844.6911,-598.9043,18.4219)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a packages pickup.");
pawn Code:
6611            return 1;
Reply
#6

Oww ma bad
pawn Code:
CMD:loadpackages(playerid, params[])
{
    if(IsTruckerVehicle(GetPlayerVehicleID(playerid))) {
    new string[128], packages;
    if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 100) packages = 5;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 300) packages = 10;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 700) packages = 15;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] < 1200) packages = 20;
    else if(PlayerInfo[playerid][pJobSkill][JOB_TRUCKER] >= 1200) 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(!IsPlayerInRangeOfPoint(playerid, 5, 844.6911,-598.9043,18.4219)) 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.");
    }
    }
    else return SendClientMessage(playerid, COLOR_LIGHTRED, "<!> You need to be in a Trucker vehicle to use this command!");
    return 1;
}
Reply
#7

Thx alot man but it still says Unknown command when i am in any vehicle :/
Reply
#8

Quote:
Originally Posted by hulitubolies
View Post
Thx alot man but it still says Unknown command when i am in any vehicle :/
1. It works inside the trucker vehicle now?
2. You added the right command? Add the command from my previous post again and re-compile your script.
Reply
#9

Its not working at all it works when im out of vehicle then it says You need to be in a Trucker vehicle to use this command!
Reply
#10

Sory ma bad its working in trucker car !!
but i cant overload!!
and for other vehicles its unknown cmd
how to fix thoes two things ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)