Raised This Month: $ Target: $400
 0% 

Plugin errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wolddal[A]
Member
Join Date: Sep 2010
Old 01-09-2013 , 16:46   Plugin errors
Reply With Quote #1

Hello!
I have this radio plugin:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "MiniRadio by SLIMSHADY"
#define VERSION "1.0"
#define AUTHOR "slimshady"

new s_Item[256], g_MusicStatus[32], name[32], itemol[256], i
new fmst[128], txt[128], station[128]
new 
i_Menucvar

new const status[][] = 

"http://cluster.quantumart.ru/broadcast/default.aspx?media=hitfm" 

new const 
status2[][] = 

"HIT FM" 



public 
plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)
register_clcmd("say /fm""fmd")
cvar register_cvar("amx_miniradio_showtime""60.0")
radhud()
}


public 
fm(id)
{
new 
i_Menu menu_create("\yMiniRadio \wBy \rSLIMSHADY:""radio")
menu_additem(i_Menustatus2[0], "1",0)
menu_additem(i_Menustatus2[1], "2"0)
menu_additem(i_Menustatus2[2], "3"0)
menu_additem(i_Menustatus2[3], "4"0)
menu_additem(i_Menustatus2[4], "5"0)
menu_additem(i_Menustatus2[5], "6"0)
menu_additem(i_Menustatus2[6], "7"0)
menu_additem(i_Menustatus2[7], "8"0)
menu_additem(i_Menustatus2[8], "9"0)
menu_additem(i_Menustatus2[9], "10"0)
menu_additem(i_Menustatus2[10], "11"0)
menu_additem(i_Menustatus2[11], "12"0)
menu_setprop(i_MenuMPROP_NEXTNAME"далее")
menu_setprop(i_MenuMPROP_BACKNAME"назад")
menu_setprop(i_MenuMPROP_EXITNAME"Выйти")
menu_setprop(i_MenuMPROP_EXITMEXIT_ALL)
menu_display(idi_Menu0)
return 
PLUGIN_HANDLED
}
public 
client_disconnect(id)
g_MusicStatus[id] = 0

public hudradio(i)
{
name[i] = 0
itemol
[0] = 0
for(1<= get_maxplayers(); i++)

if(!
is_user_connected(i) || !g_MusicStatus[i])
continue
get_user_name(iname31)
formatex(itemol255"%s %s^n"itemolname)
}
}
  
public 
radhud()
{
if(
name[i] == 0)
{
set_hudmessage(12702550.850.3126.012.00.00.01)
show_hudmessage(0"Слушай FM радио!^nНапиши /fm в чат =)")    
}
else
{
set_hudmessage(12702550.850.3126.012.00.00.01)
show_hudmessage(0"Слушай FM радио!^nНапиши /fm в чат =)^nРадио слушают:^n%s"itemol)
}
set_task(get_pcvar_float(cvar), "radhud")
}

public 
fmd(id)
{
formatex(s_Itemcharsmax(s_Item), "%s"g_MusicStatus[id] ? "\yОтключить" "\yВключить случайное")
if(
g_MusicStatus[id] == 1)
{
formatex(txtcharsmax(txt), "\yMiniRadio \wBy \rSLIMSHADY^n\wВы слушаете: \y%s"station[id])
i_Menu menu_create(txt"radiod")
menu_additem(i_Menus_Item"1"0)
menu_additem(i_Menu"Случайная станция""3"0)
menu_additem(i_Menu"\wСписок станций""2"0)        
}
else
{
i_Menu menu_create("\yMiniRadio \wBy \rSLIMSHADY""radiod")
menu_additem(i_Menus_Item"1"0)
menu_additem(i_Menu"\wСписок станций""2"0)
}
menu_setprop(i_MenuMPROP_NEXTNAME"далее")
menu_setprop(i_MenuMPROP_BACKNAME"назад")
menu_setprop(i_MenuMPROP_EXITNAME"Выйти")
menu_setprop(i_MenuMPROP_EXITMEXIT_ALL)
menu_display(idi_Menu0)
return 
PLUGIN_HANDLED
}
public 
radiod(idmenuitem)
{  
if (
item == MENU_EXIT)
{
menu_destroy(menu)
return 
PLUGIN_HANDLED
}
new 
s_Data[6], s_Name[64], i_Accessi_Callback
menu_item_getinfo
(menuitemi_Accesss_Datacharsmax(s_Data), s_Namecharsmax(s_Name), i_Callback)
new 
i_Key str_to_num(s_Data)
switch(
i_Key)
{
case 
1:
{
if(
g_MusicStatus[id] > 0)
{
g_MusicStatus[id] = 0
hudradio
(i)
ShowInfMotd(id)
}
else
{
randomize(id)
}
}
case 
2:
{
fm(id)
}
case 
3:
{
randomize(id)    
}
}
menu_destroy(menu)
return 
PLUGIN_HANDLED
}
 
public 
ShowInfMotd(id)
{
static 
buffer[4096], len;
if(
g_MusicStatus[id] == 0)
{
len format(buffercharsmax(buffer), "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>")
len += format(buffer[len], charsmax(buffer) - len"<title>play</title></head><body bgcolor='black'>")
len += format(buffer[len], charsmax(buffer) - len"<p align='center'>")
len += format(buffer[len], charsmax(buffer) - len"<font color='red'><big><b>Radio by SLIMSHADY is DISABLED</b></big></font><br>")
len += format(buffer[len], charsmax(buffer) - len"</p></body></html>")        
}
else
{
len format(buffercharsmax(buffer), "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>")
len += format(buffer[len], charsmax(buffer) - len"<title>play</title></head><body bgcolor='black'>")
len += format(buffer[len], charsmax(buffer) - len"<p align='center'>")
len += format(buffer[len], charsmax(buffer) - len"<font color='red'><big><b>Playing: </b></big></font><font color='lawngreen'><big><b>%s</b></big></font><br>"station[id])
len += format(buffer[len], charsmax(buffer) - len"<p align='left'>")
len += format(buffer[len], charsmax(buffer) - len"<font color='yellow'><b>Идет буферизация... Вы можете закрыть окно.</b></font><br>")
len += format(buffer[len], charsmax(buffer) - len"<font color='red'>(Если не включится в течении 30-ти секунд, нужно перезагрузить - отключить и заново включить.)</font><br>")
len += format(buffer[len], charsmax(buffer) - len"<!--h--><DIV align=center><EMBED style='WIDTH: 298px; HEIGHT: 100px' height=500 type=application/x-mplayer2 pluginspage=http://www.microsoft.com/Windows/MediaPlayer/ ")
len += format(buffer[len], charsmax(buffer) - len"width=500 src='%s' ShowStatusBar='1' showtracker='0' "fmst[id])
len += format(buffer[len], charsmax(buffer) - len"displaysize='0' autosize='1' showcontrols='true' animationatstart='0' transparentatstart='0' autostart='true'></DIV>")
len += format(buffer[len], charsmax(buffer) - len"</p></body></html>")
}
show_motd(idbuffer"RADIO BY SLIMSHADY")
}

public 
radio(idmenuitem)
{  
if (
item == MENU_EXIT)
{
menu_destroy(menu)
return 
PLUGIN_HANDLED
}
new 
s_Data[6], s_Name[64], i_Accessi_Callback
menu_item_getinfo
(menuitemi_Accesss_Datacharsmax(s_Data), s_Namecharsmax(s_Name), i_Callback)
new 
i_Key str_to_num(s_Data)
formatex(fmst[id], charsmax(fmst), "%s"status[i_Key-1])
formatex(station[id], charsmax(fmst), "%s"status2[i_Key-1])
g_MusicStatus[id] = 1
ShowInfMotd
(id
hudradio(i)
menu_destroy(menu)
return 
PLUGIN_HANDLED
}

public 
randomize(id)
{  
new 
rrand random_num(011)
formatex(fmst[id], charsmax(fmst), status[rrand])
formatex(station[id], charsmax(fmst), status2[rrand])
g_MusicStatus[id] = 1
ShowInfMotd
(id)
hudradio(i)
return 
PLUGIN_HANDLED

And it gives me some errors:
Code:
 Displaying debug trace (plugin "radios.amxx")
Run time error 4: index out of bounds 
 [0] radio.sma::hudradio (line 84)
 [1] radio.sma::randomize (line 222)
 [2] radio.sma::radiod (line 161)
Code:
AMXX] Run time error 4: index out of bounds 
[AMXX]    [0] radio.sma::client_disconnect (line 76)
What should I edit in order to work perfectly ?
Thanks a lot!
Wolddal[A] is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-09-2013 , 16:55   Re: Plugin errors
Reply With Quote #2

new s_Item[256], g_MusicStatus[32], name[32], itemol[256], i

->

new s_Item[256], g_MusicStatus[33], name[33], itemol[256], i
__________________
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
Wolddal[A]
Member
Join Date: Sep 2010
Old 01-10-2013 , 09:35   Re: Plugin errors
Reply With Quote #3

It worked.
Thanks a lot !
Wolddal[A] 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 13:21.


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