Raised This Month: $ Target: $400
 0% 

Problem with loading .ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 06-26-2018 , 09:52   Problem with loading .ini
Reply With Quote #1

I have a problem when the plugin needs to load times from .ini file. After something, .ini file gets updated, and i see that when i open it...but in-game its not updated, until i change the map...im trying to call that load immediately, but it remains the same...im not that good coder so i tryed 20 ways, this is the last one im using:

PHP Code:
public update_player()
{
    if (
file_exists(g_SpawnFile))
    {
        new 
Data[128], lenline 0
        
new p_origin[3][8]
    
        new  
broj_ent[4]
    
        while((
line read_file(g_SpawnFile line Data 127 len) ) != 
        {
            
parse(Datap_origin[0],7p_origin[1],7p_origin[2],7nick_igrac31broj_ent3VREME_114)
        
            
official_time[cp_count] = str_to_floatVREME_1 )
        }
    }
    
client_print0print_chat"ocitano")
    return  
PLUGIN_CONTINUE

isnt just parse + using it, enought to be loaded from .ini ?
JocAnis is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-26-2018 , 09:55   Re: Problem with loading .ini
Reply With Quote #2

Never use read_file in a loop its deprecated. Other than that please explain better whats happening
__________________
stuff
maqi is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 06-26-2018 , 10:20   Re: Problem with loading .ini
Reply With Quote #3

official_time[index] wont get updated from this code, so its like its not executed at all...on map reload the similar code is called for the same thing, load from .ini file, and it is loading...
but nothing is updated ingame from .ini file, although its been rewritten ingame, and can be seen in .ini
JocAnis is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-26-2018 , 10:26   Re: Problem with loading .ini
Reply With Quote #4

Why don't you store everything in a trie or a cellarray ?

Also replace the read_file first then post the new code.
__________________
stuff
maqi is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 06-26-2018 , 11:47   Re: Problem with loading .ini
Reply With Quote #5

its working now. the problem was my stupidy so i accidently didnt stored official_time[ ] somewhere, so it was loading wrong one...anyway thanks for that implementation, i replaced read_file to fopen "r" and fgets
JocAnis 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 12:21.


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