Raised This Month: $29 Target: $400
 7% 

File doesn't read


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-17-2021 , 18:03   File doesn't read
Reply With Quote #1

Hi!,
I want to make read file i did it and the file was working but something happened make the file reading doesn't work and i don't know why!, same codes and there's no errors but the file writing working very well.

Is there someone can explain me where is the error!

PHP Code:
enum _:Sections
{
    
SECTION_NONE,
    
SECTION_SETTINGS,
    
SECTION_MODEL
}

enum _:Settings
{
    
/*COMMAND_CHECKVIP[32],
    COMMAND_MTODVIP[32],*/
    
VIP_MESSAGES,
    
VIP_SCOREBOARD,
    
VIP_MULTIJUMP,
    
VIP_HEALTH,
    
VIP_ARMOR,
    
VIP_GRAVITY,
    
VIP_NOCLIP,
    
VIP_DAMAGE,
    
VIP_FALLDAMAGE,
    
VIP_MODEL,
    
VIP_NON
}

new 
g_eSettings[Settings
PHP Code:
ReadFile()
{
    new 
iFilePointer
    
    
if (!file_exists(g_szLocalFile))
    {
        
// File not exists, then create it (Here we can use new file system without problems)
        
iFilePointer fopen(g_szLocalFile"wt")
        
        
fputs(iFilePointer";Zombie Plague VIP^n^n")
        
fputs(iFilePointer"[Commands]^n")
        
fputs(iFilePointer"; Adding ^"/^" or ^"!^" in front will make it a chat command.^n")
        
fputs(iFilePointer"CHECK_COMMANDS = /vip, /vips, /whovip, /whovips, /checkvips, /checkvip^n")
        
fputs(iFilePointer"MOTD_COMMANDS = /getvip, /getvips, /buyvip, /buyvips^n^n")
        
fputs(iFilePointer"[Player Models]^n")
        
fputs(iFilePointer"MODEL_T = OWNER_Model^n")
        
fputs(iFilePointer"MODEL_CT = administrator^n^n")
        
fputs(iFilePointer"[Access Flags]^n")
        
fputs(iFilePointer"MESSAGES = a^n")
        
fputs(iFilePointer"SCOREBOARD = b^n")
        
fputs(iFilePointer"MULTIJUMP = c^n")
        
fputs(iFilePointer"HEALTH = d^n")
        
fputs(iFilePointer"ARMOR = e^n")
        
fputs(iFilePointer"GRAVITY = f^n")
        
fputs(iFilePointer"NOCLIP = g^n")
        
fputs(iFilePointer"DAMAGE = h^n")
        
fputs(iFilePointer"FALL DAMAGE = i^n")
        
fputs(iFilePointer"VIP MODEL = j^n")
        
fputs(iFilePointer"VIP_NON = z^n^n")
        
fputs(iFilePointer"[Usage Example]^n")
        
fputs(iFilePointer"; ^"Steam/Nick^" ^"Password^" ^"Flags^" ^"ExpireDate^"")
        
        
fclose(iFilePointer)
    }

    if (
iFilePointer)
    {
        
iFilePointer fopen(g_szLocalFile"rt")
        
        new 
szData[96], szValue[64], szKey[32], iSection SECTION_NONEiSize
        
        
while(!feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

            switch(
szData[0])
            {
                case 
EOS';''#': continue
                case 
'[':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == ']')
                    {
                        switch(
szData[1])
                        {
                            case 
'N''n'iSection SECTION_NONE
                            
case 'S''s'iSection SECTION_SETTINGS
                            
case 'M''m'iSection SECTION_MODEL
                            
default: continue
                        }
                    }
                    else continue
                }
                default:
                {
                    if(
iSection == SECTION_NONE)
                    {
                        continue
                    }

                    
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
trim(szKey); trim(szValue)

                    if(!
szValue[0])
                    {
                        continue
                    }
                    switch(
iSection)
                    {
                        case 
SECTION_SETTINGS:
                        {
                            
/*if(equal(szKey, "CHECK_COMMANDS"))
                            {
                                copy( g_eSettings[COMMAND_CHECKVIP], charsmax( g_eSettings[COMMAND_CHECKVIP] ), szValue );
                            }
                            else if(equal(szKey, "MOTD_COMMANDS"))
                            {
                                copy( g_eSettings[COMMAND_MTODVIP], charsmax( g_eSettings[COMMAND_MTODVIP] ), szValue );
                            }*/
                            
if(equal(szKey"CHECK_COMMANDS"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    switch(
szKey[0])
                                    {
                                        case 
'/''!':
                                        {
                                            
formatex(szDatacharsmax(szData), "say %s"szKey)
                                            
register_clcmd(szData"CmdVIP")
                                            
formatex(szDatacharsmax(szData), "say_team %s"szKey)
                                            
register_clcmd(szData"CmdVIP")
                                        }
                                        default:
                                        {
                                            
register_clcmd(szKey"CmdVIP")
                                        }
                                    }
                                }
                            }
                            else if(
equal(szKey"MOTD_COMMANDS"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    switch(
szKey[0])
                                    {
                                        case 
'/''!':
                                        {
                                            
formatex(szDatacharsmax(szData), "say %s"szKey)
                                            
register_clcmd(szData"CmdMotd")
                                            
formatex(szDatacharsmax(szData), "say_team %s"szKey)
                                            
register_clcmd(szData"CmdMotd")
                                        }
                                        default:
                                        {
                                            
register_clcmd(szKey"CmdMotd")
                                        }
                                    }
                                }
                            }
                            else if (
equal(szKey"MESSAGES"))
                            {
                                
g_eSettings[VIP_MESSAGES] = read_flags(szValue)
                            }
                            else if (
equal(szKey"SCOREBOARD"))
                            {
                                
g_eSettings[VIP_SCOREBOARD] = read_flags(szValue)
                            }
                            else if (
equal(szKey"MULTIJUMP"))
                            {
                                
g_eSettings[VIP_MULTIJUMP] = read_flags(szValue)
                            }
                            else if (
equal(szKey"HEALTH"))
                            {
                                
g_eSettings[VIP_HEALTH] = read_flags(szValue)
                            }
                            else if (
equal(szKey"ARMOR"))
                            {
                                
g_eSettings[VIP_ARMOR] = read_flags(szValue)
                            }
                            else if (
equal(szKey"GRAVITY"))
                            {
                                
g_eSettings[VIP_GRAVITY] = read_flags(szValue)
                            }
                            else if (
equal(szKey"NOCLIP"))
                            {
                                
g_eSettings[VIP_NOCLIP] = read_flags(szValue)
                            }
                            else if (
equal(szKey"DAMAGE"))
                            {
                                
g_eSettings[VIP_DAMAGE] = read_flags(szValue)
                            }
                            else if (
equal(szKey"FALL DAMAGE"))
                            {
                                
g_eSettings[VIP_FALLDAMAGE] = read_flags(szValue)
                            }
                            else if (
equal(szKey"VIP MODEL"))
                            {
                                
g_eSettings[VIP_MODEL] = read_flags(szValue)
                            }
                            else if (
equal(szKey"VIP_NON"))
                            {
                                
g_eSettings[VIP_NON] = read_flags(szValue)
                            }
                        }
                        case 
SECTION_MODEL:
                        {
                            if (
equal(szKey"MODEL_T"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    
ArrayPushString(Player_Model_TszKey)
                                }
                            }
                            else if (
equal(szKey"MODEL_CT"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    
ArrayPushString(Player_Model_CTszKey)
                                }
                            }
                        }
                    }
                }
            }
        }
        
fclose(iFilePointer)
    }

__________________

Last edited by Supremache; 05-17-2021 at 18:05.
Supremache is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-17-2021 , 18:27   Re: File doesn't read
Reply With Quote #2

It will currently only read if the initial file was written (didn't already exist)

Remove this?
PHP Code:
    if (iFilePointer)
    { 
__________________
Bugsy is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-17-2021 , 18:37   Re: File doesn't read
Reply With Quote #3

[QUOTE=Bugsy;2747116]It will currently only read if the initial file was written (didn't already exist)

Remove this?
PHP Code:
ReadFile()
{
    new 
iFilePointer
    
    
if (!file_exists(g_szLocalFile))
    {
        
// File not exists, then create it (Here we can use new file system without problems)
        
iFilePointer fopen(g_szLocalFile"wt")
        
        
fputs(iFilePointer";Zombie Plague VIP^n^n")
        
fputs(iFilePointer"[Commands]^n")
        
fputs(iFilePointer"; Adding ^"/^" or ^"!^" in front will make it a chat command.^n")
        
fputs(iFilePointer"CHECK_COMMANDS = /vip, /vips, /whovip, /whovips, /checkvips, /checkvip^n")
        
fputs(iFilePointer"MOTD_COMMANDS = /getvip, /getvips, /buyvip, /buyvips^n^n")
        
fputs(iFilePointer"[Player Models]^n")
        
fputs(iFilePointer"MODEL_T = OWNER_Model^n")
        
fputs(iFilePointer"MODEL_CT = administrator^n^n")
        
fputs(iFilePointer"[Access Flags]^n")
        
fputs(iFilePointer"MESSAGES = a^n")
        
fputs(iFilePointer"SCOREBOARD = b^n")
        
fputs(iFilePointer"MULTIJUMP = c^n")
        
fputs(iFilePointer"HEALTH = d^n")
        
fputs(iFilePointer"ARMOR = e^n")
        
fputs(iFilePointer"GRAVITY = f^n")
        
fputs(iFilePointer"NOCLIP = g^n")
        
fputs(iFilePointer"DAMAGE = h^n")
        
fputs(iFilePointer"FALL DAMAGE = i^n")
        
fputs(iFilePointer"VIP MODEL = j^n")
        
fputs(iFilePointer"VIP_NON = z^n^n")
        
fputs(iFilePointer"[Usage Example]^n")
        
fputs(iFilePointer"; ^"Steam/Nick^" ^"Password^" ^"Flags^" ^"ExpireDate^"")
        
        
fclose(iFilePointer)
    }
    else
    {
        
iFilePointer fopen(g_szLocalFile"rt")
        
        new 
szData[96], szValue[64], szKey[32], iSection SECTION_NONEiSize
        
        
while(!feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

            switch(
szData[0])
            {
                case 
EOS';''#': continue
                case 
'[':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == ']')
                    {
                        switch(
szData[1])
                        {
                            case 
'N''n'iSection SECTION_NONE
                            
case 'S''s'iSection SECTION_SETTINGS
                            
case 'M''m'iSection SECTION_MODEL
                            
default: continue
                        }
                    }
                    else continue
                }
                default:
                {
                    if(
iSection == SECTION_NONE)
                    {
                        continue
                    }

                    
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
trim(szKey); trim(szValue)

                    if(!
szValue[0])
                    {
                        continue
                    }
                    switch(
iSection)
                    {
                        case 
SECTION_SETTINGS:
                        {
                            
/*if(equal(szKey, "CHECK_COMMANDS"))
                            {
                                copy( g_eSettings[COMMAND_CHECKVIP], charsmax( g_eSettings[COMMAND_CHECKVIP] ), szValue );
                            }
                            else if(equal(szKey, "MOTD_COMMANDS"))
                            {
                                copy( g_eSettings[COMMAND_MTODVIP], charsmax( g_eSettings[COMMAND_MTODVIP] ), szValue );
                            }*/
                            
if(equal(szKey"CHECK_COMMANDS"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    switch(
szKey[0])
                                    {
                                        case 
'/''!':
                                        {
                                            
formatex(szDatacharsmax(szData), "say %s"szKey)
                                            
register_clcmd(szData"CmdVIP")
                                            
formatex(szDatacharsmax(szData), "say_team %s"szKey)
                                            
register_clcmd(szData"CmdVIP")
                                        }
                                        default:
                                        {
                                            
register_clcmd(szKey"CmdVIP")
                                        }
                                    }
                                }
                            }
                            else if(
equal(szKey"MOTD_COMMANDS"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    switch(
szKey[0])
                                    {
                                        case 
'/''!':
                                        {
                                            
formatex(szDatacharsmax(szData), "say %s"szKey)
                                            
register_clcmd(szData"CmdMotd")
                                            
formatex(szDatacharsmax(szData), "say_team %s"szKey)
                                            
register_clcmd(szData"CmdMotd")
                                        }
                                        default:
                                        {
                                            
register_clcmd(szKey"CmdMotd")
                                        }
                                    }
                                }
                            }
                            else if (
equal(szKey"MESSAGES"))
                            {
                                
g_eSettings[VIP_MESSAGES] = read_flags(szValue)
                            }
                            else if (
equal(szKey"SCOREBOARD"))
                            {
                                
g_eSettings[VIP_SCOREBOARD] = read_flags(szValue)
                            }
                            else if (
equal(szKey"MULTIJUMP"))
                            {
                                
g_eSettings[VIP_MULTIJUMP] = read_flags(szValue)
                            }
                            else if (
equal(szKey"HEALTH"))
                            {
                                
g_eSettings[VIP_HEALTH] = read_flags(szValue)
                            }
                            else if (
equal(szKey"ARMOR"))
                            {
                                
g_eSettings[VIP_ARMOR] = read_flags(szValue)
                            }
                            else if (
equal(szKey"GRAVITY"))
                            {
                                
g_eSettings[VIP_GRAVITY] = read_flags(szValue)
                            }
                            else if (
equal(szKey"NOCLIP"))
                            {
                                
g_eSettings[VIP_NOCLIP] = read_flags(szValue)
                            }
                            else if (
equal(szKey"DAMAGE"))
                            {
                                
g_eSettings[VIP_DAMAGE] = read_flags(szValue)
                            }
                            else if (
equal(szKey"FALL DAMAGE"))
                            {
                                
g_eSettings[VIP_FALLDAMAGE] = read_flags(szValue)
                            }
                            else if (
equal(szKey"VIP MODEL"))
                            {
                                
g_eSettings[VIP_MODEL] = read_flags(szValue)
                            }
                            else if (
equal(szKey"VIP_NON"))
                            {
                                
g_eSettings[VIP_NON] = read_flags(szValue)
                            }
                        }
                        case 
SECTION_MODEL:
                        {
                            if (
equal(szKey"MODEL_T"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    
ArrayPushString(Player_Model_TszKey)
                                }
                            }
                            else if (
equal(szKey"MODEL_CT"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    
ArrayPushString(Player_Model_CTszKey)
                                }
                            }
                        }
                    }
                }
            }
        }
        
fclose(iFilePointer)
    }

__________________

Last edited by Supremache; 05-17-2021 at 18:38.
Supremache is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-17-2021 , 18:46   Re: File doesn't read
Reply With Quote #4

Not all the code, just the if condition. Think about it logically

Code:
ReadFile() {     new iFilePointer         if (!file_exists(g_szLocalFile))     {         // File not exists, then create it (Here we can use new file system without problems)         iFilePointer = fopen(g_szLocalFile, "wt")
        The file exists, so iFilePointer is > 0
        and if it doesn't exist, iFilePointer remains 0 since we never call iFilePointer = fopen()..
        fputs(iFilePointer, ";Zombie Plague VIP^n^n")         fputs(iFilePointer, "[Commands]^n")         fputs(iFilePointer, "; Adding ^"/^" or ^"!^" in front will make it a chat command.^n")         fputs(iFilePointer, "CHECK_COMMANDS = /vip, /vips, /whovip, /whovips, /checkvips, /checkvip^n")         fputs(iFilePointer, "MOTD_COMMANDS = /getvip, /getvips, /buyvip, /buyvips^n^n")         fputs(iFilePointer, "[Player Models]^n")         fputs(iFilePointer, "MODEL_T = OWNER_Model^n")         fputs(iFilePointer, "MODEL_CT = administrator^n^n")         fputs(iFilePointer, "[Access Flags]^n")         fputs(iFilePointer, "MESSAGES = a^n")         fputs(iFilePointer, "SCOREBOARD = b^n")         fputs(iFilePointer, "MULTIJUMP = c^n")         fputs(iFilePointer, "HEALTH = d^n")         fputs(iFilePointer, "ARMOR = e^n")         fputs(iFilePointer, "GRAVITY = f^n")         fputs(iFilePointer, "NOCLIP = g^n")         fputs(iFilePointer, "DAMAGE = h^n")         fputs(iFilePointer, "FALL DAMAGE = i^n")         fputs(iFilePointer, "VIP MODEL = j^n")         fputs(iFilePointer, "VIP_NON = z^n^n")         fputs(iFilePointer, "[Usage Example]^n")         fputs(iFilePointer, "; ^"Steam/Nick^" ^"Password^" ^"Flags^" ^"ExpireDate^"")                 fclose(iFilePointer)     }
This if statement is only true if the file did not exist already since the 'iFilePointer =' code above
is only called when it needs to create a file. iFilePointer otherwise holds 0 and you never get into
the read code.
    if (iFilePointer)
    {
        iFilePointer = fopen(g_szLocalFile, "rt")                 new szData[96], szValue[64], szKey[32], iSection = SECTION_NONE, iSize
__________________
Bugsy is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-17-2021 , 19:40   Re: File doesn't read
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Not all the code, just the if condition. Think about it logically
I did that before but it didn't work, I dont know i think there's something make it doesn't work i checked my plugin and recoded it but i still have same error

PHP Code:
ReadFile()
{    
    new 
iFilePointer
    
    
if (!file_exists(g_szLocalFile))
    {
        
// File not exists, then create it (Here we can use new file system without problems)
        
iFilePointer fopen(g_szLocalFile"wt")
        
        
fputs(iFilePointer";Zombie Plague VIP^n^n")
        
fputs(iFilePointer"[Commands]^n")
        
fputs(iFilePointer"; Adding ^"/^" or ^"!^" in front will make it a chat command.^n")
        
fputs(iFilePointer"CHECK_COMMANDS = /vip, /vips, /whovip, /whovips, /checkvips, /checkvip^n")
        
fputs(iFilePointer"MOTD_COMMANDS = /getvip, /getvips, /buyvip, /buyvips^n^n")
        
fputs(iFilePointer"[Player Models]^n")
        
fputs(iFilePointer"MODEL_T = OWNER_Model^n")
        
fputs(iFilePointer"MODEL_CT = administrator^n^n")
        
fputs(iFilePointer"[Access Flags]^n")
        
fputs(iFilePointer"MESSAGES = a^n")
        
fputs(iFilePointer"SCOREBOARD = b^n")
        
fputs(iFilePointer"MULTIJUMP = c^n")
        
fputs(iFilePointer"HEALTH = d^n")
        
fputs(iFilePointer"ARMOR = e^n")
        
fputs(iFilePointer"GRAVITY = f^n")
        
fputs(iFilePointer"NOCLIP = g^n")
        
fputs(iFilePointer"DAMAGE = h^n")
        
fputs(iFilePointer"FALL DAMAGE = i^n")
        
fputs(iFilePointer"VIP MODEL = j^n")
        
fputs(iFilePointer"VIP_NON = z^n^n")
        
fputs(iFilePointer"[Usage Example]^n")
        
fputs(iFilePointer"; ^"Steam/Nick^" ^"Password^" ^"Flags^" ^"ExpireDate^"")
        
        
fclose(iFilePointer)
    }
    
        
iFilePointer fopen(g_szLocalFile"rt")
        
        new 
szData[96], szValue[64], szKey[32], iSection SECTION_NONEiSize
        
        
while(!feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

            switch(
szData[0])
            {
                case 
EOS';''#': continue
                case 
'[':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == ']')
                    {
                        switch(
szData[1])
                        {
                            case 
'N''n'iSection SECTION_NONE
                            
case 'S''s'iSection SECTION_SETTINGS
                            
case 'M''m'iSection SECTION_MODEL
                            
default: continue
                        }
                    }
                    else continue
                }
                default:
                {
                    if(
iSection == SECTION_NONE)
                    {
                        continue
                    }

                    
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
trim(szKey); trim(szValue)

                    if(!
szValue[0])
                    {
                        continue
                    }
                    switch(
iSection)
                    {
                        case 
SECTION_SETTINGS:
                        {
                            
/*if(equal(szKey, "CHECK_COMMANDS"))
                            {
                                copy( g_eSettings[COMMAND_CHECKVIP], charsmax( g_eSettings[COMMAND_CHECKVIP] ), szValue );
                            }
                            else if(equal(szKey, "MOTD_COMMANDS"))
                            {
                                copy( g_eSettings[COMMAND_MTODVIP], charsmax( g_eSettings[COMMAND_MTODVIP] ), szValue );
                            }*/
                            
if(equal(szKey"CHECK_COMMANDS"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    switch(
szKey[0])
                                    {
                                        case 
'/''!':
                                        {
                                            
formatex(szDatacharsmax(szData), "say %s"szKey)
                                            
register_clcmd(szData"CmdVIP")
                                            
formatex(szDatacharsmax(szData), "say_team %s"szKey)
                                            
register_clcmd(szData"CmdVIP")
                                        }
                                        default:
                                        {
                                            
register_clcmd(szKey"CmdVIP")
                                        }
                                    }
                                }
                            }
                            else if(
equal(szKey"MOTD_COMMANDS"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    switch(
szKey[0])
                                    {
                                        case 
'/''!':
                                        {
                                            
formatex(szDatacharsmax(szData), "say %s"szKey)
                                            
register_clcmd(szData"CmdMotd")
                                            
formatex(szDatacharsmax(szData), "say_team %s"szKey)
                                            
register_clcmd(szData"CmdMotd")
                                        }
                                        default:
                                        {
                                            
register_clcmd(szKey"CmdMotd")
                                        }
                                    }
                                }
                            }
                            else if (
equal(szKey"MESSAGES"))
                            {
                                
g_eSettings[VIP_MESSAGES] = read_flags(szValue)
                            }
                            else if (
equal(szKey"SCOREBOARD"))
                            {
                                
g_eSettings[VIP_SCOREBOARD] = read_flags(szValue)
                            }
                            else if (
equal(szKey"MULTIJUMP"))
                            {
                                
g_eSettings[VIP_MULTIJUMP] = read_flags(szValue)
                            }
                            else if (
equal(szKey"HEALTH"))
                            {
                                
g_eSettings[VIP_HEALTH] = read_flags(szValue)
                            }
                            else if (
equal(szKey"ARMOR"))
                            {
                                
g_eSettings[VIP_ARMOR] = read_flags(szValue)
                            }
                            else if (
equal(szKey"GRAVITY"))
                            {
                                
g_eSettings[VIP_GRAVITY] = read_flags(szValue)
                            }
                            else if (
equal(szKey"NOCLIP"))
                            {
                                
g_eSettings[VIP_NOCLIP] = read_flags(szValue)
                            }
                            else if (
equal(szKey"DAMAGE"))
                            {
                                
g_eSettings[VIP_DAMAGE] = read_flags(szValue)
                            }
                            else if (
equal(szKey"FALL DAMAGE"))
                            {
                                
g_eSettings[VIP_FALLDAMAGE] = read_flags(szValue)
                            }
                            else if (
equal(szKey"VIP MODEL"))
                            {
                                
g_eSettings[VIP_MODEL] = read_flags(szValue)
                            }
                            else if (
equal(szKey"VIP_NON"))
                            {
                                
g_eSettings[VIP_NON] = read_flags(szValue)
                            }
                        }
                        case 
SECTION_MODEL:
                        {
                            if (
equal(szKey"MODEL_T"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    
ArrayPushString(Player_Model_TszKey)
                                }
                            }
                            else if (
equal(szKey"MODEL_CT"))
                            {
                                while (
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
                                    
ArrayPushString(Player_Model_CTszKey)
                                }
                            }
                        }
                    }
                }
            }
        }
        
fclose(iFilePointer)
    

__________________

Last edited by Supremache; 05-17-2021 at 20:01.
Supremache is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-17-2021 , 20:46   Re: File doesn't read
Reply With Quote #6

What error do you get? I just ran the code and it works, I am getting console output when I do server_print( szData) after fgets()/trim().
__________________
Bugsy is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-17-2021 , 23:38   Re: File doesn't read
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
What error do you get? I just ran the code and it works, I am getting console output when I do server_print( szData) after fgets()/trim().
Oops I mean it still didn't work 😬
__________________
Supremache is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-17-2021 , 23:52   Re: File doesn't read
Reply With Quote #8

Good time to learn debugging. Do console_print()/server_print() at each step in the code and find out what code is not being reached or where values of variables are not what you expect.
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-17-2021 , 23:52   Re: File doesn't read
Reply With Quote #9

Quote:
Originally Posted by Supremache View Post
Oops I mean it still didn't work 😬
That's why he asked:

Quote:
Originally Posted by Bugsy View Post
What error do you get?
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-18-2021 , 00:51   Re: File doesn't read
Reply With Quote #10

No wonder it doesn't work, check what are you doing here

PHP Code:
            switch(szData[0])
            {
                case 
EOS';''#': continue
                case 
'[':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == ']')
                    {
                        switch(
szData[1])
                        {
                            case 
'N''n'iSection SECTION_NONE
                            
case 'S''s'iSection SECTION_SETTINGS
                            
case 'M''m'iSection SECTION_MODEL
                            
default: continue
                        }
                    } 
And your categories format

[Access Flags], etc .
__________________
@Jailbreak Main Mod v2.6.5 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 05-18-2021 at 00:52.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 05:17.


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