Raised This Month: $ Target: $400
 0% 

Help with ban script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
123
Veteran Member
Join Date: Apr 2005
Location: Katy, TX
Old 10-17-2005 , 14:16   Help with ban script
Reply With Quote #1

Hey.
I have this script, that bans players for 30 minutes, when they reach 70 kills.
What I need to add to it is:
1. Admin immunity (Admins with the d flag)
2. Make it log the bans with AmxBans (I thought I did this, but they aren't logged.
I hope someone will help me.

Code:
#include <amxmodx> public plugin_init() {     // ..     register_plugin("Frag Ban", "1.0", "ShadowLeader")     register_event("ResetHUD", "newSpawn", "be")     register_cvar("frags_limit", "70")     register_cvar("frags_pct_chance", "10") } public newSpawn(id) {     if ( get_user_flags(id)&ADMIN_BAN ) return PLUGIN_HANDLED     new maxplayers = get_maxplayers()     if( maxplayers >= 4 ) {         if( get_user_frags(id) >= get_cvar_num("frags_limit") ) {             new randNum = random_num(0, 100)             if ( get_cvar_num("frags_pct_chance") >= randNum ) {                 server_cmd("banid 30 #%d", get_user_userid(id))                 server_cmd("kick #%d ^"Server overflowed^"", get_user_userid(id))             }         }     }     return PLUGIN_HANDLED }
__________________
//ShadowLeader - 123
123 is offline
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 10-17-2005 , 14:57  
Reply With Quote #2

Why ban someone when they reach 70 kills that is based on a random number and tell thy overflowed?
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 10-17-2005 , 15:05  
Reply With Quote #3

Dude becareful how you act with stuff like this around here

Code:
#include <amxmodx>   public plugin_init() { // .. register_plugin("Frag Ban", "1.0", "ShadowLeader") register_event("ResetHUD", "newSpawn", "be") register_cvar("frags_limit", "70") register_cvar("frags_pct_chance", "10") }   public newSpawn(id) { if ( get_user_flags(id)&ADMIN_BAN ) return PLUGIN_HANDLED     new player[32] = cmd_target(id,player,9) // 9 means 1 (obey immunity) + 8 (cant be a bot)   new maxplayers = get_maxplayers() if( maxplayers >= 4 ) { if( get_user_frags(player) >= get_cvar_num("frags_limit") ) { new randNum = random_num(0, 100) if ( get_cvar_num("frags_pct_chance") >= randNum ) { server_cmd("banid 30 #%d", get_user_userid(id)) server_cmd("kick #%d ^"Server overflowed^"", get_user_userid(id)) } } } return PLUGLIN_HANDLED }

Something like that
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
123
Veteran Member
Join Date: Apr 2005
Location: Katy, TX
Old 10-17-2005 , 15:22  
Reply With Quote #4

Why would I have to be carefull with this ???
Btw. Thanks.
__________________
//ShadowLeader - 123
123 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-17-2005 , 16:59  
Reply With Quote #5

Code:
new players[32] = cmd_target(id,player,9);

What? That doesn't make any sense... try this:

Code:
 #include <amxmodx> public plugin_init() {     // ..     register_plugin("Frag Ban", "1.0", "ShadowLeader")     register_event("ResetHUD", "newSpawn", "be")     register_cvar("frags_limit", "70")     register_cvar("frags_pct_chance", "10") } public newSpawn(id) {     if ( (get_user_flags(id)&ADMIN_BAN) || (get_user_flags(id)&ADMIN_IMMUNITY) ) return PLUGIN_HANDLED     new maxplayers = get_maxplayers()     if( maxplayers >= 4 ) {         if( get_user_frags(id) >= get_cvar_num("frags_limit") ) {             new randNum = random_num(0, 100)             if ( get_cvar_num("frags_pct_chance") >= randNum ) {                 server_cmd("banid 30 #%d", get_user_userid(id))                 server_cmd("kick #%d ^"Server overflowed^"", get_user_userid(id))             }         }     }     return PLUGIN_HANDLED }

This just checks for the ADMIN_IMMUNITY flag as well as the ADMIN_BAN flag. As for logging with AmxBans, I'm not sure since I haven't used it.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
69er.nightwish
Junior Member
Join Date: Sep 2005
Old 10-18-2005 , 06:01  
Reply With Quote #6

Code:
server_cmd("banid 30 #%d", get_user_userid(id))
replace that with

Code:
new authid[35]
get_user_authid(id,authid,34)
server_cmd("amx_ban 30 %s 70 kills", authid)
As amxbans is SQL based u want to either use the amx_ban command the system gives u OR u wanna write an entire function for it which will make a SQL connection to the database and then add it. But this SHOULD work.
69er.nightwish is offline
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 10-18-2005 , 07:26  
Reply With Quote #7

The 70 kills dont work with amx_ban

Code:
new authid[32], new kills = get_user_frags(id) get_user_authid(id,authid,31) if(kills =< 70)      server_cmd("amx_ban %i %s",get_cvar_num("bantime"),authid)

And bantime being a cvar that is how long the person is banned for
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
69er.nightwish
Junior Member
Join Date: Sep 2005
Old 10-18-2005 , 11:48  
Reply With Quote #8

The issue with ur ban command is there is NO reason specified.

This will give a ban in the amxban database without a reason so it will STILL not be documented properly.

The 70 kills thing in my code was the ban reason given.

So combined it would give something like this:

Code:
new authid[32], new kills = get_user_frags(id)
get_user_authid(id,authid,31)

if(kills =< 70)
     server_cmd("amx_ban %i %s 70 kills",get_cvar_num("bantime"),authid)
If the 70 kills bit needs specific quotes to get picked up properly im not sure about I dont think it does but I never tried
69er.nightwish is offline
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 10-20-2005 , 11:14  
Reply With Quote #9

lol you forgot the small tags
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 10-21-2005 , 07:41  
Reply With Quote #10

Code:
new authid[32], new kills = get_user_frags(id) get_user_authid(id,authid,31) if(kills <= 70) // greater symbol first      server_cmd("amx_ban %i %s ^"70 kills^"",get_cvar_num("bantime"),authid)

The ^" symbols tell the compile not to end the server cmd but put 70 kills in quotes when entered by the server, also the greater/less than symbols need to go before the equals or it wont work, also 123 what games is this for?
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
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 23:53.


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