Raised This Month: $32 Target: $400
 8% 

[req] help with plugin (admin expire date)


Post New Thread Reply   
 
Thread Tools Display Modes
Hey
Member
Join Date: Dec 2017
Old 01-24-2018 , 18:47   Re: [req] help with plugin (admin expire date)
Reply With Quote #11

the only things i know about this error is it happens:
1. if a player is not connected.
2.if you are trying to access a variable that has 32 index and you are trying to access the 33 which doesn't exist i may be blind and i didn't check all variable so let me check again.
3. if a non player run the command (if i make sense).
Hey is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-24-2018 , 19:04   Re: [req] help with plugin (admin expire date)
Reply With Quote #12

Go to line 86 use ctrl + g type the line hit enter and woosh!!!

Paste that line...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-24-2018 at 19:05.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Hey
Member
Join Date: Dec 2017
Old 01-24-2018 , 19:33   Re: [req] help with plugin (admin expire date)
Reply With Quote #13

well i already knew that :/, idk what's wrong anymore i tested the code myself 5 times now nothing did popup, so i just did add charsmax as much as i can :p
PHP Code:
if(parse(szLineAdminData[contador][szadmin], charsmax(AdminData[][szadmin]), szLinecharsmax(szLine), szLinecharsmax(szLine), auxaccesscharsmax(auxaccess), AdminData[contador][szvencimiento], charsmax(AdminData[][szvencimiento])) < 5)
            continue 

Last edited by Hey; 01-24-2018 at 19:34.
Hey is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 01-24-2018 , 19:56   Re: [req] help with plugin (admin expire date)
Reply With Quote #14

The error only comes up with an users.ini with many admins inside, something like, 30 lines, or so, sorry for not clarify that
sigerman is offline
Hey
Member
Join Date: Dec 2017
Old 01-24-2018 , 22:34   Re: [req] help with plugin (admin expire date)
Reply With Quote #15

try this one:
Attached Files
File Type: sma Get Plugin or Get Source (vencimientos3-183-5090.sma - 336 views - 6.0 KB)
Hey is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 01-25-2018 , 07:36   Re: [req] help with plugin (admin expire date)
Reply With Quote #16

PHP Code:
L 01/25/2018 09:34:55: [AMXXDisplaying debug trace (plugin "vencimientos3-183-5090.amxx"version "0.2")
L 01/25/2018 09:34:55: [AMXXRun time error 4index out of bounds
L 01
/25/2018 09:34:55: [AMXX]    [0vencimientos3-183-5090.sma::CargarVencimientos (line 86)
L 01/25/2018 09:34:55: [AMXX]    [1vencimientos3-183-5090.sma::plugin_init (line 19)
[
AMXX37 administradores cargados del archivo 
37 admins
I tested the plugin and It isn't disabling lines (the main purpouse of this plugin), with or without bug

I'm hiper mega glad for you helping me, I will test more when I have some time, sorry for that, and thanks again

Test it with this
I will upload my users.ini
Attached Files
File Type: ini users.ini (2.3 KB, 71 views)

Last edited by sigerman; 01-25-2018 at 07:50.
sigerman is offline
Hey
Member
Join Date: Dec 2017
Old 01-25-2018 , 15:01   Re: [req] help with plugin (admin expire date)
Reply With Quote #17

this ? use it instead it's better, cuz idk what's the problem, i used charsmax to make sure no variable are getting accessed through a non existent index, and i tried to add more size to them but still nothing... i made all checks possible but NOTHING DID WORK!! (i am sure it's just me passing the problem without seeing it) sorry tho idk what am i not seeing in the code.

Last edited by Hey; 01-25-2018 at 15:02.
Hey is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-25-2018 , 15:13   Re: [req] help with plugin (admin expire date)
Reply With Quote #18

I hate these non-english plugins so much... try changing the value in: new AdminData[32][data] to something like 70
__________________
retired chump
DjSoftero is offline
Hey
Member
Join Date: Dec 2017
Old 01-25-2018 , 15:16   Re: [req] help with plugin (admin expire date)
Reply With Quote #19

oh ok let me change it to 100 cuz i tried :'(, never failed at something this much.
Hey is offline
Hey
Member
Join Date: Dec 2017
Old 01-25-2018 , 15:20   Re: [req] help with plugin (admin expire date)
Reply With Quote #20

there now it works after adding bigger number, i'll go cry in the corner, take your plugin:
PHP Code:
#include <amxmodx>
#include <amxmisc>

enum _:data
{
    
szadmin[40],
    
iaccess,
    
szvencimiento[12]
}
new 
g_iSayText
new AdminData[100][data]

public 
plugin_init()
{
    
register_plugin("Admin Vencimiento""0.2""N!K")
    
    
register_clcmd("say /veno""cmdVencimiento")
    
//register_clcmd("say /call", "CargarVencimientos");
    
g_iSayText get_user_msgid("SayText")
    
set_task(10.0"CargarVencimientos");
}

/*public plugin_cfg()
{
    server_cmd("amx_pausecfg add ^"Admin Vencimiento^"")
}*/

public cmdVencimiento(id)
{
    if (!
is_user_admin(id))
        return 
PLUGIN_HANDLED;
    if(!(
<= id <= get_maxplayers()))
        return 
PLUGIN_HANDLED;
    
    new 
auth[32]
    for(new 
0admins_num(); i++)
    {
        
console_print(id"%s - %d - %s"AdminData[i][szadmin], AdminData[i][iaccess], AdminData[i][szvencimiento])
        
        switch(
AdminData[i][iaccess])
        {
            case 
1get_user_name(idauthcharsmax(auth))
            case 
2get_user_authid(idauthcharsmax(auth))
            case 
3get_user_ip(idauthcharsmax(auth), 1)
        }

        if(
containi(AdminData[i][szadmin], auth) != -1)
        {
            if(
AdminData[i][szvencimiento][0])
                
ChatColor(id"!g[AMXX] !yTu administrador vence el dia: !g%s"AdminData[i][szvencimiento])
            break
        }    
    }
    return 
PLUGIN_HANDLED
}

public 
CargarVencimientos()
{
    new 
szFile[64]
    
get_localinfo("amxx_configsdir"szFilecharsmax(szFile))
    
formatex(szFilecharsmax(szFile), "%s/users.ini"szFile)

    new 
file fopen(szFile"rt")
    if(!
file)
    {
        
log_amx("no se si alguna vez se ejecutara esta linea pero es por seguridad (?")
        return 
PLUGIN_HANDLED
    
}

    new 
auxaccess[6], szLine[512], contador 0bool:adminsvencidos false
    
new szaux[12], szdia[5], szmes[5], szanio[5], diamesanio
    get_time
("%d"szdiacharsmax(szdia))
    
dia str_to_num(szdia)
    
get_time("%m"szmescharsmax(szmes))
    
mes str_to_num(szmes)
    
get_time("%Y"szaniocharsmax(szanio))
    
anio str_to_num(szanio)

    while(!
feof(file))
    {
        
fgets(fileszLinecharsmax(szLine))
        
trim(szLine)

        if (!
szLine[0] || szLine[0] == ';')
            continue

        if(
parse(szLineAdminData[contador][szadmin], charsmax(AdminData[][szadmin]), szLinecharsmax(szLine), szLinecharsmax(szLine), auxaccesscharsmax(auxaccess), AdminData[contador][szvencimiento], charsmax(AdminData[][szvencimiento])) < 5)
            continue

        
remove_quotes(AdminData[contador][szadmin])
        
remove_quotes(auxaccess)
        
remove_quotes(AdminData[contador][szvencimiento])
        
copy(szauxcharsmax(szaux), AdminData[contador][szvencimiento])
        
replace_all(szauxcharsmax(szaux), "/"" ")
        
parse(szauxszdiacharsmax(szdia), szmescharsmax(szmes), szaniocharsmax(szanio))
        if(
str_to_num(szanio) <= anio && str_to_num(szmes) <= mes && str_to_num(szdia) <= dia)
        {
            
adminsvencidos true
            log_amx
("1 admin vencido detected (?")
            continue
        }
        
//-------------------------- esta parte de aca no anda D: --------------------------
        
if(containi(auxaccess"b") != -1)    // b: admin por tag
            
AdminData[contador][iaccess] = 1
        
if(containi(auxaccess"c") != -1)    // c: admin por steam
            
AdminData[contador][iaccess] = 2
        
if(containi(auxaccess"d") != -1)    // d: admin por ip
            
AdminData[contador][iaccess] = 3
        
//----------------------------------------------------------------------------------
        
contador++
    }

    if(!
adminsvencidos)
    {
        
fclose(file)
        return 
PLUGIN_HANDLED
    
}

    
fseek(file0SEEK_SET)
    new 
szFile2[64], auxvenc[12], dummy1[33], dummy2[33], dummy3[33], dummy4[33]
    
formatex(szFile2charsmax(szFile2), "%s2"szFile)
    new 
file2 fopen(szFile2"wt")
    if(!
file2)
    {
        
log_amx("no se si alguna vez se ejecutara esta linea pero es por seguridad (?")
        return 
PLUGIN_HANDLED
    
}

    while(!
feof(file))
    {
        
fgets(fileszLinecharsmax(szLine))
        
trim(szLine)

        if(
szLine[0] && szLine[0] != ';' && parse(szLinedummy1charsmax(dummy1), dummy2charsmax(dummy2), dummy3charsmax(dummy3), dummy4charsmax(dummy4), auxvenccharsmax(auxvenc)) > 4)
        {
            
copy(szaux11auxvenc)
            
replace_all(szaux11"/"" ")
            
parse(szauxszdiacharsmax(szdia), szmescharsmax(szmes), szaniocharsmax(szanio))
            if(
str_to_num(szanio) <= anio && str_to_num(szmes) <= mes && str_to_num(szdia) <= dia)
            {
                
formatex(szLinecharsmax(szLine), ";^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" -- ADMINISTRADOR VENCIDO --"dummy1dummy2dummy3dummy4auxvenc)
            }
        }
        
formatex(szLinecharsmax(szLine), "%s^n"szLine)
        
fputs(file2szLine)
    }

    
fclose(file)
    
fclose(file2)
    
delete_file(szFile)
    
rename_file(szFile2szFile1)
    
server_cmd("amx_reloadadmins")
    
log_amx("Admins deshabilitados con exito e.e (?")
    return 
PLUGIN_HANDLED
}

stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
 
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
replace_all(msg190"!team2""^0"); // Team2 Color
 
    
new iPlayer;
     
    if (
idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            
iPlayer players[i];
            if (
is_user_connected(iPlayer))
            {
                
message_begin(MSG_ONE_UNRELIABLEg_iSayText_iPlayer);
                
write_byte(iPlayer);
                
write_string(msg);
                
message_end();
            }
        }
    }

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2058\\ f0\\ fs16 \n\\ par }
*/ 
Hey 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:07.


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