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=651230)
YCMD Problem -
C0oL3r - 16.03.2018
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".
Re: YCMD Problem -
iKarim - 16.03.2018
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.
Re: YCMD Problem -
C0oL3r - 16.03.2018
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;
}
}
}