"Complicated" Server: Unknown command error.
#1

So, i've got a /myvehicles command which works properly:

pawn Code:
CMD:myvehicles(playerid, params[])
{
    new
        p_Name[MAX_PLAYER_NAME],
        vehStr[128],
        vcount = 0
    ;
   
    GetPlayerName(playerid, p_Name, 24);
   
    SendClientMessage(playerid, -1, ""#CYAN"[Your Owned Vehicles]");
   
    LoadVehicles();
   
    for( new v = 1; v < MAXIMUM_VEHICLES; v++ ) //Loop through all the vehicles
    {
   
        if(vehInfo[v][Owner] == p_Name[playerid])
        {
            format(vehStr, sizeof(vehStr), ""#LIME"» "#WHITE"%s (ID: %d)", VehiclesName[GetVehicleModel(v)-400], v);
            SendClientMessage(playerid, -1, vehStr);
            vcount++;
        }

    }
    format(vehStr, sizeof(vehStr), "* Total owned vehicles: "#LIME"%d", vcount);
    SendClientMessage(playerid, -1, vehStr);
    return true;
}
To go along with it, I've got a function that loads all of my vehicles (also works properly)
pawn Code:
stock LoadVehicles()
{
    new
        vehStr[32];
       
    for( new v = 1; v < MAXIMUM_VEHICLES; v++ ) //Reload vehicles!
    {
        format(vehStr, sizeof(vehStr), "RPMod/Vehicles/%d.ini", v);
           
        if(fexist(vehStr))
        {
            INI_ParseFile(vehStr, "LoadVehicle_%s", .bExtra = true, .extra = v);
        }
    }
    return true;
}
The problem arrises when I deleted a vehicle using this command:
pawn Code:
CMD:deletevehicle(playerid, params[])
{
    new
        vID,
        vehStr[128]
    ;
       
    if(accInfo[playerid][Authorization] < 3)
        return NOAUTH;
       
    if(sscanf(params, "i", vID))
        return SendClientMessage(playerid, -1, ""#LIME"<CMD USAGE> "#WHITE"/deletevehicle <vehicle id>");
       
    format(vehStr, sizeof(vehStr), "RPMod/Vehicles/%d.ini", vID);
   
    if(fexist(vehStr))
    {
        fremove(vehStr);
       
        format(vehStr, sizeof(vehStr), ""#CYAN"» "#WHITE"Vehicle ID "#LIME"%d "#WHITE"removed.", vID);
        SendClientMessage(playerid, -1, vehStr);
       
        DestroyVehicle(VehiclePID[vID]);
       
        LoadVehicles();
    }
    else return SendClientMessage(playerid, c_RED, "« "#WHITE"That vehicle does not exist!");
    return true;
}
It causes a Server:Unknown command to print at the end of /myvehicles. How do I fix this?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 6 Guest(s)