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

Solved Blank String?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-06-2018 , 07:12   Blank String?
Reply With Quote #1

All strings are passed correctly to g_iConfig but retrieved blank?

PHP Code:
enum _:Config
{
Float:DEFAULT_GRAVITY,
Float:DEFAULT_MAXSPEED,
    
AIRDROP_CLASSNAME32 ],
    
AIRPLANE_CLASSNAME32 ],
Float:DISTANCE_BETWEEN_POINTS,
    
GAME_SOUNDS_FILE32 ],
    
GAME_MODELS_FILE32 ],
    
GAME_WEAPONS_FILE32 ],
    
PLANE_ORIGINS_FILE32 ],
    
GAME_CUSTOM_SPAWN_POINTS_FILE32 ],
    
MEDKIT_MODEL32 ],
    
DRINK_MODEL32 ]
}

new 
g_iConfigConfig ];

public 
plugin_precache( )
{
    
ReadConfig( );
    
ReadPlaneOrigins( );
}

ReadPlaneOrigins( )
{
    
log_to_file"PlaneOrigins.txt""Called | %s"g_iConfigPLANE_ORIGINS_FILE ] );

    new
    
szConfigsName128 ], szFilename256 ], szData128 ], szOrigin110 ], szOrigin210 ], szOrigin310 ] ,
    
szAngle110 ], szAngle210 ], szAngle310 ], szVelocity110 ], szVelocity210 ], szVelocity310 ]   ,
    
eDataPlaneData ]                                                                                        ;
    
    
get_configsdirszConfigsNamecharsmaxszConfigsName ) );
    
    
formatexszFilenamecharsmaxszFilename ), "%s/%s"szConfigsNameg_iConfigPLANE_ORIGINS_FILE ] );
    
    new 
iFile fopenszFilename"rt" );
    
    if( 
iFile )
    {        
        while( 
fgetsiFileszDatacharsmaxszData ) ) )
        {
            
trimszData );
            
            
log_to_file"PlaneOrigins.txt""%s"szData );
            
            if( 
parseszDataszOrigin1charsmaxszOrigin1 ), szOrigin2charsmaxszOrigin2 ), szOrigin3charsmaxszOrigin3 ) ) < )
            continue;
            
            
eDataPlaneOrigin ][ ] = _:str_to_floatszOrigin1 );
            
eDataPlaneOrigin ][ ] = _:str_to_floatszOrigin2 );
            
eDataPlaneOrigin ][ ] = _:str_to_floatszOrigin3 );
            
            
eDataPlaneAngle ][ ] = _:str_to_floatszAngle1 );
            
eDataPlaneAngle ][ ] = _:str_to_floatszAngle2 );
            
eDataPlaneAngle ][ ] = _:str_to_floatszAngle3 );
            
            
eDataPlaneVelocity ][ ] = _:str_to_floatszVelocity1 );
            
eDataPlaneVelocity ][ ] = _:str_to_floatszVelocity2 );
            
eDataPlaneVelocity ][ ] = _:str_to_floatszVelocity3 );
            
            
ArrayPushArrayg_aPlaneDirectionseData );
        }
    }
    
fcloseiFile );
}

ReadConfig( )
{
    new 
szConfigsName128 ], szFilename256 ];
    
get_configsdirszConfigsNamecharsmaxszConfigsName ) );
    
    
formatexszFilenamecharsmaxszFilename ), "%s/%s"szConfigsNameg_szGameConfig );
    
    new 
iFile fopenszFilename"rt" );
    
    if( 
iFile )
    {
        new 
szData128 ], szValue32 ], szKey32 ];
        
        while( 
fgetsiFileszDatacharsmaxszData ) ) )
        {
            
trimszData );
            
            switch( 
szData] )
            {
            case 
EOS'#'';''/'
                continue;
                
            default:
                {                
                    
strtokszDataszKeycharsmaxszKey ), szValuecharsmaxszValue ), '=' );
                    
trimszKey ); 
                    
trimszValue );
                    
                    if( ! 
szValue] )
                    continue;
                    
                    
remove_quotesszValue );
                    
                    
log_to_file"ConfigDebug.txt""#4 Key: %s | Value: %s"szKeyszValue );
                    
                    if( 
equalszKey"DEFAULT_MAXSPEED" ) )
                    {
                        
g_iConfigDEFAULT_MAXSPEED ] = _:str_to_floatszValue );
                    }
                    
                    else if( 
equalszKey"DEFAULT_GRAVITY" ) )
                    {
                        
g_iConfigDEFAULT_GRAVITY ] = _:str_to_floatszValue );
                    }
                    
                    else if( 
equalszKey"AIRDROP_CLASSNAME" ) )
                    {
                        
g_iConfigAIRDROP_CLASSNAME ] = szValue;
                    }
                    
                    else if( 
equalszKey"AIRPLANE_CLASSNAME" ) )
                    {
                        
g_iConfigAIRPLANE_CLASSNAME ] = szValue;
                    }
                    
                    else if( 
equalszKey"DISTANCE_BETWEEN_POINTS" ) )
                    {
                        
g_iConfigDISTANCE_BETWEEN_POINTS ] = _:str_to_floatszValue );
                    }
                    
                    else if( 
equalszKey"GAME_SOUNDS_FILE" ) )
                    {
                        
g_iConfigGAME_SOUNDS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"GAME_MODELS_FILE" ) )
                    {
                        
g_iConfigGAME_MODELS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"GAME_WEAPONS_FILE" ) )
                    {
                        
g_iConfigGAME_WEAPONS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"GAME_CUSTOM_SPAWN_POINTS_FILE" ) )
                    {
                        
g_iConfigGAME_CUSTOM_SPAWN_POINTS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"POSSIBLE_WEAPONS_AIRDROP" ) )
                    {
                        while( 
szValue] != EOS && strtokszValueszKeycharsmaxszKey ), szValuecharsmaxszValue ), ',' ) )
                        {
                            
trimszKey );
                            
trimszValue );
                            
                            
remove_quotesszKey );
                            
                            new 
iWeapon str_to_numszKey );
                            
ArrayPushCellg_aAirDropWeaponsiWeapon );
                        }
                    }
                }
            }
        }
    }
    
fcloseiFile );

Saving:
Quote:
L 09/06/2018 - 12:56:23: #4 Key: DEFAULT_MAXSPEED | Value: 250.0
L 09/06/2018 - 12:56:23: #4 Key: DEFAULT_GRAVITY | Value: 1.0
L 09/06/2018 - 12:56:23: #4 Key: AIRDROP_CLASSNAME | Value: ent_airdrop
L 09/06/2018 - 12:56:23: #4 Key: AIRPLANE_CLASSNAME | Value: ent_airplane
L 09/06/2018 - 12:56:23: #4 Key: DISTANCE_BETWEEN_POINTS | Value: 250.0
L 09/06/2018 - 12:56:23: #4 Key: GAME_SOUNDS_FILE | Value: GameSounds.ini
L 09/06/2018 - 12:56:23: #4 Key: GAME_MODELS_FILE | Value: GameModels.ini
L 09/06/2018 - 12:56:23: #4 Key: GAME_WEAPONS_FILE | Value: GameWeapons.ini
L 09/06/2018 - 12:56:23: #4 Key: PLANE_ORIGINS_FILE | Value: PlaneDirections.ini
L 09/06/2018 - 12:56:23: #4 Key: GAME_CUSTOM_SPAWN_POINTS_FILE | Value: CustomSpawnPoints.ini
L 09/06/2018 - 12:56:23: #4 Key: POSSIBLE_WEAPONS_AIRDROP | Value: CSW_M249, CSW_AWP, CSW_G3SG1,
L 09/06/2018 - 12:56:23: #4 Key: MEDKIT_MODEL | Value: models/w_medkit.mdl
L 09/06/2018 - 12:56:23: #4 Key: DRINK_MODEL | Value: models/can.mdl
Retrieving:
Code:
log_to_file( "PlaneOrigins.txt", "Called | %s", g_iConfig[ PLANE_ORIGINS_FILE ] );

Quote:
L 09/06/2018 - 12:56:24: Called |
__________________

Last edited by edon1337; 09-06-2018 at 08:20.
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-06-2018 , 07:47   Re: Blank String?
Reply With Quote #2

PHP Code:
                    strtokszDataszKeycharsmaxszKey ), szValuecharsmaxszValue ), '=' );
                    
trimszKey ); 
                    
trimszValue );
                    
                    if( ! 
szValue] )
                    continue;
                    
                    
remove_quotesszValue ); 
Remove the quotes then check if the string is empty.

PHP Code:
                    strtokszDataszKeycharsmaxszKey ), szValuecharsmaxszValue ), '=' );
                    
trimszKey ); 
                    
trimszValue );
                    
remove_quotesszValue );
                    if( ! 
szValue] )
                    continue; 

Also remove the quotes from the keys and the value. Some people might add quotes to both of the


And what are you expecting from that log.

You are logging before its actually been filled.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-06-2018 at 07:53.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-06-2018 , 07:50   Re: Blank String?
Reply With Quote #3

I don't see where you set PLANE_ORIGINS_FILE.
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-06-2018 , 08:19   Re: Blank String?
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
I don't see where you set PLANE_ORIGINS_FILE.
Oh my.. there's so many configurations I had to make that I missed it, thanks for noticing.

Quote:
Originally Posted by Natsheh View Post
You are logging before its actually been filled.
What's this non-sense? Double check the code before posting.
It's filled in ReadConfig which is called before ReadPlaneOrigins.
__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-06-2018 , 08:44   Re: Blank String?
Reply With Quote #5

Quote:
Originally Posted by edon1337 View Post

It's filled in ReadConfig which is called before ReadPlaneOrigins.
I didnt saw it in it.

Nonsense?
Go learn english, YDF the sentence i wrote is near the exact to what hamlet wrote.

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


Last edited by Natsheh; 09-06-2018 at 09:05.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-06-2018 , 09:30   Re: Blank String?
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
Nonsense?
Go learn english, YDF the sentence i wrote is near the exact to what hamlet wrote.
> Tells me to learn English
> Can't write 1 full sentence without making mistakes

What you wrote is no where close to the solution, that's why it is nonsense.
__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-06-2018 , 09:31   Re: Blank String?
Reply With Quote #7

Quote:
Originally Posted by edon1337 View Post
> Tells me to learn English
> Can't write 1 full sentence without making mistakes

What you wrote is no where close to the solution, that's why it is nonsense.
Why i am bothering with you, you are hopeless.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 09-06-2018 , 09:34   Re: Blank String?
Reply With Quote #8

What the... you two are always in conflict, nvm.

@edon1337, please, post the solution.
__________________








CrazY. is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-06-2018 , 09:46   Re: Blank String?
Reply With Quote #9

Quote:
Originally Posted by CrazY. View Post
@edon1337, please, post the solution.
Quote:
Originally Posted by HamletEagle View Post
I don't see where you set PLANE_ORIGINS_FILE.
__________________
edon1337 is offline
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 20:15.


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