Raised This Month: $ Target: $400
 0% 

Whats the expressio for something like"except"?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
e12harry
Member
Join Date: Apr 2010
Old 10-03-2011 , 04:00   Re: Whats the expressio for something like"except"?
Reply With Quote #4

It depends on what you want to achieve.
If you want to check if player has any other weapon than AK (including knife and c4):
PHP Code:
stock bool:userHasOtherWeaponsThanAk(id)
{
    new 
weapons[32];
    new 
num;
    
get_user_weapons idweaponsnum );
    if(
num >1)
        return 
true;
    if(
num == && weapons[0] != CSW_AK47)
        return 
true;
    return 
false;

This stock will return false only if player do not have any weapons or he has got only AK.


If you want to check if player has other weapon than AK (but let him have knife and C4):

PHP Code:
stock bool:userHasOtherWeapons(idweapon)
{
    new 
weapons[32];
    new 
num;
    
get_user_weapons idweaponsnum );
    new 
weapon;
    for(new 
i=0;i<num;i++){
        
weapon weapons[i];
        if(
weapon != CSW_AK47
            
&& weapon != CSW_KNIFE     //delete this line if user can not have knife
            
&& weapon != CSW_C4    //delete this line if user can not have C4
        
)
        return 
true;
    }
    return 
false;

This will return false if player has other weapons than AK, knife and C4

Last edited by e12harry; 10-03-2011 at 04:32.
e12harry is offline
 



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 19:33.


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