AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with loading .ini (https://forums.alliedmods.net/showthread.php?t=308585)

JocAnis 06-26-2018 09:52

Problem with loading .ini
 
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 ?

maqi 06-26-2018 09:55

Re: Problem with loading .ini
 
Never use read_file in a loop its deprecated. Other than that please explain better whats happening :D

JocAnis 06-26-2018 10:20

Re: Problem with loading .ini
 
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

maqi 06-26-2018 10:26

Re: Problem with loading .ini
 
Why don't you store everything in a trie or a cellarray ?

Also replace the read_file first then post the new code.

JocAnis 06-26-2018 11:47

Re: Problem with loading .ini
 
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


All times are GMT -4. The time now is 12:20.

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