YCMD problem
#1

why it's returning me "Unknown command" when i spam? i tryed with return COMMAND_ZERO_RET, COMMAND_OK also and still not working..

Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success) 
{  
	if(GetPVarInt(playerid, "LastCMDTime") != 0 && gettime()-GetPVarInt(playerid, "LastCMDTime") < 1)
	{
		return COMMAND_DENIED;
	}

	if(svRestarting <= 60 && IsSvRestarting)
	{
	    SS(playerid, COLOR_GREY, RestartingMSG, RestartingMSGEN);
	    return COMMAND_DENIED;
	}

	switch(success) 
	{ 
	    case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!"); 
	}
	SetPVarInt(playerid, "LastCMDTime", gettime());
	return COMMAND_OK;
}
Reply
#2

Hello everybody.
Have the same problem SERVER: Unknown command. when I try to wrap COMMAND_OK and return COMMAND_DENIED instead of.

Maybe someone have a solution for fixing it?
Thanks.
Reply
#3

Quote:
Originally Posted by CKA3KuH
Посмотреть сообщение
Hello everybody.
Have the same problem SERVER: Unknown command. when I try to wrap COMMAND_OK and return COMMAND_DENIED instead of.

Maybe someone have a solution for fixing it?
Thanks.
Why bump a year old thread? Do you have the same code as OP line-to-line, word-by-word?
Reply
#4

Hello ******,

Thanks for your help.
I've tried different returns in the OnPlayerCommandReceived callback, but anyone doesn't help me. I still receive SERVER: Unknown command after the handled error:
Quote:

Cmd executing is forbidden when Dialog is opened.
SERVER: Unknown command



I have no idea what I missed...

There is my public below:

Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
	if(pData[playerid][pCmdFlood] - GetTickCount() > 0) return COMMAND_DENIED;
	pData[playerid][pCmdFlood] = GetTickCount() + ANTI_FLOOD_TIME;
	
	if(!gPlayerLogged[playerid]
	|| gPlayerNeedPassChange[playerid]
	|| pData[playerid][pBlocked] > 0) return COMMAND_DENIED;

	if(pTemp[playerid][pDialog])
	{
		SendClientMessageEx(playerid, CGREY, "Cmd executing is forbidden when Dialog is opened.");
		return COMMAND_DENIED;
	}

	switch (success)
	{
		case COMMAND_ZERO_RET: return COMMAND_ZERO_RET;
		case COMMAND_OK: WriteMysqlLog(playerid, LogTypeOnPlayerCommandReceived, cmdtext);
		case COMMAND_UNDEFINED, COMMAND_HIDDEN, COMMAND_DISABLED, COMMAND_BAD_PREFIX:
		{
			SendClientMessageEx(playerid, CGREY, "No such command.");
			return COMMAND_OK;
		}
		case COMMAND_DENIED: return COMMAND_DENIED;
		case COMMAND_NO_PLAYER: return COMMAND_NO_PLAYER;
		case COMMAND_INVALID_INPUT: return COMMAND_INVALID_INPUT;
	}

	return COMMAND_OK;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)