Command succeed but not. -
davazi7 - 05.11.2013
HI! I Have been adding new commands to my gamemode and when I use it ingame they work perfectly, but I get the error message "Unknown command".
Here's the OnPlayerCommandPerformed:
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new string[99];
format(string, sizeof string, "{FF0000}[ERROR] {FFFFFF}El comando no existe!", cmdtext);
Message(playerid, -1, string);
}
return 1;
}
Thanks!
Re: Command succeed but not. -
Brandon_More - 05.11.2013
Код:
#define COLOR_WHITE 0xFFFFFF77
Код:
if(!success)
{
new string[99];
format(string, sizeof(string), "{FF0000}[ERROR] {FFFFFF}%s comando no existe!", cmdtext);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
Respuesta: Command succeed but not. -
davazi7 - 05.11.2013
No, the same problem :S
Re: Command succeed but not. -
Twizted - 05.11.2013
Are you using ZCMD? If so, you can simply add this:
pawn Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SendClientMessage(playerid, 0xAA3333AA, "[ERROR] {FFFFFF}El comando no existe!");
}
Re: Command succeed but not. -
rappy93 - 05.11.2013
Or remove the "return 1" from the command which gives that "Unknown Command" warning.
Respuesta: Re: Command succeed but not. -
davazi7 - 06.11.2013
Quote:
Originally Posted by Twizted
Are you using ZCMD? If so, you can simply add this:
pawn Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(!success) return SendClientMessage(playerid, 0xAA3333AA, "[ERROR] {FFFFFF}El comando no existe!"); }
|
warning 209: function "OnPlayerCommandPerformed" should return a value
But if I add "return 1;" the problem comes back :S
Re: Command succeed but not. -
Konstantinos - 06.11.2013
If you return 0 in a command, it will send that message.
Post a command that displays the "SERVER: Unknown command." message.
Re: Command succeed but not. -
Sublime - 06.11.2013
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if (!success)
{
return SendClientMessage(playerid, -1, "Wrong command");
}
return 0;
}
Respuesta: Re: Command succeed but not. -
davazi7 - 06.11.2013
Quote:
Originally Posted by Sublime
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if (!success) { return SendClientMessage(playerid, -1, "Wrong command"); } return 0; }
|
No.. This way I get the native error "Server: Unknown Command."
Quote:
Originally Posted by Konstantinos
If you return 0 in a command, it will send that message.
Post a command that displays the "SERVER: Unknown command." message.
|
Код:
zcmd(rsinuso, playerid, params[])
{
if(PlayerInfo[playerid][AdminMC] < 5) Message(playerid, COLOR_GRAD2, "ЎNo autorizado!");
if(AdminDuty[playerid] != 1 ) return Message(playerid, COLOR_GRAD2, "ЎNo estбs administrando!");
else
GlobalMsg(COLOR_GREEN, "Todos los vehнculos sin uso fueron respawneados.");
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
RespawnVehicle(i);
}
}
return 1;
}
forward IsVehicleOccupied(vehicleid);
public IsVehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
Respuesta: Command succeed but not. -
davazi7 - 09.11.2013
Help, pls