AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with ban script (https://forums.alliedmods.net/showthread.php?t=19467)

123 10-17-2005 14:16

Help with ban script
 
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 }

Knare 10-17-2005 14:57

Why ban someone when they reach 70 kills that is based on a random number and tell thy overflowed?

Knare 10-17-2005 15:05

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

123 10-17-2005 15:22

Why would I have to be carefull with this ???
Btw. Thanks.

XxAvalanchexX 10-17-2005 16:59

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.

69er.nightwish 10-18-2005 06:01

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.

Knare 10-18-2005 07:26

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

69er.nightwish 10-18-2005 11:48

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

Knare 10-20-2005 11:14

lol you forgot the small tags

Knare 10-21-2005 07:41

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?


All times are GMT -4. The time now is 23:53.

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