This returns Server Unknown Command, But still executes?
#1

Can anyone see why it returns unknown command (sucess == 0)

It still works although that is returned.


pawn Код:
CMD:refuel(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(AdminLevel[playerid] < 2) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a vehicle.");
    if(!IsPlayerInRangeOfPoint(playerid, 10.0, -240.2907,1209.9883,19.7422) || IsPlayerInRangeOfPoint(playerid, 10.0,-1327.7439,2675.7014,50.0625)|| IsPlayerInRangeOfPoint(playerid, 10.0, 609.0861,1698.3657,6.9922))return SendClientMessage(playerid, COLOUR_GREY, "You must be at a Gas Station to refuel.");
    new amount, sum, string[128], num;
    num = 100;
    new vehicleid = GetPlayerVehicleID(playerid);
    new name = GetVehicleModel(vehicleid)- 200;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(engine == 1) return SendClientMessage(playerid, COLOUR_GREY, "Please turn your engine off before refuelling.");
    if(VehFuel[vehicleid] == num)return SendClientMessage(playerid, COLOUR_GREY, "Your vehicle's fuel tank is full.");
   
    sum = num -= VehFuel[vehicleid];
    if(amount > sum) return SendClientMessage(playerid, COLOUR_GREY, "Your vehicle cannot hold this much fuel.");
    format(string, sizeof(string), "Usage: /refuel [amount] - Use /refuel %d to fill the tank. (You have %d percent fuel left.)", sum, VehFuel[vehicleid]);
    if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOUR_GREY, string);
   
    RefuelTimer[playerid] = SetTimerEx("RefuelUpdate", 1000, true, "i", playerid);
    RefuelAmount[playerid] = amount;
    printf("Refuel amount %d", RefuelAmount[playerid]);
    format(string, sizeof(string), "* %s has begun refuelling the %s. *", GetNameEx(playerid), VehicleNames[name]);
    ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
   
    return 1;
}
Reply
#2

Still not resolved!
Reply
#3

You have anything inside your OnPlayerCommandText?
Reply
#4

Don't have it in the script, I thought it might be because I didn't put the !(not) infront of the other co-ordinates, so I'm testing, although I have an issue with this:

pawn Код:
CMD:housestore(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");

    new cashamount, string[128],function[16], sum;
    new houseid = GetPlayerHouseID(playerid);
    if(sscanf(params, "s[16]",function)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /housestore [function] - Functions: Money, Weed, Cocaine.");

    else if(strcmp(function, "money", true))
    {
        if(sscanf(params, "s[16]d",params, cashamount)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /housestore [money] [amount]");
        if(cashamount < 1 || cashamount > 500000) return SendClientMessage(playerid, COLOUR_GREY, "The amount must be between $0 and $500,000.");
        if(cashamount > PlayerMoney[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much to store.");
        if(HouseOwned[playerid] == houseid)
        {
            printf("House Owned: %d", HouseOwned[playerid]);
            sum = HouseMoney[houseid] += cashamount;
            HouseSQLID[houseid] = MySQL_GetValue(HouseSQLID[houseid], "id", "houses");
            MySQL_SetInteger(HouseSQLID[houseid], "HouseMoney", sum, "houses");
            GivePlayerMoney(playerid, -cashamount);
            printf("Cash amount %d", cashamount);
            format(string, sizeof(string), "You have stored $%d in your house.", cashamount);
            SendClientMessage(playerid, COLOUR_ORANGE, string);
        }

    }
    return 1;
}
The issue is, that when I type /housestore money it doesnt return the sscanf for that strcmp.
Reply
#5

Try:
pawn Код:
else if(!strcmp(function, "money", true))
In your house command.
Reply
#6

ON TOPIC: That made no difference, I believe it may be something to do with checking the co-ordinates? It still executes but returns unknown command.
Reply
#7

https://sampwiki.blast.hk/wiki/Debugging
Reply
#8

I think everyone fucking forgot ****** uses return 0; for his successful.

So yeah, everyone here fails bigtime lol
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)