YCMD Question - 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 Question (
/showthread.php?tid=650520)
YCMD Question -
C0oL3r - 01.03.2018
How can i make to don't let the player to spam an command in this:
Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
switch(success)
{
case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!");
}
return COMMAND_OK;
}
like to spam only 2 times in a second like that:

i can't spam more than 2 times in a second
Re: YCMD Question -
RxErT - 01.03.2018
SetTimerEx:
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: YCMD Question -
C0oL3r - 01.03.2018
What to do with settimerex

?? i want to return the command, to don't work if was spammed like in the photo, on my server i can spam the command like 6-7 times on a second
Re: YCMD Question -
RxErT - 01.03.2018
Quote:
Originally Posted by C0oL3r
What to do with settimerex  ?? i want to return the command, to don't work if was spammed like in the photo, on my server i can spam the command like 6-7 times on a second
|
Or take a look at this:
http://forum.sa-mp.com/showpost.php?...93&postcount=6
It's using ZCMD but it's ok you know how to edit it.
Re: YCMD Question -
C0oL3r - 01.03.2018
i can't return 1, i can return COMMAND_OK but it will send the message of the command
or
Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if(lastcommand[playerid] != 0 && gettime()-lastcommand[playerid] < 3)
{
SCM(playerid, COLOR_WHITE, "Calm down!");
return COMMAND_ZERO_RET;
}
switch(success)
{
case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!");
case COMMAND_OK: lastcommand[playerid] = gettime();
}
return COMMAND_OK;
}
but COMMAND_ZERO_RET it will send "Unknown Command" in chat
Re: YCMD Question -
C0oL3r - 01.03.2018
What i need to return to don't send the command, and not Unknown command?
Re: YCMD Question -
RxErT - 01.03.2018
Quote:
Originally Posted by C0oL3r
What i need to return to don't send the command, and not Unknown command?
|
As I know, it's COMMAND_OK
btw, why don't you try using IZCMD or ZCMD?
Re: YCMD Question -
C0oL3r - 01.03.2018
because ycmd is faster and it's good if i have much commands.
And with COMMAND_OK it's not working because it's still running the command and send the messages.
Код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if(lastcommand[playerid] != 0 && gettime()-lastcommand[playerid] < 1)
{
return COMMAND_OK;
}
switch(success)
{
case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!");
case COMMAND_OK: lastcommand[playerid] = gettime();
}
return COMMAND_OK;
}
i did something wrong?
Re: YCMD Question -
Dayrion - 01.03.2018
I never used YCMD but let's be logic.
PHP код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playerid, cmdtext[], e_COMMAND_ERRORS:success)
{
if(lastcommand[playerid] != 0 && gettime()-lastcommand[playerid] < 2)
{
SCM(playerid, 0xFF0000FF, "Don't spam commands.");
return COMMAND_OK;
}
switch(success)
{
case COMMAND_UNDEFINED: SCM(playerid, COLOR_WHITE, "ERROR: That command doesn't exists. Type /help!");
}
lastcommand[playerid] = gettime();
return COMMAND_OK;
}
Re: YCMD Question -
C0oL3r - 01.03.2018

that's what i said, it's sending the message to don't spam but the command is still running