Raised This Month: $ Target: $400
 0% 

amx_ban


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neogeo
Senior Member
Join Date: Jul 2005
Old 05-29-2007 , 13:24   amx_ban
Reply With Quote #1

hi
i need a plugin that do that :
- admin can't ban/kick player if they don't write a reason.
- admin can't ban player more than 9999 min.
- i want that when we use amx_ban , it will ban by ip and not by steamid.
- ban and kick will be log in an specific file.
thanks
neogeo is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-29-2007 , 22:14   Re: amx_ban
Reply With Quote #2

Completely untested. I believe this plugin would need to be listed above admincmd.amxx in plugins.ini.

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_concmd("amx_ban", "cmdBanIP", ADMIN_BAN, "<name or #userid> <minutes> <reason>") } 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, 9)         if (!player)         return PLUGIN_HANDLED         new authid[32], name2[32], authid2[32], name[32]     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)         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)     {         if (nNum > 9999)             nNum = 9999                 format(temp, 63, "%L", player, "FOR_MIN", minutes)     }     else     {         client_print(id, print_console, "Error: You must specify how long a player should be banned in munutes..")         return PLUGIN_HANDLED     }     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     {         client_print(id, print_console, "Error: You must specify a reason for banning this player..")         return PLUGIN_HANDLED     }             new activity = get_cvar_num("amx_show_activity")     if (activity != 0)     {         new players[32], pnum, msg[256], len         get_players(players, pnum, "c")                 for (new i = 0; i < pnum; i++)         {             len = format(msg, 255, "%L", players[i], "ADMIN")                         if (activity == 1)                 len += copy(msg[len], 255-len, ":")             else                 len += format(msg[len], 255-len, " %s:", name)                         len += format(msg[len], 255-len, " %L", players[i], "BAN")             len += format(msg[len], 255-len, " %s ", name2)                     format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes)             client_print(players[i], print_chat, "%s", msg)         }     }     console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)         return PLUGIN_HANDLED }
Lee is offline
neogeo
Senior Member
Join Date: Jul 2005
Old 05-30-2007 , 00:34   Re: amx_ban
Reply With Quote #3

thanks , i will try
neogeo is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-30-2007 , 01:01   Re: amx_ban
Reply With Quote #4

Note that it will log unsuccessful attempts should a reason or time not be specified as if there were no problems. If you would rather a log entry was only made if a player is actually banned move the log_amx() call to below the server_cmd() used to kick and ban the player.
Lee is offline
hcxx
Senior Member
Join Date: Jan 2007
Location: 127.0.0.1
Old 05-30-2007 , 01:52   Re: amx_ban
Reply With Quote #5

check http://www.amxbans.net/
hcxx is offline
neogeo
Senior Member
Join Date: Jul 2005
Old 06-01-2007 , 14:26   Re: amx_ban
Reply With Quote #6

doesn't work
Code:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/phphiEv1I.sma(0) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(3) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(4) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(7) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(10) : error 001: expected token: ";", but found " "
/home/groups/amxmodx/tmp3/phphiEv1I.sma(13) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(16) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(17) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(18) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(20) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(21) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(22) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(23) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(24) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(25) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(26) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(27) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(28) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(29) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(30) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(31) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(32) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(33) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(34) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(35) : error 075: input line too long (after substitutions)
/home/groups/amxmodx/tmp3/phphiEv1I.sma(36) : error 075: input line too long (after substitutions)

Compilation aborted.
26 Errors.
neogeo is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-01-2007 , 16:09   Re: amx_ban
Reply With Quote #7

Compiled fine for me using the web compiler. Here it is in a file incase you can't get it to compile
Attached Files
File Type: sma Get Plugin or Get Source (newban.sma - 840 views - 2.3 KB)
__________________
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
neogeo
Senior Member
Join Date: Jul 2005
Old 06-02-2007 , 05:21   Re: amx_ban
Reply With Quote #8

thanks
neogeo is offline
neogeo
Senior Member
Join Date: Jul 2005
Old 06-02-2007 , 13:26   Re: amx_ban
Reply With Quote #9

doesn't work , i can ban player without writing a reason.
neogeo is offline
Reply



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 08:46.


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