Kick delay and message not working.
#2

PHP Code:
CMD:kick(playeridparams[])
{
    if(
pInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridWHITE"Server: Unknown command.");
    new 
stringadm[144];
    new 
str[144], idreason[144];
    if(
pInfo[playerid][pLogin] == 0) return SendClientMessage(playeridRED"Register or Login first before using this command!");
    if(
pInfo[playerid][pAdmin] >= 1)
    {
        if(
sscanf(params"us[30]"idreason)) return SendClientMessage(playeridRED"USAGE: /kick [id] [reason]");
        if (
pInfo[id][pAdmin] > pInfo[playerid][pAdmin]) return SendClientMessage(playeridRED"ERROR: You cannot Kick Admins who are a higher Rank than you.");
        if(
id == INVALID_PLAYER_ID) return SendClientMessage(playeridRED"ERROR: Invalid ID!");
        if(
id == playerid) return SendClientMessage(playeridRED"You cannot kick yourself!");
        
format(strsizeof(str), "%s (%d) has been kicked by %s (%d) | Reason: %s"GetName(id), idGetName(playerid), playeridreason);
        
SendClientMessageToAll(REDstr); // informs all players somebody has been kicked.
        
format(strsizeof(str), "You have kicked %s (%d) | Reason: %s"GetName(id), idreason);
        
SendClientMessage(playeridREDstr); // Informs the staff who kicked, they've kicked someone
        
        
format(strsizeof(str), "%s (%d) kicked you | Reason: %s"GetName(playerid), idreason);
        
SendClientMessage(idREDstr); // informs the kicked person they've been kicked.
        
SetTimerEx("kickdelays"3000false"i"id); // delay the kick
        
        
format(stringadm,sizeof(stringadm),"[ADM]: %s used /kick",GetName(playerid));
        
SendToAdmin(COLOR_ADM,stringadm);
    }
    else return 
SendClientMessage(playeridWHITE"Server: Unknown command.");
    return 
1;

You had a Kick(id); after the timer, that's why you didn't get the message or the timer worked because you kick it instantly. You had 2 kicks to the same player, one instantly and one 3 seconds. That's why it didn't work well. I removed the Kick(id) and ordered the timer after the message. As a suggestion, I would put half a second or a maximum of 1 second. 3 seconds seems very long to me. Maybe the player will do something in those 3 seconds.
PD: Why do you have a forward ''KickTimer''? According to your code, you don't use it
Reply


Messages In This Thread
Kick delay and message not working. - by TheLittleFucker - 02.06.2020, 10:50
Re: Kick delay and message not working. - by Ertouq - 02.06.2020, 11:04
Re: Kick delay and message not working. - by SharpenBlade - 02.06.2020, 11:05

Forum Jump:


Users browsing this thread: 1 Guest(s)