AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_aiming => unintended assigment (https://forums.alliedmods.net/showthread.php?t=27817)

wouter 04-30-2006 09:36

get_user_aiming => unintended assigment
 
this is what i got
Code:
public dontshoot(id)     {     if ( ! get_cvar_num("amx_camouflage") )           return PLUGIN_HANDLED           new index, bodypart, distance = 99999;     get_user_aiming(id, index, bodypart, distance);         if(is_user_connected(index) && is_user_alive(index))         {         if(get_user_team(id) != get_user_team(index))             {             // looking at enemy => check for camouflage             if(HasCamo[index] = true)  // warning 211: possible unintended assigment                 {                 set_hudmessage(0, 0, 255, -1.0, -1.0, 0, 6.0, 7.0)                 show_hudmessage(id, "He is a friend!\nDo not shoot!")               }         }         else             {             // not looking at enemy => do nothing             return PLUGIN_HANDLED                   }     }     return PLUGIN_HANDLED }

can someone tell me how to fix this warning?

Willmaker 04-30-2006 09:40

With:
Code:
 if(HasCamo[index] = true)

With this, your basically trying to set HasCamo[index] to true, hence unintended assignment.

What you want is:

Code:
 if(HasCamo[index] == true)

wouter 04-30-2006 09:43

oh stupid of me.

thx

[ --<-@ ] Black Rose 04-30-2006 11:01

you could also do it like so:
Code:
 if ( HasCamo[index] )

wouter 05-01-2006 12:49

must it be a loob to work?
because it does nothing :oops:


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

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