BanEx Timer
#1

Would anyone mind showing me how I can set a timer to my ban command?
I'm not to good with timers, or scripting for the most part.

Код:
CMD:ban(playerid, params[])
{
	LoginCheck(playerid);
	LevelCheck(playerid, 3);

    new
        Float:x,
		Float:y,
		Float:z,
		string[128],
		id,
		type,
		reason[256]
	;

    if(sscanf(params, "uiS(No Reason)[256]", id, type, reason)) return SendUsage(playerid, "/ban <PlayerID> <Type(0-Ban|1-Silent Ban)> <Reason>", "Will ban the specified player, a log of this ban will be created");
	if(id == INVALID_PLAYER_ID) return SendError(playerid, "Player is not connected.");
	if(id == playerid) return SendError(playerid, "Banning youself?!, Are you nuts!!!");
	if(pInfo[playerid][Admin] < pInfo[id][Admin]) return SendError(playerid, "You cannot use this command on a higher level administrator.");
    ClearChatB(id, 100);
	SendAdm(playerid, "BAN");
    switch(type)
    {
        case 0:
        {
            PlayerPlaySound(playerid, 1140, 0.0, 0.0, 0.0);
			PlayerPlaySound(id, 1140, 0.0, 0.0, 0.0);
			format(string, sizeof(string), "{AFAFAF}%s{FF6347} has been banned by [ADMIN] {AFAFAF}%s{FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), GetName(playerid), reason);
		    SendClientMessageToAll(COLOR_CHAT, string);
		    printf(string);
			format(string, sizeof string, "[ADMIN] {AFAFAF}%s{FF6347} has banned {AFAFAF}%s's{FF6347} IP, IP: {AFAFAF}%s{FF6347}", GetName(playerid), GetName(id), getIP(id));
			SaveLog("banlog", string);
			format(string, sizeof(string), "You have banned {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, reason);
		    SendClientMessage(playerid, COLOR_CHAT, string);
		    format(string, sizeof(string), "You have been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(playerid), playerid, reason);
		    SendClientMessage(id, COLOR_CHAT, string);
            GetPlayerPos(id, x, y, z);
    		SetPlayerPos(id, x, y, z+3000);
    		//CreateExplosion(x, y, z, 7, 3000.0);
			SetPVarInt(id, "j_Frozen", 1);
			pInfo[id][Frozen] = 1;
			TogglePlayerControllable(id, false);
            GivePlayerWeapon(id,WEAPON_DILDO,1);
            BanEx(id, reason);
   			KickDelay(id);
			
            
      		}
		case 1:
		{
		    //PlayerPlaySound(playerid, 1140, 0.0, 0.0, 0.0);
			PlayerPlaySound(id, 1140, 0.0, 0.0, 0.0);
			//format(string, sizeof(string), "{AFAFAF}%s (ID: %d){FF6347} has been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, GetName(playerid), playerid, reason);
		    //SendClientMessageToAll(COLOR_CHAT, string);
		    //printf(string);
			//format(string, sizeof string, "[ADMIN] {AFAFAF}%s{FF6347} has banned {AFAFAF}%s's{FF6347} IP, IP: {AFAFAF}%s{FF6347}", GetName(playerid), GetName(id), getIP(id));
			SaveLog("banlog", string);
			format(string, sizeof(string), "You have silently banned {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, reason);
		    SendClientMessage(playerid, COLOR_CHAT, string);
		    format(string, sizeof(string), "You have been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(playerid), playerid, reason);
		    SendClientMessage(id, COLOR_CHAT, string);
            GetPlayerPos(id, x, y, z);
    		SetPlayerPos(id, x, y, z+3000);
    		//CreateExplosion(x, y, z, 7, 3000.0);
			SetPVarInt(id, "j_Frozen", 1);
			pInfo[id][Frozen] = 1;
			TogglePlayerControllable(id, false);
			GivePlayerWeapon(id, WEAPON_DILDO,1);
			BanEx(id, reason);
		    KickDelay(id);

		}
	}
	return 1;
Reply
#2

pawn Код:
SetTimerEx("BanDelay", time, 0, "i", id); //put your time in MS.

forward BanDelay(playerid);
public BanDelay(playerid)
{
    Ban(playerid);
    return 1;
}
Reply
#3

Where would I set this in the filterscript? Under it? Bash me if you want I haven't learned much yet.
Reply
#4

For the forward thing you can place it anywhere you want, ( But not in the middle of a command for sure ). And to set timer of the ban.
pawn Код:
CMD:ban(playerid, params[])
{
    LoginCheck(playerid);
    LevelCheck(playerid, 3);

    new
        Float:x,
        Float:y,
        Float:z,
        string[128],
        id,
        type,
        reason[256]
    ;

    if(sscanf(params, "uiS(No Reason)[256]", id, type, reason)) return SendUsage(playerid, "/ban <PlayerID> <Type(0-Ban|1-Silent Ban)> <Reason>", "Will ban the specified player, a log of this ban will be created");
    if(id == INVALID_PLAYER_ID) return SendError(playerid, "Player is not connected.");
    if(id == playerid) return SendError(playerid, "Banning youself?!, Are you nuts!!!");
    if(pInfo[playerid][Admin] < pInfo[id][Admin]) return SendError(playerid, "You cannot use this command on a higher level administrator.");
    ClearChatB(id, 100);
    SendAdm(playerid, "BAN");
    switch(type)
    {
        case 0:
        {
            PlayerPlaySound(playerid, 1140, 0.0, 0.0, 0.0);
            PlayerPlaySound(id, 1140, 0.0, 0.0, 0.0);
            format(string, sizeof(string), "{AFAFAF}%s{FF6347} has been banned by [ADMIN] {AFAFAF}%s{FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), GetName(playerid), reason);
            SendClientMessageToAll(COLOR_CHAT, string);
            printf(string);
            format(string, sizeof string, "[ADMIN] {AFAFAF}%s{FF6347} has banned {AFAFAF}%s's{FF6347} IP, IP: {AFAFAF}%s{FF6347}", GetName(playerid), GetName(id), getIP(id));
            SaveLog("banlog", string);
            format(string, sizeof(string), "You have banned {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, reason);
            SendClientMessage(playerid, COLOR_CHAT, string);
            format(string, sizeof(string), "You have been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(playerid), playerid, reason);
            SendClientMessage(id, COLOR_CHAT, string);
            GetPlayerPos(id, x, y, z);
            SetPlayerPos(id, x, y, z+3000);
            //CreateExplosion(x, y, z, 7, 3000.0);
            SetPVarInt(id, "j_Frozen", 1);
            pInfo[id][Frozen] = 1;
            TogglePlayerControllable(id, false);
            GivePlayerWeapon(id,WEAPON_DILDO,1);
            SetTimerEx("BanDelay", 100, false, "i", id);
            KickDelay(id);
           
           
            }
        case 1:
        {
            //PlayerPlaySound(playerid, 1140, 0.0, 0.0, 0.0);
            PlayerPlaySound(id, 1140, 0.0, 0.0, 0.0);
            //format(string, sizeof(string), "{AFAFAF}%s (ID: %d){FF6347} has been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, GetName(playerid), playerid, reason);
            //SendClientMessageToAll(COLOR_CHAT, string);
            //printf(string);
            //format(string, sizeof string, "[ADMIN] {AFAFAF}%s{FF6347} has banned {AFAFAF}%s's{FF6347} IP, IP: {AFAFAF}%s{FF6347}", GetName(playerid), GetName(id), getIP(id));
            SaveLog("banlog", string);
            format(string, sizeof(string), "You have silently banned {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, reason);
            SendClientMessage(playerid, COLOR_CHAT, string);
            format(string, sizeof(string), "You have been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(playerid), playerid, reason);
            SendClientMessage(id, COLOR_CHAT, string);
            GetPlayerPos(id, x, y, z);
            SetPlayerPos(id, x, y, z+3000);
            //CreateExplosion(x, y, z, 7, 3000.0);
            SetPVarInt(id, "j_Frozen", 1);
            pInfo[id][Frozen] = 1;
            TogglePlayerControllable(id, false);
            GivePlayerWeapon(id, WEAPON_DILDO,1);
            SetTimerEx("BanDelay", 100, false, "i", id);
            KickDelay(id);

        }
    }
    return 1;
Reply
#5

Dude, thanks. I added them compiled them without errors and tested them. Worked 100% Rep man. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)