AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if equal problem! (https://forums.alliedmods.net/showthread.php?t=242412)

proffs 06-19-2014 05:45

if equal problem!
 
Alright so I have 2 plugins on a server which conflicts with each other..

I have a command /donate and another command /donatexp
Whenever i use a command both of the plugin is called.

PHP Code:

public ClCmd_Sayid )
{
    new 
szArgs64 ]
    
    
read_argsszArgscharsmaxszArgs ) )
    
remove_quotesszArgs )
    
    
    
    new 
arg1[16]
    new 
arg2[32]
    
    
strbreak(szArgsarg1charsmax(arg1), arg2charsmax(arg2))
    if (
equali(arg1,"/donate"7))
        
donate(idarg2)



PHP Code:

public ClCmd_Sayid )
{
    new 
szArgs64 ];
    
    
read_argsszArgscharsmaxszArgs ) );
    
remove_quotesszArgs );
    
    
    new 
arg1[16];
    new 
arg2[32];
    
    
strbreak(szArgsarg1charsmax(arg1), arg2charsmax(arg2));
    if (
equali(arg1,"/donatexp"7))
        
donate(idarg2);


Any Idea how to fix this`?

Bladell 06-19-2014 05:49

Re: if equal problem!
 
Edit:
PHP Code:

public ClCmd_Sayid 

    new 
szArgs64 
     
    
read_argsszArgscharsmaxszArgs ) ) 
    
remove_quotesszArgs 
     
     
     
    new 
arg1[16
    new 
arg2[32
     
    
strbreak(szArgsarg1charsmax(arg1), arg2charsmax(arg2)) 
    if (
equali(arg1,"/donate")) 
        
donate(idarg2


PHP Code:

public ClCmd_Sayid 

    new 
szArgs64 ]; 
     
    
read_argsszArgscharsmaxszArgs ) ); 
    
remove_quotesszArgs ); 
     
     
    new 
arg1[16]; 
    new 
arg2[32]; 
     
    
strbreak(szArgsarg1charsmax(arg1), arg2charsmax(arg2)); 
    if (
equali(arg1,"/donatexp")) 
        
donate(idarg2); 


You should read the description of this native before using it... http://www.amxmodx.org/doc/index.htm...re%2Fequal.htm
</span></span>

HamletEagle 06-19-2014 08:12

Re: if equal problem!
 
Because both comands contain donate and you are using equal wrong. You are comparing only first 7 characters.


All times are GMT -4. The time now is 21:07.

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