Unknown Command
#1

Hello, everybody.
I need help with this command - for some reason, it tells me that it is an unknown command when I try to input a percentage. Everything works fine, it detects if I'm near a station, if a car is near me, etc, however if I enter the percentage, it says unknown command. I have no idea what's causing this. This command is causing me grief and I have no idea why, usually I can sort out my problems.

pawn Код:
CMD:fill(playerid, params[]) {
    new iCount,
        fsID,
        vid = GetClosestVehicle(playerid),
        fPercent,
        fPercentTime,
        price;
    if(sscanf(params, "d", fPercent)) {
        SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/fill [percentage]");
        return 1;
    }
    for(new x = 0; x < MAX_FUELSTATIONS; x++) {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, fuelVariables[x][fsPos][0], fuelVariables[x][fsPos][1], fuelVariables[x][fsPos][2])) {
            iCount++;
            fsID = x;
        }
    }
    if(iCount >= 1) {
        if(IsPlayerInRangeOfVehicle(playerid, vid, 5.0)) {
            if(IsPlayerInAnyVehicle(playerid)) { return SendClientMessage(playerid, COLOR_GREY, "You must be standing outside of the vehicle!"); }
            price = fuelVariables[fsID][fsFuelPrice] * fPercent;
            if(vehicleVariables[vid][vVehicleFuel] + fPercent > MAX_VEHICLE_FUEL) {
                fPercent = MAX_VEHICLE_FUEL - vehicleVariables[vid][vVehicleFuel];
            }
            if(playerVariables[playerid][pMoney] >= price) {
                format(szMessage, sizeof(szMessage), "* %s sticks the end of the fuel-hose nozzle into the %s and squeezes the trigger.", playerVariables[playerid][pNormalName], VehicleNames[vid - 400]);
                nearByMessage(playerid, COLOR_PURPLE, szMessage);
                fPercentTime = fPercent * 200;
                playerVariables[playerid][pMoney] -= price;
                SetTimerEx("fuelvehicle", fPercentTime, false, "ddd", playerid, vid, fPercent);
                TogglePlayerControllable(playerid, 0);
            }
            else {
                format(szMessage, sizeof(szMessage), "You do not have enough money! ($%d, at $%d per. percent)",price, fuelVariables[fsID][fsFuelPrice]);
                SendClientMessage(playerid, COLOR_GREY, szMessage);
            }
        }
        else SendClientMessage(playerid, COLOR_GREY, "You must have your vehicle with you!");
    }
    return 1;
}
Thanks.
Reply
#2

Bump. Anybody know what's wrong?
Reply
#3

Bump once again. Anybody?
Reply
#4

Bump, yet again. :/
Reply
#5

Bump, once again.
Does anybody have any idea?
Reply
#6

bumping a topic in which you have or require further information is allowed after at least 24 hours.
Reply
#7

Quote:
Originally Posted by Deron_Green
Посмотреть сообщение
bumping a topic in which you have or require further information is allowed after at least 24 hours.
That's lovely. My thread was on the 5th page, I'm fairly certain it was not being seen there.
Reply
#8

if your command returns 'true' or '1' this won't happen.
Reply
#9

Quote:
Originally Posted by Eric
Посмотреть сообщение
That's lovely. My thread was on the 5th page, I'm fairly certain it was not being seen there.
That gives you precedence over those who actually follow the rules because?

The problem may be with you returning SendClientMessage, as it doesn't return a specific value.
Reply
#10

Quote:
Originally Posted by Bakr
Посмотреть сообщение
That gives you precedence over those who actually follow the rules because?

The problem may be with you returning SendClientMessage, as it doesn't return a specific value.
I never said it gave me any precedence, I merely stated that my thread was on the 5th page and that what he said was lovely.

Anyhow, which line am I returning SendClientMessage on? I might be blind, but I don't see it.

@RedFusion, I know it is not the stock; I use that stock in many other commands and it works fine. :/
It detects if the vehicle is near me or not, and whether or not I am near the pumps fine. I've tested all of that already, but for some reason it's when I enter a percentage that it gives me an issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)