SA-MP Forums Archive
How can I add a delay to my kick? - 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: How can I add a delay to my kick? (/showthread.php?tid=442487)



How can I add a delay to my kick? - lramos15 - 07.06.2013

I need them to be able to see the message
pawn Код:
CMD:kick(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    new string[128],
        pname[MAX_PLAYER_NAME],
        victimname[MAX_PLAYER_NAME],
        victimid,
        reason[30];
    if(PlayerInfo[playerid][pAdmin] > 3)
    {
       if(sscanf(params, "us[30]", victimid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [playerid/name] [reason]");
       GetPlayerName(playerid, pname, sizeof(pname));
       GetPlayerName(victimid, victimname, sizeof(victimname));
       if(!IsPlayerConnected(victimid)) return SendClientMessage(playerid, COLOR_RED, "Error: This player is not connected.");
       format(string, 128, "AdminCmd: %s has kicked %s. Reason:%s!",pname,victimname,reason);
       SendClientMessageToAll(COLOR_RED, string);

    }
    else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 3 or higher to use this command!");
    return 1;
}



Re: How can I add a delay to my kick? - Facerafter - 07.06.2013

pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
 
stock KickWithMessage(playerid)
{
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);   //Delay of 1 second before kicking the player so he recieves the message
}
After SendClientMessageToAll you can now use KickWithMessage(playerid)


Re: How can I add a delay to my kick? - Red_Dragon. - 07.06.2013

I suggest using this include https://sampforum.blast.hk/showthread.php?tid=441968


Re: How can I add a delay to my kick? - DobbysGamertag - 07.06.2013

Why not do it this way?

pawn Код:
CMD:kick(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    new string[128],
    pname[MAX_PLAYER_NAME],
    victimname[MAX_PLAYER_NAME],
    victimid,
    reason[30];
    if(PlayerInfo[playerid][pAdmin] > 3)
    {
        if(sscanf(params, "us[30]", victimid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [playerid/name] [reason]");
        GetPlayerName(playerid, pname, sizeof(pname));
        GetPlayerName(victimid, victimname, sizeof(victimname));
        if(!IsPlayerConnected(victimid)) return SendClientMessage(playerid, COLOR_RED, "Error: This player is not connected.");
        format(string, 128, "AdminCmd: %s has kicked %s. Reason:%s!",pname,victimname,reason);
        SendClientMessageToAll(COLOR_RED, string);
        SetTimerEx("kick",1000,false,"i",victimid);
    }
    else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 3 or higher to use this command!");
    return 1;
}

forward kick(victimid);
public kick(victimid)
{
    Kick(victimid);
    return 1;
}
Edited so feel free to try again.


Re: How can I add a delay to my kick? - CrazyChoco - 07.06.2013

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
That's actually the easiest way.


Re: How can I add a delay to my kick? - lramos15 - 07.06.2013

Dobby i type that and it doesnt kick them


Re: How can I add a delay to my kick? - lramos15 - 07.06.2013

Dobby i type that and it doesnt kick them


Re: How can I add a delay to my kick? - Guest123 - 08.06.2013

pawn Код:
CMD:kick(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    new string[128],
    pname[MAX_PLAYER_NAME],
    victimname[MAX_PLAYER_NAME],
    victimid,
    reason[30];
    if(PlayerInfo[playerid][pAdmin] > 3)
    {
        if(sscanf(params, "us[30]", victimid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [playerid/name] [reason]");
        GetPlayerName(playerid, pname, sizeof(pname));
        GetPlayerName(victimid, victimname, sizeof(victimname));
        if(!IsPlayerConnected(victimid)) return SendClientMessage(playerid, COLOR_RED, "Error: This player is not connected.");
        format(string, 128, "AdminCmd: %s has kicked %s. Reason:%s!",pname,victimname,reason);
        SendClientMessageToAll(COLOR_RED, string);
        SetTimerEx("KickPlayer",1000,false,"i",victimid);//this is already target to victim
    }
    else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 3 or higher to use this command!");
    return 1;
}

forward KickPlayer(playerid);
public KickPlayer(playerid)
{
    Kick(playerid);//after they got target, they kicked
    return 1;
}