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

?? 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
|
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 |
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;
}
|
What i need to return to don't send the command, and not Unknown command?
|
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;
}
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;
}
that's what i said, it's sending the message to don't spam but the command is still running