Raised This Month: $ Target: $400
 0% 

Array/String


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-30-2015 , 09:11   Array/String
Reply With Quote #1

As i think these functions work fine, but the problem is with putting in the array.

PHP Code:
#define MAXFLAGS 32

new Vip_flags[MAXFLAGS], access_flags

public _create_vip_flag(pluginargc)  // native
{
    new 
vflag[2], sString[32]
    
get_string(1vflagcharsmax(vflag))
    
    if(
_flags_are_existed(vflagsStringcharsmax(sString)))
    {
        
log_error(AMX_ERR_PARAMS"Error couldn't create a vip flag ^"%s^", it's already created!"sString)
        return -
1
    
}
    
    
    
Vip_flags[access_flags] = vflag[0]
    
    
access_flags ++
    return 
access_flags-1
}

public 
bool:_flags_are_existed(const vflags[], sflags[], len// native
{
    if(!
strlen(Vip_flags))
    {
        return 
false;
    }
    
    new 
xifidfeq
    
new flags[MAXFLAGS], zFlag[2]
    
    for(
0strlen(vflags); i++)
    {
        
feq 0
        
        
for(0access_flagsx++)
        {
            
zFlag[0] = Vip_flags[x]
            
            if(
zFlag[0] == vflags[i])
            {
                
feq ++;
            }
        }
        
        if(!
feq)
        {
            
flags[fid] = vflags[i]
            
fid ++;
        }
    }
    
    if(
fid)
    {
        
copy(sflagslenflags)
        return 
false;
    }
    
    return 
true;

when flags a & c
is created by this native >> create_vip_flag(const vflag[])

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    if(!
flags_are_existed("a"))
    {
        
create_vip_flag("a")
    }
        if(!
flags_are_existed("c"))
        {
                
create_vip_flag("c")
        }

flag c isn't input in the array(Vip_flags)!
IDK why that's what i'm trying to figure it out?!

Last edited by Natsheh; 08-30-2015 at 09:51.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
 



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 22:14.


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