/Vmenu "Unknown command"
#1

Код:
COMMAND:vmenu(playerid, params[])
{
new string[1024],v,playername[MAX_PLAYER_NAME],vehvid=-1;
if(IsPlayerInAnyVehicle(playerid)) vehvid=GetPlayerVehicleID(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
for(new vid=0;vid<MAX_VEHICLES;vid++)
{
if(strlen(playername)==strlen(VehicleInfo[vid][owner]) && !strcmp(playername,VehicleInfo[vid][owner],false,MAX_PLAYER_NAME))
{
if(vid==0)format(string,sizeof(string),"%s - [Plate: %s]",string,VehicleNames[GetVehicleModel(vid)-400],VehicleInfo[vid][Plate]);
else format(string,sizeof(string),"%s\n%s - [Plate: %s]",string,VehicleNames[GetVehicleModel(vid)-400],VehicleInfo[vid][Plate]);
if(vid == vehvid)format(string,sizeof(string),"%s [{00FF00}•{FFFFFF}]",string);
VmenuInfo[playerid][itemvid][v] = vid;
v ++;
}
else VmenuInfo[playerid][itemvid][vid]=-1;
if(v > 0){
ShowPlayerDialog(playerid, DIALOG_VMENU, DIALOG_STYLE_LIST, "Manage your vehicle", string, "Select", "Cancel");
}
else SendClientMessage(playerid,-1,"[Error:] You don't have any vehicle");
}
return 1;
}
It works but say on chat "Unknown command"...
How can i fix it?
Reply
#2

What are the size of VehicleInfo ?
Reply
#3

What you mean ReVo_?
I have this:
Код:
#define MAX_VEH 300

new VehicleInfo[MAX_VEH][vsys];
And inside the enum:
Код:
owner[MAX_PLAYER_NAME]
Reply
#4

If you mean the command gets executed but you still get UNKNOWN COMMAND, you need to change the return value in OnPlayerCommandText to 1
Reply
#5

Quote:
Originally Posted by Pangea
Посмотреть сообщение
If you mean the command gets executed but you still get UNKNOWN COMMAND, you need to change the return value in OnPlayerCommandText to 1
I don't use OnPlayerCommandText, i use zcmd...
I've removed the callback OnPlayerCommandText.
Reply
#6

UP!
Reply
#7

change MAX_VEHICLES with MAX_VEH

here : for(new vid=0;vid<MAX_VEH;vid++)

when the index exceeds from the limit could happen
Reply
#8

Thanks ReVo_
Fixed with your help
Thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)