Command Only working for ID:0
#1

Command Only working for ID:0?
Hello, After all the attepts I have made so that everyone else can use this command other than ID:0 has failed. When your in game, and this command only works for ID:0 for some reason. I want this command to work for all ID's, not just ID:0. Please help me out.

pawn Код:
CMD:loadoil(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] == 25 || PlayerInfo[playerid][pJob2] == 25)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(IsAOilTruckerCar(vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(gPlayerCheckpointStatus[playerid] == CHECKPOINT_NONE || GetPVarInt(playerid, "Packages") >= 1 || TaxiAccepted[playerid] != 999 || EMSAccepted[playerid] != 999 || BusAccepted[playerid] != 999 || MedicAccepted[playerid] != 999 || MechanicCallTime[playerid] >= 1)
            {
                if(GetProgressBarValue(OilLoadTruckBar[playerid]) > 10)
                {
                    SendClientMessageEx(playerid, COLOR_WHITE, "You are currently loading your Truck!");
                    return 1;
                }
                if(OilTruckUsed[playerid] != INVALID_VEHICLE_ID)
                {
                    SendClientMessageEx(playerid, COLOR_WHITE, "You are already on another delivery, type /cancel truck to cancel that delivery.");
                    return 1;
                }
                gPlayerCheckpointStatus[playerid] = CHECKPOINT_OilLOADTRUCK;
                SetPlayerCheckpoint(playerid,-1052.6180, -610.5533, 32.0078, 4);
                GameTextForPlayer(playerid, "~w~Waypoint set ~r~Oil Truck Depot", 5000, 1);
                SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Refill you truck to transport with your Truck at Oil Truck Depot (see checkpoint on radar).");
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
                return 1;
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You are not driving a Oil Truck!");
            return 1;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You are not a Oil Trucker!");
        return 1;
    }
    return 1;
}
Reply
#2

Bump? :/
Reply
#3

Any Help please? +rep if you even attempt to say thank you. I really need help, since this has been puzzling me for ages now. :c
Reply
#4

I didn't understand you well, how do you mean Only working for ID 0?

What is it returning for other ids?
Reply
#5

Basically, if I logged on to my server as ID:0 I could use this command '/loadoil' however, if I logged onto the server as a different id, lets say 1, it wouldn't allow me. Is there a loop in this command or is it not returning it for every ID? If you know, please help me. I've searches the forums for some similar issues like this, none off them helped me.
Reply
#6

How does it not allow you? What message do you get? I suggest you debugging your command.
pawn Код:
CMD:loadoil(playerid, params[])
{
    print("1");
    if(PlayerInfo[playerid][pJob] == 25 || PlayerInfo[playerid][pJob2] == 25)
    {
        print("2");
        new vehicleid = GetPlayerVehicleID(playerid);
        if(IsAOilTruckerCar(vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            print("3");
            if(gPlayerCheckpointStatus[playerid] == CHECKPOINT_NONE || GetPVarInt(playerid, "Packages") >= 1 || TaxiAccepted[playerid] != 999 || EMSAccepted[playerid] != 999 || BusAccepted[playerid] != 999 || MedicAccepted[playerid] != 999 || MechanicCallTime[playerid] >= 1)
            {
                print("4");
                if(GetProgressBarValue(OilLoadTruckBar[playerid]) > 10)
                {
                    SendClientMessageEx(playerid, COLOR_WHITE, "You are currently loading your Truck!");
                    return 1;
                }
                print("5");
                if(OilTruckUsed[playerid] != INVALID_VEHICLE_ID)
                {
                    SendClientMessageEx(playerid, COLOR_WHITE, "You are already on another delivery, type /cancel truck to cancel that delivery.");
                    return 1;
                }
                print("6");
                gPlayerCheckpointStatus[playerid] = CHECKPOINT_OilLOADTRUCK;
                SetPlayerCheckpoint(playerid,-1052.6180, -610.5533, 32.0078, 4);
                GameTextForPlayer(playerid, "~w~Waypoint set ~r~Oil Truck Depot", 5000, 1);
                SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Refill you truck to transport with your Truck at Oil Truck Depot (see checkpoint on radar).");
                print("7");
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
                return 1;
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You are not driving a Oil Truck!");
            return 1;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You are not a Oil Trucker!");
        return 1;
    }
    return 1;
}
Try this with ID 1+ and tell me which number is displayed on the console.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)