AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   IF problem (https://forums.alliedmods.net/showthread.php?t=19464)

Stormsys 10-17-2005 14:02

IF problem
 
its not an error but i dont like seeing warnings:P

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 -- 18) : warning 215: expression has no effect


ok how do i fix my code up

Knare 10-17-2005 15:09

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

Hawk552 10-17-2005 16:20

Probably enabled[0] == 0 would do the trick.

XxAvalanchexX 10-17-2005 17:00

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.

mysticssjgoku4 10-17-2005 17:47

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 }

XxAvalanchexX 10-17-2005 18:46

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.


All times are GMT -4. The time now is 23:43.

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