Raised This Month: $ Target: $400
 0% 

Media Kick/Ban Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 05-26-2006 , 00:22   Media Kick/Ban Help
Reply With Quote #1

Ok, I am at a loss...

I dont know where i am going wrong, there are not compiling errors/warnings and there are no errors in the server logs...

Code:
/* *******************************| *Media/Music Kick/Ban - Allenwr| *******************************| * ****** *When an admin kicks a player, its plays a sound... * *Kick/Ban = Random Files Placed in the mediakickban.ini file * *Commands *-------- *amx_mkick <name or #userid> [reason] *amx_mban <name or #userid> <minutes> [reason] *Same as regular kick/ban * *Changelog *--------- * -1.0 1st release- * -2.0 plugin now chooses random sounds to play when kicking or banning- * -3.0 Now Files can be chosen by user in the mediakickban.ini file- */ #include <amxmodx> #include <amxmisc> #define mkickbansounds 8 #define ini_file "addons/amxmodx/configs/mediakickban.ini" new soundlist[mkickbansounds][80] public read_ini() {     new txt[100],line=0,sound[65]     new fp=fopen(ini_file, "rt")     while(!feof(fp))     {         fgets(fp,txt,99)         parse(txt,sound,99)         format(soundlist[line],79,"%s",sound)         line++     } } public cmd_mkick(id, level, cid) {     if (!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED           new txt[80]     read_args(txt, 79)         new s  = random_num(0,mkickbansounds-1)         client_cmd(0, "stopsound")     client_cmd(0,"mp3 play ^"sound/misc/%s^"", soundlist[s])         set_task(10.0,"kick_timer",_,txt,strlen(txt))     return PLUGIN_HANDLED } public cmd_mban(id, level, cid) {     if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED           new txt[80]     read_args(txt, 79)         new s2 = random_num(0,mkickbansounds-1)         client_cmd(0, "stopsound")     client_cmd(0,"mp3 play ^"sound/misc/%s^"", soundlist[s2])         set_task(11.0,"ban_timer",_,txt,strlen(txt))     return PLUGIN_HANDLED } public kick_timer(txt[]) {     server_cmd("amx_kick %s",txt) } public ban_timer(txt[]) {     server_cmd("amx_ban %s",txt) } public plugin_precache() {     new sound[100]         for (new i=0;i<mkickbansounds;i++)     {         format(sound,99,"misc/%s",soundlist[i])         precache_sound(sound)     }         return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("Media Kick/Ban", "3.0", "Allenwr")     register_concmd("amx_mkick", "cmd_mkick", ADMIN_KICK, "<name or #userid> [reason]")     register_concmd("amx_mban", "cmd_mban", ADMIN_BAN, "<name or #userid> <minutes> [reason]") }
this is the code from my plugin, and the new code i am trying does not work...

Code:
//*put sounds here*
//*8 different sounds max ( "#defined mkickbansounds 8" in mediakickban.sma)*
hittheroadjack.mp3
heyheyheygoodbye.mp3
kickedmusic.mp3
leavingonajetplane.mp3
//
//*sounds here just repeated (lack of 8 sounds "hehe" )*
//
hittheroadjack.mp3
heyheyheygoodbye.mp3
kickedmusic.mp3
leavingonajetplane.mp3
code from ini file

help will be appreciated.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-26-2006 , 00:27  
Reply With Quote #2

add the line
Code:
read_ini()
into public plugin_precache() before you check stuff....you never call that function.

And you need to check for the comments. They aren't auto skipped.

Also you should use get_configsdir() or other to get your file location.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
KoST
Senior Member
Join Date: Jul 2005
Old 05-26-2006 , 00:51  
Reply With Quote #3

use this:

Code:
public plugin_precache() {     read_ini()     new sound[100]         for (new i=0;i<mkickbansounds;i++)     {         format(sound,99,"misc/%s",soundlist[i])         precache_sound(sound)     }         return PLUGIN_CONTINUE }



Code:
public read_ini() {     new txt[100],line=0,sound[65]     new fp=fopen(ini_file, "rt")     while(!feof(fp))     {         fgets(fp,txt,99)         parse(txt,sound,99)         if (sound[0]!="/" && line<mkickbansounds){             format(soundlist[line],79,"%s",sound)             line++         }     } }

then you can use the config file you have...
__________________
KoST is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 05-26-2006 , 03:52  
Reply With Quote #4

and add
Code:
fclose(fp);
at the end of the read_ini function
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
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 16:19.


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