Raised This Month: $ Target: $400
 0% 

Ban snapshot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
numbmlg
New Member
Join Date: Nov 2009
Old 01-27-2010 , 15:59   Ban snapshot
Reply With Quote #1

It is part of amxcmd, I want to add snapshot, but I do not understand where the error occurred.

Code:
public cmdBan(id, level, cid)
{
    if (!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED

    new target[32], minutes[8], reason[64]
    
    read_argv(1, target, 31)
    read_argv(2, minutes, 7)
    read_argv(3, reason, 63)
    
    new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
    
    if (!player)
        return PLUGIN_HANDLED

    new authid[32], name2[32], authid2[32], name[32], ipadd[32], hostname[64], CurrentTime[9]
    new userid2 = get_user_userid(player)

    get_user_authid(player, authid2, 31)
    get_user_authid(id, authid, 31)
    get_user_name(player, name2, 31)
    get_user_name(id, name, 31)
    get_user_ip(player,ipadd,31)
    get_cvar_string("hostname",hostname,63)

    client_print(player, print_chat, "[Banned] %s",hostname)
    client_print(player, print_chat, "[Banned] %s [Steamid] %s @ IP - %s", userid2, authid2, ipadd) 
    get_time("%m/%d/%Y - %H:%M:%S", CurrentTime, 31)
    client_print(player, print_chat, "[Banned] %s", CurrentTime)
    client_cmd(player, "wait;wait;snapshot;wait;snapshot")
    
    log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
    
    new temp[64], banned[16], nNum = str_to_num(minutes)
    if (nNum)
        format(temp, 63, "%L", player, "FOR_MIN", minutes)
    else
        format(temp, 63, "%L", player, "PERM")

    format(banned, 15, "%L", player, "BANNED")

    if (reason[0])
        server_cmd("kick #%d ^"%s (%s %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, reason, banned, temp, minutes, authid2)
    else
        server_cmd("kick #%d ^"%s %s^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, banned, temp, minutes, authid2)

    
    // Display the message to all clients

    new msg[256];
    new len;
    new maxpl = get_maxplayers();
    for (new i = 1; i <= maxpl; i++)
    {
        if (is_user_connected(i) && !is_user_bot(i))
        {
            len = formatex(msg, charsmax(msg), "%L", i, "BAN");
            len += formatex(msg[len], charsmax(msg) - len, " %s ", name2);
            if (nNum)
            {
                formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes);
            }
            else
            {
                formatex(msg[len], charsmax(msg) - len, "%L", i, "PERM");
            }
            if (strlen(reason) > 0)
            {
                formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "REASON", reason);
            }
            show_activity_id(i, id, name, msg);
        }
    }
    
    console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
    
    return PLUGIN_HANDLED
}

public cmdBanIP(id, level, cid)
{
    if (!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED
    
    new target[32], minutes[8], reason[64]
    
    read_argv(1, target, 31)
    read_argv(2, minutes, 7)
    read_argv(3, reason, 63)
    
    new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
    
    if (!player)
    {
        // why is this here?
        // no idea
        // player = cmd_target(id, target, 9);
        return PLUGIN_HANDLED
    }
    
    new authid[32], name2[32], authid2[32], name[32], ipadd[32], hostname[64], CurrentTime[9]
    new userid2 = get_user_userid(player)
    
    get_user_authid(player, authid2, 31)
    get_user_authid(id, authid, 31)
    get_user_name(player, name2, 31)
    get_user_name(id, name, 31)
    get_user_ip(player,ipadd,31)
    get_cvar_string("hostname",hostname,63)

    client_print(player, print_chat, "[Banned] %s",hostname)
    client_print(id, print_chat, "[Banned] %s [Steamid] %s @ IP - %s", userid2, authid2, ipadd) 
    get_time("%m/%d/%Y - %H:%M:%S", CurrentTime, 31)
    client_print(player, print_chat, "[Banned] %s", CurrentTime)
    client_cmd(player, "wait;wait;snapshot;wait;snapshot")
    
    log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)

    new temp[64], banned[16], nNum = str_to_num(minutes)
    if (nNum)
        format(temp, 63, "%L", player, "FOR_MIN", minutes)
    else
        format(temp, 63, "%L", player, "PERM")
    format(banned, 15, "%L", player, "BANNED")

    new address[32]
    get_user_ip(player, address, 31, 1)

    if (reason[0])
        server_cmd("kick #%d ^"%s (%s %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, reason, banned, temp, minutes, address)
    else
        server_cmd("kick #%d ^"%s %s^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, banned, temp, minutes, address)

    // Display the message to all clients

    new msg[256];
    new len;
    new maxpl = get_maxplayers();
    for (new i = 1; i <= maxpl; i++)
    {
        if (is_user_connected(i) && !is_user_bot(i))
        {
            len = formatex(msg, charsmax(msg), "%L", i, "BAN");
            len += formatex(msg[len], charsmax(msg) - len, " %s ", name2);
            if (nNum)
            {
                formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes);
            }
            else
            {
                formatex(msg[len], charsmax(msg) - len, "%L", i, "PERM");
            }
            if (strlen(reason) > 0)
            {
                formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "REASON", reason);
            }
            show_activity_id(i, id, name, msg);
        }
    }

    console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
    
    return PLUGIN_HANDLED
}
numbmlg is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 01-27-2010 , 16:21   Re: Ban snapshot
Reply With Quote #2

Did you get an error message with a specified line? o.o
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
numbmlg
New Member
Join Date: Nov 2009
Old 01-28-2010 , 07:36   Re: Ban snapshot
Reply With Quote #3

Quote:
Originally Posted by wrecked_ View Post
Did you get an error message with a specified line? o.o
No error
Code:
//// admincmd.sma
// Header size:           1812 bytes
// Code size:            40868 bytes
// Data size:            26368 bytes
// Stack/heap size:      16384 bytes; max. usage is unknown, due to recursion
// Total requirements:   85432 bytes
// Done.
//
// Compilation Time: 1,31 sec
// ----------------------------------------
numbmlg is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-28-2010 , 10:16   Re: Ban snapshot
Reply With Quote #4

If there is no error, then what error are you talking about?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 07:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode