Command succeed but not.
#1

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!
Reply
#2

Код:
#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;
}
Reply
#3

No, the same problem :S
Reply
#4

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!");
}
Reply
#5

Or remove the "return 1" from the command which gives that "Unknown Command" warning.
Reply
#6

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
Reply
#7

If you return 0 in a command, it will send that message.

Post a command that displays the "SERVER: Unknown command." message.
Reply
#8

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if (!success)
    {
        return SendClientMessage(playerid, -1, "Wrong command");
    }
    return 0;
}
Reply
#9

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;
	}
Reply
#10

Help, pls
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)