"Complicated" Server: Unknown command error. -
2KY - 18.02.2012
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?
Re: "Complicated" Server: Unknown command error. -
Scenario - 18.02.2012
At the end of your commands, use
return 1 and not
return true.
Re: "Complicated" Server: Unknown command error. -
2KY - 18.02.2012
Quote:
Originally Posted by RealCop228
At the end of your commands, use return 1 and not return true.
|
What's the difference?
EDIT: Problem still persists.
Re: "Complicated" Server: Unknown command error. -
Scenario - 18.02.2012
Quote:
Originally Posted by 2KY
What's the difference?
EDIT: Problem still persists.
|
Well "true" and "false" are what a bool can return. I wasn't sure if it mattered, but I figured we could try. I'm not really sure what it could be really. Perhaps something in the stock function, but nothing is standing out to me.
Re: "Complicated" Server: Unknown command error. -
JhnzRep - 18.02.2012
pawn Code:
if(accInfo[playerid][Authorization] < 3) return NOAUTH;
if(sscanf(params, "i", vID)) return SendClientMessage(playerid, -1, ""#LIME"<CMD USAGE> "#WHITE"/deletevehicle <vehicle id>");
Wild guess.
Re: "Complicated" Server: Unknown command error. -
2KY - 18.02.2012
Quote:
Originally Posted by RealCop228
Well "true" and "false" are what a bool can return. I wasn't sure if it mattered, but I figured we could try. I'm not really sure what it could be really. Perhaps something in the stock function, but nothing is standing out to me.
|
Me neither, and that's a big problem considering everything APPEARS to be fine to me.
Quote:
Originally Posted by JhnzRep
pawn Code:
if(accInfo[playerid][Authorization] < 3) return NOAUTH; if(sscanf(params, "i", vID)) return SendClientMessage(playerid, -1, ""#LIME"<CMD USAGE> "#WHITE"/deletevehicle <vehicle id>");
Wild guess.
|
That would do the same thing, the only difference is a new line and a tab.
Re: "Complicated" Server: Unknown command error. -
FireCat - 18.02.2012
pawn Code:
if(vehInfo[v][Owner] == p_Name[playerid])
WTF?!?!?!
Try this:
pawn Code:
if(!strcmp(vehInfo[v][Owner],p_Name[playerid]))
Re: "Complicated" Server: Unknown command error. -
2KY - 18.02.2012
Quote:
Originally Posted by FireCat
pawn Code:
if(vehInfo[v][Owner] == p_Name[playerid])
WTF?!?!?!
Try this:
pawn Code:
if(!strcmp(vehInfo[v][Owner],p_Name[playerid]))
|
That code automatically yields the "Server: Unknown command".
The bit of code you said "WTF?!?!?!" to, it works; Other than this problem, it works flawlessly.
Re: "Complicated" Server: Unknown command error. -
2KY - 20.02.2012
Bump. Really need this fixed.
Re: "Complicated" Server: Unknown command error. -
Guitar - 20.02.2012
Hm, replace all the return true or whatever to return 0;
.