Raised This Month: $ Target: $400
 0% 

[Help] Plugin Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
plazma
Senior Member
Join Date: Oct 2013
Old 06-24-2014 , 15:25   [Help] Plugin Error
Reply With Quote #1

What is the error, I can't fix it...

PHP Code:
#include <amxmodx>
#include <amxmisc>

new day[32]

public 
plugin_init()
{
    
register_clcmd("say /daymenu","main_menu")
    
register_clcmd("say /kohaime","daychat")   
}


public 
client_authorized(id)
{
        if(
is_user_admin(id))
    {
        new 
admin[32], pass[32], flags[32], x_access[32], x_days[32],bufferd[128],name[32], st[33]
        
        new 
iFiled fopen("/addons/amxmodx/configs/Administrators.ini","r");
        
        
        
get_user_name(idname31)
        
get_user_authid(idst32)
        
        while(!
feof(iFiled))
    {

        
fgets(iFiled,bufferd,255)
        
trim(bufferd)
        if(
bufferd[0]=='"')
    {        
    
            
parse(bufferdadmin31pass31flags31x_access31x_days31)
        
        if(
equal(adminname) || equal(adminst))
        {
            
day[id]=str_to_num(x_days)
            return 
PLUGIN_HANDLED
        
}
    }
    }
            
fclose(iFiled)
        }
        return 
PLUGIN_HANDLED
}

public 
daychat(id)
{
    if(
is_user_admin(id))
    {
        
write_colored(id"!nSkadimi adminit tuaj ėshtė edhe !t%d !nditė, sigurohuni qė tė bėni pagesėn para kohės."day[id])
    
    }
        return 
PLUGIN_HANDLED
}

public 
main_menu(id)
{
    if(
is_user_admin(id))
    {

        new 
szArgs[256]
        
formatex(szArgscharsmax(szArgs), "Menya: \r%d \wDita mbetur.^n\yKosovaZM.CsHellZone.com"day[id])

        new 
i_Menu menu_create(szArgs"main_opt")
        
menu_additem(i_Menu"Nje""1"0)
        
menu_additem(i_Menu"Dy""2"0)
        
menu_setprop(i_MenuMPROP_EXITMEXIT_ALL)
        
menu_display(idi_Menu0)
    }
        return 
PLUGIN_HANDLED
}

public 
main_opt(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 
2:
        {
        
write_colored(id"!nOpcioni !gSekondar.")
        }
    case 
1:
        {
        
write_colored(id"!nOpcioni i !gPare.")
        }
    }
    return 
PLUGIN_HANDLED

Errors
PHP Code:
L 06/24/2014 20:56:37: [AMXXRun time error 4index out of bounds 
L 06
/24/2014 20:56:37: [AMXX]    [0PluginX.sma::client_authorized (line 46
__________________
Free Palestine ♥
plazma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2014 , 15:35   Re: [Help] Plugin Error
Reply With Quote #2

The error does not correspond to the code (line 46 has no code on it). The only thing that I see that is indexing anything is the "day" array and I find it hard to believe that you have 32 players on the server. However, you should declare "day" with 33 cells.

Attach the whole .sma file to your next post so that we can see where the error is actually occuring.

Another thing that I notice is that you put a maxlength of 255 for the fgets() function but your buffer is only 128. You should set the third parameter of fgets() as "charsmax(bufferd)".
__________________

Last edited by fysiks; 06-24-2014 at 15:35.
fysiks is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2014 , 14:05   Re: [Help] Plugin Error
Reply With Quote #3

We can't really help you until you attache your .sma file (unedited) so that we can see where the error is actually coming from.

As for the fgets() comment, please re-read my statement:

Quote:
Originally Posted by fysiks View Post
You should set the third parameter of fgets() as "charsmax(bufferd)".
__________________

Last edited by fysiks; 06-26-2014 at 14:05.
fysiks is offline
plazma
Senior Member
Join Date: Oct 2013
Old 06-26-2014 , 13:41   Re: [Help] Plugin Error
Reply With Quote #4

This ?

..

PHP Code:
new day[33
and this
PHP Code:
        fgets(iFiled,charsmax(bufferd))
        
trim(bufferd)
        if(
bufferd[0]=='"'
No compile..
__________________
Free Palestine ♥

Last edited by plazma; 06-26-2014 at 13:41.
plazma 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 21:17.


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