AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   check from X to X help (https://forums.alliedmods.net/showthread.php?t=9423)

Smokey485 01-18-2005 16:30

check from X to X help
 
I read the amxx guide thing and whatever I cant find it.

How do I check a users hp from like... 120 to 160...
cause im unsure if this would work

Code:
hp = get_user_health(id) if(hp > 120)
That would work, but not from 120 to 160, and since I have like checking for 100 & up then wouldnt it cause problems with the plugins messing it up and doing 2 things?

Ced 01-18-2005 16:45

Code:
hp = get_user_health(id) if(hp >= 120 &&  hp <= 160){

Smokey485 01-18-2005 17:12

Thanks so much! Well, back to coding this damn 900 lined thing.

Peli 01-18-2005 20:35

Well sorry to be a Troll but one small thing wrong with your plugin , and a optional change. :
Code:
   new hp = get_user_health(id)    if(hp > 119 || hp < 161)    {       // code    }
*EDIT* Fixed , but I'd sugguest using > 119 and < 161 because you wanted the exact number.

XxAvalanchexX 01-18-2005 22:52

a) Wow, I didn't know Small had segmented OR statements, if only they had this for PHP.

b) He wants to check if it is more than 120 and smaller than 160. I'm assuming yours would check if it is more than 120 or 160, but I've never used an if like that, so I can't say for sure.

Peli 01-18-2005 22:53

Avalanche , don't go mad on me , I made a mistake sorry. :(

PM 01-19-2005 09:16

Peli's code would always execute the command, because x > 120 || x < 160 is always true. Or is there a number that is smaller or equal to 120 AND bigger or equal to 160 at the same time?

Da Bishop 01-19-2005 15:00

wow.... lets look at operators please :D.. && are "and" while || are "or"... lol

PM 01-19-2005 15:33

&& is Logical AND
|| is Logical OR
& is Bitwise AND
| is Bitwise OR
^ is Bitwise XOR
I don't think there is ^^ ; ^^
Oh yes, ~ is complement.
And ! is Logical NOT

Da Bishop 01-19-2005 15:53

Quote:

Originally Posted by PM
&& is Logical AND
|| is Logical OR
& is Bitwise AND
| is Bitwise OR
^ is Bitwise XOR
I don't think there is ^^ ; ^^
Oh yes, ~ is complement.
And ! is Logical NOT

didn't think needed to explain them all.. sense only two are neccessary in his case... but yeah... thats good... plus if they don't know this maybe they should go find a tutorial... BTW pm...

<<
>>

OP

:D


All times are GMT -4. The time now is 19:18.

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