Raised This Month: $ Target: $400
 0% 

IF problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stormsys
Member
Join Date: Oct 2005
Old 10-17-2005 , 14:02   IF problem
Reply With Quote #1

its not an error but i dont like seeing warnings

right i moved some of my functions into a .inc to make it tidyer,

and to make shure the plugin is enabled and that the person is an admin in those functions
Code:
[line 16]if(enabled == 0 || !get_user_flags(id)&ADMIN_LEVEL_F){ [line17]    PLUGIN_HANDLED [line18]}
now i get:

Welcome to the AMX Mod X 1.60-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

sshp_restore.inc(16) : warning 213: tag mismatch
sshp_restore.inc(17 -- 1 : warning 215: expression has no effect


ok how do i fix my code up
Stormsys is offline
Knare
Member
Join Date: Oct 2004
Location: New York, USA
Old 10-17-2005 , 15:09  
Reply With Quote #2

Code:
if(enabled[] == 0 || !get_user_flags(id)&ADMIN_LEVEL_F){  // usually a blank array solves problem like this :/ return PLUGIN_HANDLED  // needs the "return" }

Try this
__________________
0110101100111011100110000101110010011001
Knare is offline
Send a message via AIM to Knare Send a message via MSN to Knare
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-17-2005 , 16:20  
Reply With Quote #3

Probably enabled[0] == 0 would do the trick.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-17-2005 , 17:00  
Reply With Quote #4

My guess is that enabled is a boolean variable, and 0 is an integer expression, so check to see if it equals false instead of 0, but I can't be sure because you didn't show how you created the variable.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 10-17-2005 , 17:47  
Reply With Quote #5

The Variable could be indexed and you are using a variable in that case try

Code:
if(equali(enabled,"0") || !get_user_flags(id)&ADMIN_LEVEL_F){ PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-17-2005 , 18:46  
Reply With Quote #6

If it was an array then it would've given off an "array must be indexed"warning instead of "tag mismatch". Also, "enabled" is a name that strikes me as yes or no, so I'm guessing he declared it as boolean, but he checked it for an integer value.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 23:43.


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