Raised This Month: $ Target: $400
 0% 

amx v0.9.9b code to amxx 1.71


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klier1kas
Junior Member
Join Date: May 2006
Old 06-01-2006 , 13:51   amx v0.9.9b code to amxx 1.71
Reply With Quote #1

Hello, maybe somebody correct a mistake? This plugin take from amx v0.9.9b but I yesturday put in my server amxx 1.71 mod. And I need this amx_ban because must amx_ban <nick...> <time> <reason>, o use amx v0.9.9b amx_ban <nick or ip> and all...
Maybe somebody can modify this code that be amxx 1.71?

Quote:
public cmdBan(id,level,cid){
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED

new arg[32], len, i=0, found=0, myname[32], myauthid[32], kicked=0
new player, minutes=0, reason[128], freason[128]
new players[32], pnum, startarg

get_players(players,pnum)
get_user_name(id,myname,31)
get_user_authid(id,myauthid,31)

len = read_argv(1,arg,31)
if(arg[0] != '#')
player = find_player("bl",arg)
else
player = find_player("k",strtonum(arg[1]))

if (player)
{
if(arg[0]!='#' && player != find_player("blj",arg))
console_print(id, _T("There are more than one client matching to your argument"))
else
{
new authid[32], arg2[32]
get_user_authid(player,authid,31)

read_argv(2, arg2, 31)
if(equali(arg2,"ip"))
startarg = 3
else
startarg = 2

if(startarg == 2 && equal(authid,"HLTV"))
{
console_print(id,_T("Sorry, you can't ban HLTV proxies! Use sv_proxies (server Cvar) instead"))
return PLUGIN_HANDLED
}

get_user_name(player,arg,31)

if(get_user_flags(player) & ADMIN_IMMUNITY)
{
console_print(id,_T("Client ^"%s^" has immunity"), arg)
return PLUGIN_HANDLED
}

getBanArgs(startarg,minutes,reason,127)
if(reason[0])
format(freason,127,"Banned: %s",reason)
else
copy(freason,127,"Banned.")

found = 1
kicked--

if ( get_cvar_num("sv_lan") || startarg == 3)
{
new address[32], address2[32]
get_user_ip(player,address,31,1)
for(i=0; i<pnum; i++)
{
get_user_ip(players[i],address2,31,1)
if(equal(address,address2))
{
server_cmd("kick #%d %s", get_user_userid(players[i]),freason)
kicked++
}
}
server_cmd("addip %d ^"%s^";wait;writeip",minutes,address)
}
else
{
new authid2[32]
get_user_authid(player,authid,31)
for(i=0; i<pnum; i++)
if(players[i] != player)
{
get_user_authid(players[i],authid2,31)
if(equal(authid,authid2))
{
server_cmd("kick #%d %s", get_user_userid(players[i]),freason)
kicked++
}
}
server_cmd("banid %d ^"%s^" kick;wait;writeid",minutes,authid)
}

if(found)
{
log_to_file(g_logFile,"Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^") (reason ^"%s^")",
myname,get_user_userid(id),myauthid, arg,player,authid,minutes,reason)
console_print(id,_T("Client ^"%s^" kicked and banned"),arg)
if(kicked)
console_print(id,_T("%d other player(s) with same %s kicked and banned as well"),kicked,
(get_cvar_num("sv_lan") || startarg == 3) ? _T("IP")
: _T("AuthID") )
}
}
}
else
{
strtoupper(arg)
if(contain(arg,".")==-1)
{
startarg = 2
#if !defined NO_STEAM
if(len == 7 && equali(arg,"STEAM_",6))
{
new str[16]
read_argv(3,str,15)
add(arg,31,":")
add(arg,31,str)
read_argv(5,str,15)
add(arg,31,":")
len = add(arg,31,str)
startarg = 6
}
if(len>10 && equali(arg,"STEAM_",6) && arg[7] == ':' && arg[9] == ':' && strtonum(arg[10]))
#else
if(strtonum(arg))
#endif
{
new authid[32]
getBanArgs(startarg,minutes,reason,127)
found=1

log_to_file(g_logFile,"Ban: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%d^") (reason ^"%s^")",
myname,get_user_userid(id),myauthid,arg,minut es,reason)

for(i=0; i<pnum; i++)
{
get_user_authid(players[i],authid,31)
if(equal(authid,arg))
{
server_cmd("kick #%d %s", get_user_userid(players[i]),freason)
kicked++
}
}

server_cmd("banid %d ^"%s^";wait;writeid",minutes,arg)

console_print(id,_T("AuthID ^"%s^" added to ban list"), arg)
if(kicked)
console_print(id, _T("%d player(s) with this AuthID kicked"), kicked)
}
}
else
{
new dots = 0
while(isdigit(arg[i]) || arg[i]=='.')
if(arg[i++] == '.')
dots++
if(i == len && dots == 3)
{
new address[32]
getBanArgs(2,minutes,reason,127)
found=1

log_to_file(g_logFile,"Ban: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%d^") (reason ^"%s^")",
myname,get_user_userid(id),myauthid,arg,minut es,reason)

for(i=0; i<pnum; i++)
{
get_user_ip(players[i],address,31,1)
if(equal(address,arg))
{
server_cmd("kick #%d %s", get_user_userid(players[i]),freason)
kicked++
}
}

server_cmd("addip %d ^"%s^";wait;writeip",minutes,arg)

console_print(id,_T("IP ^"%s^" added to ban list"), arg)
if(kicked)
console_print(id, _T("%d player(s) with this IP kicked"), kicked)

}
}
}

if(!found)
{
console_print(id,_T("Could not find specified Player/AuthID/IP"))
console_print(id,_T("Usage: amx_ban <name|#userid|authid|ip> [ip] <minutes> [reason]"))
}
else
{
new activity = get_cvar_num("amx_show_activity")

if(activity == 1)
{
if(minutes)
client_print(0,print_chat,_T("ADMIN: ban %s for %d min."), arg, minutes)
else
client_print(0,print_chat,_T("ADMIN: ban %s permanently"), arg)
}
else if(activity==2)
{
if(minutes)
client_print(0,print_chat,_T("ADMIN %s: ban %s for %d min."), myname, arg, minutes)
else
client_print(0,print_chat,_T("ADMIN %s: ban %s permanently"), myname, arg)
}
}

return PLUGIN_HANDLED
}
Thanks.
klier1kas is offline
BAILOPAN
Join Date: Jan 2004
Old 06-01-2006 , 15:30  
Reply With Quote #2

Please enclose Small code with the [small] tag for readability. It also looks like you did not post the full plugin.
__________________
egg
BAILOPAN 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 16:26.


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