SA-MP Forums Archive
YCMD problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: YCMD problem (/showthread.php?tid=651499)



YCMD problem - C0oL3r - 21.03.2018

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;
}



Re: YCMD problem - CKA3KuH - 12.02.2019

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.


Re: YCMD problem - ComDuck - 13.02.2019

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?


Re: YCMD problem - CKA3KuH - 05.03.2019

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;
}