Raised This Month: $ Target: $400
 0% 

tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-31-2010 , 06:11   tag mismatch
Reply With Quote #1

hi,

sorry but i dont know what i did wrong.

PHP Code:
public player_menu(id)
{
    if(
get_pcvar_num(g_leach_cvar) == 0//The Leader has Flag
    
{
        if(!
g_player_is_leader[iPlayer] || !get_user_flags(id) & ADMIN_ADMIN)
        {
            
client_print(id,print_chat,"You are not the leader.only the leader has acces to use this command")
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
showing_menu(id)
        }
    }
    else if(
get_pcvar_num(g_leach_cvar) == 1//Only admin has Flag
    
{
        if(!
get_user_flags(id) & ADMIN_ADMIN)
        {
            
client_print(id,print_chat,"Only admin has acces to use this command.")
            return 
PLUGIN_HANDLED;
        }
        if(
get_user_flags(id) & ADMIN_ADMIN)
        {
            
showing_menu(id)
        }
    }
    return 
PLUGIN_HANDLED

i get :

PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

C
:\Programme\AMX Mod X\pawn\temp720.sma(28) : warning 213tag mismatch
C
:\Programme\AMX Mod X\pawn\temp720.sma(40) : warning 213tag mismatch
Header size
:           1108 bytes
Code size
:             6716 bytes
Data size
:             2112 bytes
Stack
/heap size:      16384 bytesestimated maxusage=781 cells (3124 bytes)
Total requirements:   26320 bytes

2 Warnings
.
Done.

Compilation Time0,42 sec 
where am i wrong ? oO
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 01-31-2010 , 06:16   Re: tag mismatch
Reply With Quote #2

You are using a bitwise operation between a boolean and an integer, use bitwise not:
Code:
~get_user_flags(id) & ADMIN_ADMIN
instead of logical not:
Code:
!get_user_flags(id) & ADMIN_ADMIN
Seta00 is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-31-2010 , 06:19   Re: tag mismatch
Reply With Quote #3

damn :-))))

ty
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-31-2010 , 06:33   Re: tag mismatch
Reply With Quote #4

You still make beginners errors like

if( get_pcvar_num( blabla ) == 0 )
else if( get_pcvar_num( blabla ) == 1 )

First line implies that second line is equal to 1, so you don't need to check again the cvar.
If the cvar can take more than 0/1, then cache the result in a var, or use a switch operator.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 01-31-2010 , 06:56   Re: tag mismatch
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
You still make beginners errors like

if( get_pcvar_num( blabla ) == 0 )
else if( get_pcvar_num( blabla ) == 1 )

First line implies that second line is equal to 1, so you don't need to check again the cvar.
If the cvar can take more than 0/1, then cache the result in a var, or use a switch operator.
yop. i just wanted to be sure about this forgot to edit it its now attached in new plugins i know i have there many wrong codes hope anyone will flame about the code
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-31-2010 , 17:17   Re: tag mismatch
Reply With Quote #6

Code:
~get_user_flags(id) & ADMIN_ADMIN
=?

Code:
!(get_user_flags(id) & ADMIN_ADMIN)
right? Just wanted to make sure. I usually stick with logical operators when I can. They are easier to comprehend for me .
__________________
fysiks is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-01-2010 , 08:28   Re: tag mismatch
Reply With Quote #7

Yes, it's the same.
__________________
Arkshine 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 07:25.


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