Raised This Month: $ Target: $400
 0% 

Split Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer zm
Senior Member
Join Date: Jun 2011
Old 10-01-2013 , 19:31   Split Menu
Reply With Quote #1

I have an nst_wpn old system weapons cso and I want when you type nst_wpn in console on the menu

1 PISTOLS
2 RIFLES

I want to show insteand 2 RIFLES more menu weapons ex: "AUTOMATIC" , "HEAVY" etc like this

1 PISTOLS
2 RIFLES
3 AUTOMATIC
4 HEAVY

etc

So in present the plugin chose what weapons to show in the RIFLES menu from a .ini file that look like this

PISTOLS = ddeagle, infinityss, infinityex2
RIFLES = dualkriss, dmp7a1

and I want to be like this

PISTOLS = ddeagle, infinityss, infinityex2
RIFLES = dualkriss, dmp7a1
AUTOMATIC = dmp7a1, thompson_gold
HEAVY = crossbow, cv47, m1887g

Here is my code where take from the .ini file and put in the RIFLES menu

PHP Code:
// CREATE INI FILE
mywpn_create_ini(run)
{
    
// Build customization file file_url
    
new file_url[64]
    
get_configsdir(file_urlcharsmax(file_url))
    
format(file_urlcharsmax(file_url), "%s/%s"file_urlNST_MYWPN_SETTING_FILE)
    
    
// File not present
    
if (!file_exists(file_url))
    {
        
write_file(file_url"", -1)
        return;
    }
    
    
// Set up some vars to hold parsing info
    
new linedata[1024], key[64], value[960], ilineset[1024]
    
    
// Open customization file for reading
    
new file fopen(file_url"rt")
    
    while (
file && !feof(file))
    {
        
// Read one line at a time
        
fgets(filelinedatacharsmax(linedata))
        
        
// Replace newlines with a null character to prevent headaches
        
replace(linedatacharsmax(linedata), "^n""")
        
        
// Blank line or comment
        
if (!linedata[0] || linedata[0] == ';')
        {
            
i++
            continue;
        }
        
        
// Get key and value(s)
        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')
        
        
// Trim spaces
        
trim(key)
        
trim(value)
        
        new 
name_type[64], typewpn TYPE_WPN
        
        
if (typewpn == NST_WPN_RIFLES
        {
            
name_type "RIFLES"
        
}        
        else if (
typewpn == NST_WPN_PISTOLS
        {
            
name_type "PISTOLS"
        
}
        
    
        
// update weapon
        
if (equali(keyname_type))
        {
            
// update list weapons
            
if (run==NST_WPN_INI_SAVE)
            {
                
// get list weapon
                
new valueset[512]
                for (new 
e=0e<MAX_MYWPNe++)
                {
                    if (!
g_mywpn[e]) continue;
                    
format(valuesetcharsmax(valueset), "%s, %s"valuesetc_model[g_mywpn[e]])
                }
                
                
// save list weapon
                
format(linesetcharsmax(lineset), "%s = %s"keyvalueset[2])
                
write_file(file_urllineseti)
                
//client_print(0, print_chat, "da cap nhat xong")
            
}
            
// set value for g_mywpn in new round
            
else if (run==NST_WPN_INI_READ)
            {
                
strtolower(value)
                new 
e
                
while (e<MAX_MYWPN && value[0] != && strtok(valuekeycharsmax(key), valuecharsmax(value), ','))
                {
                    
trim(key)
                    
trim(value)
                    
format(g_mywpn_cache[e], 31"%s"key)
                    
e++
                }
            }
        }
        
i++

    }


I tried here

PHP Code:
        new name_type[64], typewpn TYPE_WPN
        
        
if (typewpn == NST_WPN_RIFLES
        {
            
name_type "RIFLES"
        
}        
        else if (
typewpn == NST_WPN_PISTOLS
        {
            
name_type "PISTOLS"
        
}
        
    
        
// update weapon
        
if (equali(keyname_type))
        { 
and make it like this =====>

PHP Code:
        new name_type[64], name_type2[64], name_type3[64], typewpn TYPE_WPN
        
        
if (typewpn == NST_WPN_RIFLES
        {
            
name_type "RIFLES"
            
name_type2 "AUTOMATIC"
            
name_type3 "HEAVY"
        
}        
        else if (
typewpn == NST_WPN_PISTOLS
        {
            
name_type "PISTOLS"
        
}
        
        { 

And I write 3 times this if(equali) with different name_type/2/3

// update weapon
if (equali(key, name_type))
{
with the same code code is up
}
// update weapon
if (equali(key, name_type2))
{
with the same code, code is up
}
// update weapon
if (equali(key, name_type3))
{
with the same code, code is up
}

But this try was = 0 and everyting is the same and in my menu AUTOMATIC or Heavy are the same weapons like in RIFLES menu...

If anyone is able to take a look of what I am asking here if understand please!
Thank You !
Killer zm 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:42.


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