YCMD Problem
#1

i have that code:
Код:
	if(GetPVarInt(playerid, "LastCMDTime") != 0 && gettime()-GetPVarInt(playerid, "LastCMDTime") < 2)
	{
		return COMMAND_ZERO_RET;
	}
	else
	{
		SetPVarInt(playerid, "LastCMDTime", gettime());
	    switch(success) 
	    { 
	        case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!"); 
	    }
	    if(svRestarting <= 60 && IsSvRestarting)
	    {
	    	SS(playerid, COLOR_GREY, RestartingMSG, RestartingMSGEN);
	    	return COMMAND_ZERO_RET;
	    }
	    else
	    {
	    	return COMMAND_OK;
	   	}
    }
and every time i spam a command, it's not cancelling the command, it's sending me "Unknown Command".
Reply
#2

Because you are returning 0 (COMMAND_ZERO_RET) thus the default unknown message appears, you can replace that with COMMAND_OK instead to show nothing.
Reply
#3

If i put COMMAND_OK it will still run the command

Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success) 
{  
	if(GetPVarInt(playerid, "LastCMDTime") != 0 && gettime()-GetPVarInt(playerid, "LastCMDTime") < 2)
	{
		SCM(playerid, COLOR_WHITE, "Stop Spamming! Your command it will not run.");
		return COMMAND_OK;
	}
	else
	{
		SetPVarInt(playerid, "LastCMDTime", gettime());
	    switch(success) 
	    { 
	        case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!"); 
	    }
	    if(svRestarting <= 60 && IsSvRestarting)
	    {
	    	SS(playerid, COLOR_GREY, RestartingMSG, RestartingMSGEN);
	    	return COMMAND_OK;
	    }
	    else
	    {
	    	return COMMAND_OK;
	   	}
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)