Raised This Month: $ Target: $400
 0% 

AMXX Settings API [amxmodx-1.8.3-dev-git4156]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 08-05-2014 , 07:10   AMXX Settings API [amxmodx-1.8.3-dev-git4156]
Reply With Quote #1

Hi AM community i have a bug or soemthing to report since AMXX latest build at the moment, i'm using this LOADING / SAVING API https://forums.alliedmods.net/showthread.php?t=243202 and it work's fine with this version of AMXX
Code:
amxmodx-1.8.3-dev-git399
but with latest snapshot "atm" not anymore, no error responded but it's not saving strings to .ini file this one:
Code:
amxmodx-1.8.3-dev-git4156
the folowing function
PHP Code:
amx_save_setting_string_arr 
And so a plugin huge like ZP it's not working anymore with latest snapshot
PHP Code:
public native_save_setting_string_arr(plugin_idnum_params)
{
    
// Retrieve and check params
    
new filename[32], setting_section[64], setting_key[64]
    if (!
RetrieveParams(filenamecharsmax(filename), setting_sectioncharsmax(setting_section), setting_keycharsmax(setting_key)))
        return 
false;
    
    new Array:
array_handle
    
if (!RetrieveArray(array_handle))
        return 
false;
    
    
// Open file for read
    
new path[64], file
    
if (!OpenCustomFileRead(pathcharsmax(path), filenamefiletrue))
        return 
false;
    
    
// Try to find section
    
if (!SectionExists(filesetting_section))
    {
        
// Section not found, append at the end
        
if (!CustomFileAppend(filepath)) return false;
        
WriteSection(filesetting_section)
        
WriteKeyValueArrayString(filesetting_keyarray_handle)
        
fclose(file)
        return 
true;
    }
    
    
// Try to find key in section
    
new keypos_startkeypos_endreplace_values true
    
if (!KeyExists(filesetting_keykeypos_startkeypos_end))
    {
        if (
feof(file))
        {
            
// End of file, append at the end
            
if (!CustomFileAppend(filepath)) return false;
            
WriteKeyValueArrayString(filesetting_keyarray_handle)
            
fclose(file)
            return 
true;
        }
        
        
// End of section, add new key + value pair at the end
        
replace_values false
    
}
    
    
// We have to use a second file (tempfile) to add data at an arbitrary position
    
new temppath[64], tempfile
    
if (!OpenTempFileWrite(temppathcharsmax(temppath), tempfile))
    {
        
fclose(file)
        return 
false;
    }
    
    
// Copy new data into temp file
    
CopyDataBeforeKey(filetempfilekeypos_startkeypos_endreplace_values)
    
WriteKeyValueArrayString(tempfilesetting_keyarray_handle)
    
CopyDataAfterKey(filetempfile)
    
    
// Replace original with new
    
if (!ReplaceFile(filepathtempfiletemppath))
    {
        
fclose(tempfile)
        return 
false;
    }
    
    return 
true;

BUT THE OTHER FUNCTIONS WORK JUST FINE what shall i do ?
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
 



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 07:40.


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