SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 02/12/2010, 04:01 PM   #1
Larsey123IsMe
Guest
 
Posts: n/a
Default [MAKE] Temp ban and Temp mute.

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
 
Old 03/12/2010, 08:53 AM   #2
Larsey123IsMe
Guest
 
Posts: n/a
Default Re: [MAKE] Temp ban and Temp mute.

Bump, I really need this ^^
 
Old 03/12/2010, 09:58 AM   #3
JamesC
Huge Clucker
 
JamesC's Avatar
 
Join Date: Jul 2010
Location: New Zealand
Posts: 242
Reputation: 31
Default Re: [MAKE] Temp ban and Temp mute.

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.
__________________


JamesC is offline  
Old 03/12/2010, 10:16 AM   #4
WillyP
High-roller
 
WillyP's Avatar
 
Join Date: Jul 2010
Location: Durham, England
Posts: 2,232
Reputation: 63
Default Re: [MAKE] Temp ban and Temp mute.

Stop requesting for people to do stuff for you. Lrn2code.
WillyP is offline  
Old 03/12/2010, 11:18 AM   #5
Larsey123IsMe
Guest
 
Posts: n/a
Default Re: [MAKE] Temp ban and Temp mute.

Quote:
Originally Posted by JamesC View Post
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 View Post
Stop requesting for people to do stuff for you. Lrn2code.
Yes im trying to Lrn2code... But this is to hard for me
 
Old 03/12/2010, 11:21 AM   #6
DevilG
Big Clucker
 
Join Date: May 2010
Posts: 86
Reputation: 0
Default Re: [MAKE] Temp ban and Temp mute.

Hm.. Have you tried this?

http://forum.sa-mp.com/showthread.php?t=164359
DevilG is offline  
Old 03/12/2010, 11:36 AM   #7
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,383
Reputation: 235
Default Re: [MAKE] Temp ban and Temp mute.

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 Code:
#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 Code:
#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");
}
__________________
Quote:
Originally Posted by Y_Less
That code compiles perfectly, but I can tell you now it won't make me a cup of tea.
"No offense, but you are a stupid asshole." - Ron Burgundy

Last edited by iggy1; 03/12/2010 at 01:51 PM. Reason: Had one to many semi colons
iggy1 is offline  
Old 03/12/2010, 02:05 PM   #8
Larsey123IsMe
Guest
 
Posts: n/a
Default Re: [MAKE] Temp ban and Temp mute.

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

Something is wrong
 
Old 03/12/2010, 02:08 PM   #9
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,383
Reputation: 235
Default Re: [MAKE] Temp ban and Temp mute.

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.
__________________
Quote:
Originally Posted by Y_Less
That code compiles perfectly, but I can tell you now it won't make me a cup of tea.
"No offense, but you are a stupid asshole." - Ron Burgundy
iggy1 is offline  
Old 03/12/2010, 02:10 PM   #10
Larsey123IsMe
Guest
 
Posts: n/a
Default Re: [MAKE] Temp ban and Temp mute.

Quote:
Originally Posted by iggy1 View Post
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
 
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
temp ban problem The_Gangstas Help Archive 1 27/11/2010 12:37 PM
Temp. Ban VonLeeuwen Help Archive 4 24/08/2010 10:26 AM
[Ajuda]Temp Ban Guerek Português/Portuguese 3 17/07/2010 04:29 AM
help with Temp ban BombaNick Help Archive 2 26/09/2009 06:09 AM
Temp Ban for LAdmin? _Vortex Help Archive 0 15/08/2009 10:11 PM


All times are GMT. The time now is 06:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.