AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] Why it's do not work ? (https://forums.alliedmods.net/showthread.php?t=189008)

Aooka 07-02-2012 16:19

[ Solved ] Why it's do not work ?
 
Code:
#include < amxmodx > #include < fun > public plugin_init( ) {     register_plugin( "Special Health Gravity" , "1.2" , "Aooka" );         register_event( "Health" , "EventHealth" , "be" ); } public EventHealth( id ) {     new iHealth = read_data( 1 );         if( iHealth != 0 )     {         set_user_gravity( id , float( iHealth / 100 ) );     }     return 0; }

All is in the title... Thanks :)

<VeCo> 07-02-2012 16:26

Re: [ Request ] Why it's do not work ?
 
PHP Code:

set_user_gravityid iHealth 100.0 ); 

Because, first is executed that expression into the float function, then the native makes it as a float. As an integer, every number below 100 will give 0 (99 / 100 = 0.99 , but as int it is rounded to 0, then you make that 0 to float = 0.0 gravity which the native sets as 1.0).

Aooka 07-03-2012 03:35

Re: [ Request ] Why it's do not work ?
 
Oh thanks a lot Veco. I go test it :)


All times are GMT -4. The time now is 15:21.

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