Raised This Month: $ Target: $400
 0% 

.ini File


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-21-2017 , 21:42   .ini File
Reply With Quote #1

I'm trying to copy every single models for a weapon, there're 11 models.

Thats the code i'm using:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

enum WeapSett
{
    
V_KNIFE,
    
V_M4A1,
    
V_AK47,
    
V_AWP
}

new 
WeaponSkins[WeapSett]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
plugin_precache()
{
    new 
szFile[256]
    
get_configsdir(szFilecharsmax(szFile))
    
add(szFilecharsmax(szFile), "/furien_models.ini")

    new 
iFile fopen(szFile"r")

    while (!
feof(iFile))
    {
        new 
szBuffer[512], Key[64], Value[256]

        
fgets(iFileszBuffercharsmax(szBuffer))
        
trim(szBuffer)
        
        if (
szBuffer[0] == EOS || szBuffer[0] == ';' || (szBuffer[0] == '/' && szBuffer[1] == '/'))
            continue

        
strtok(szBufferKeycharsmax(Key), Valuecharsmax(Value), '=')

        
trim(Key)
        
trim(Value)
        
        if(
equal(Key"V_KNIFE"))
        {
            
copy(WeaponSkins[V_KNIFE], charsmax(WeaponSkins[]), Value)
        }
        else if(
equal(Key"V_M4A1"))
        {
            
copy(WeaponSkins[V_M4A1], charsmax(WeaponSkins[]), Value)
        }
        else if(
equal(Key"V_AK47"))
        {
            
copy(WeaponSkins[V_AK47], charsmax(WeaponSkins[]), Value)
        }
        else if(
equal(Key"V_AWP"))
        {
            
copy(WeaponSkins[V_AWP], charsmax(WeaponSkins[]), Value)
        }
        
        for(new 
i;sizeof WeaponSkins;i++)
        {
            
precache_model(WeaponSkins[WeapSett:i])
        }
    }
    
fclose(iFile)

The question is: Is there any format for use instead of 'else if'?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-22-2017 , 00:09   Re: .ini File
Reply With Quote #2

It depends on what you are trying to achieve. What's wrong with the if else if?
__________________
fysiks is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-22-2017 , 03:58   Re: .ini File
Reply With Quote #3

Nothing, I'm just searching any another formats.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-22-2017 , 04:35   Re: .ini File
Reply With Quote #4

Tries possibly.
klippy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-22-2017 , 15:07   Re: .ini File
Reply With Quote #5

But It will require one trie for every single models of them, right?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-22-2017 at 15:08.
EFFx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-22-2017 , 20:38   Re: .ini File
Reply With Quote #6

It will require one KEY in the trie for each model.
__________________

Last edited by OciXCrom; 03-22-2017 at 20:38.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 18:00.


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