[MAKE] Temp ban and Temp mute.
#1

can someone please make a temp ban and an temp mute for me? please!

i have searced but ill dont find anythig. Sorry but im not good at scripting... so =/
ill really appricate if someone make this for me, and OFC you will be in the /credits

/tempban <days> <reason>
/tempmute <minutes> <reason>


Copy and paste please :P
Reply
#2

Bump, I really need this ^^
Reply
#3

Why can't you ever post in the Script request topic?

You can find tempban in most of the good admin filterscripts, use that to script a tempmute.
Reply
#4

Stop requesting for people to do stuff for you. Lrn2code.
Reply
#5

Quote:
Originally Posted by JamesC
Посмотреть сообщение
Why can't you ever post in the Script request topic?

You can find tempban in most of the good admin filterscripts, use that to script a tempmute.
Where is the script Request topic?


Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
Stop requesting for people to do stuff for you. Lrn2code.
Yes im trying to Lrn2code... But this is to hard for me
Reply
#6

Hm.. Have you tried this?

https://sampforum.blast.hk/showthread.php?tid=164359
Reply
#7

I found a tempban system on another post so i edited it for zcmd and sscanf2. I havn't tested it so it might not work lol i cant test atm. Its from seif admin script. Hope it works for you.
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define RED             0xE60000FF
#define ORANGE          0xF97804FF
#define ADMIN_RED       0xFB0000FF

public OnFilterScriptInit()
{
    if (!fexist("TempBans.ban"))
    {
        new File:open = fopen("TempBans.ban",io_write);
        if (open) fclose(open);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    TempBanCheck(playerid);
    return 1;
}

COMMAND:tempban(playerid, params[])
{
    if (IsPlayerAdmin(playerid))
    {
        new
            numdays,
            giveplayerid,
            string[128],
            reason[100];
        if(sscanf(params, "uds[100]", giveplayerid, numdays, reason))
        {
            SendClientMessage(playerid, ORANGE, "USAGE: /tempban [name/id] [day] [reason]");
            SendClientMessage(playerid, ORANGE, "FUNCTION: Temporarily bans a player. You must enter the month, day and hour numbers. You set them, not add.");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid))
        {
            new
                ip[15];
            GetPlayerIp(giveplayerid, ip, 15);
            new File:tempban = fopen("TempBans.ban", io_append);
            if (tempban)
            {
                new year,month,day;
                getdate(year, month, day);
                day += numdays;
                if (IsMonth31(month))
                {
                    if (day > 31)
                    {
                        month += 1;
                        if (month > 12)
                        {
                            year += 1;
                            while(day > 31) day -= 31;
                        }
                        else while(day > 31) day -= 31;
                    }
                }
                else if (!IsMonth31(month))
                {
                    if (day > 30)
                    {
                        month += 1;
                        if (month > 12)
                        {
                            year += 1;
                            while(day > 30) day -= 30;
                        }
                        else while(day > 30) day -= 30;
                    }
                }
                else if (!IsMonth31(month) && IsMonth29(year) && month == 2)
                {
                    if (day > 29)
                    {
                        month += 1;
                        if (month > 12)
                        {
                            year += 1;
                            while(day > 29) day -= 29;
                        }
                        else while(day > 29) day -= 29;
                    }
                }
                else if (!IsMonth31(month) && !IsMonth29(year) && month == 2)
                {
                    if (day > 28)
                    {
                        month += 1;
                        if (month > 12)
                        {
                            year += 1;
                            while(day > 28) day -= 28;
                        }
                        else while(day > 28) day -= 28;
                    }
                }
                format(string, sizeof string, "%d|%d|%d|%s\n", day, month, year, ip);
                fwrite(tempban, string);
                fclose(tempban);
            }
            format(string,128,"|- Administrator %s temporarily banned %s for %d day(s). [Reason: %s] -|",playername(playerid),playername(giveplayerid),numdays,reason);
            SendClientMessageToAll(ADMIN_RED,string);
            Kick(giveplayerid);
        }
        else SendClientMessage(playerid, RED, "Player not found!");
    }
    else SendClientMessage(playerid, RED, "You are not an admin.");
    return true;
}

stock IsMonth31(month)
{
    switch (month)
    {
        case 1: return 1;
        case 3: return 1;
        case 5: return 1;
        case 7: return 1;
        case 8: return 1;
        case 10: return 1;
        case 12: return 1;
        default: return 0;
    }
    return 0;
}

stock IsMonth29(year)
{
    new y = 2000;
    for(new i = 4; i < 3000; i += 4) if ((y+i) == year) return 1;
    return 0;
}

stock TempBanCheck(playerid)
{
    new ip[15];
    new str[128];
    new load[4][32];
    new ban_day, ban_month, ban_year, ban_ip[15];
    GetPlayerIp(playerid, ip, sizeof ip);
    new year, month, day;
    getdate(year, month, day);
    new File:file = fopen("TempBans.ban",io_read);
    if (file)
    {
        while (fread(file, str, sizeof str))
        {
            split(str, load, '|');

            ban_day = strval(load[0]);
            ban_month = strval(load[1]);
            ban_year = strval(load[2]);
            strmid(ban_ip, load[3], 0, strlen(load[3])-1, 15);
            if (!(year >= ban_year && month >= ban_month && day >= ban_day && !strcmp(ban_ip, ip, true)))
            {
                format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d -|", ban_day, ban_month, ban_year);
                SendClientMessage(playerid, ADMIN_RED, str);
                return Kick(playerid);
            }
        }
    }
    return true;
}

stock split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;

    while(i <= strlen(strsrc)){
        if(strsrc[i]==delimiter || i==strlen(strsrc)){
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}

playername(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
EDIT: And this should work for /tempmute (not tested)
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new bool:istempmuted[MAX_PLAYERS];

forward TempMute(playerid);
public OnPlayerText(playerid, text[])
{
    if(istempmuted[playerid])
    {
        SendClientMessage(playerid, 0xff0000FF, "You are muted");
        return 0;
    }
    return 1;
}

COMMAND:tempmute(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    else
    {
        new
            id,
            seconds;
        if(sscanf(params,"ud", id, seconds))return SendClientMessage(playerid, 0xff0000FF, "ERROR: Usage /tempmute [name/id][seconds]");
        if(IsPlayerConnected(id))
        {
            istempmuted[id] = true;
            SetTimerEx("TempMute", seconds * 1000,false, "i", id);
            return 1;
        }
        else SendClientMessage(playerid, 0xff0000FF, "ERROR: Player not found!");
    }
    return 1;
}

COMMAND:unmute(playerid, params[])
{
    new
        id;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xff0000FF, "ERROR: Usage /unmute [name/id]");
    if(IsPlayerConnected(id))
    {
        istempmuted[playerid] = false;
        return 1;
    }
    else SendClientMessage(playerid, 0xff0000FF, "ERROR: Player not found!");
    return 1;
}

public TempMute(playerid)
{
    istempmuted[playerid] = false;
    SendClientMessage(playerid, 0xff0000FF, "You have been unmuted");
}
Reply
#8

@ Temp Ban = ERROR: Server Unknown Command
@ Temp Mute = ERROR: Server Unknown Command

Something is wrong
Reply
#9

Shit i forgot to tell tou if your not rcon admin it will return unknown command. You will need to change that to your prefference. Login as rcon and it'll work. I also forgot to put admin check on the unmute command you can add that yourself.
Reply
#10

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Shit i forgot to tell tou if your not rcon admin it will return unknown command. You will need to change that to your prefference. Login as rcon and it'll work.
i have logged in as rcon, but dont work
Reply


Forum Jump:


Users browsing this thread: