SA-MP Forums Archive
Reducing a Variable OnPlayerUpdate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Reducing a Variable OnPlayerUpdate (/showthread.php?tid=528756)



Reducing a Variable OnPlayerUpdate - MikeEd - 29.07.2014

Hi, i'm new to this forum.

I just need help on this following code.

pawn Код:
FireHealth -= 1;
This code is placed under OnPlayerUpdate and i'd like to know if there is anyway to reduce it by 0.5

Thanks in Advance.


Re: Reducing a Variable OnPlayerUpdate - Tamer - 29.07.2014

It must be a float. Change the definition to:

pawn Код:
new Float:FireHealth;

FireHealth -= 0.5;



Re: Reducing a Variable OnPlayerUpdate - MikeEd - 29.07.2014

Mhm, tired that and the it set the fire health to about 126253526/100 and i was trying to put it out and it went out before it went to 0.


Re: Reducing a Variable OnPlayerUpdate - MikeEd - 31.07.2014

bump.


Re: Reducing a Variable OnPlayerUpdate - MikeEd - 11.09.2014

This problem is still not solved, i'd love some help.


Re: Reducing a Variable OnPlayerUpdate - Ihateyou - 11.09.2014

because when u display the variable u need to use %f (float) not %d (integer)


Re: Reducing a Variable OnPlayerUpdate - MikeEd - 11.09.2014

Thanks, one last question... It prints our something like 100.000/100 how am i suppose to change that to just the integer, i've tried float round but it results in 0.00000


Re: Reducing a Variable OnPlayerUpdate - Tamer - 12.09.2014

Quote:
Originally Posted by MikeEd
Посмотреть сообщение
Thanks, one last question... It prints our something like 100.000/100 how am i suppose to change that to just the integer, i've tried float round but it results in 0.00000
Hey again,

which round method did you use? Also are you sure if your float was actually a float, or was it set? Because if the number is not a float or it is not set you'll get 0.

Edit: One second I'm on this.

Instead of using %f use : %0.3f now that will only give 3 digits, if you need more adjust the number, or decrease it.


Re: Reducing a Variable OnPlayerUpdate - RedCrossER - 12.09.2014

https://sampwiki.blast.hk/wiki/Floatround


Re: Reducing a Variable OnPlayerUpdate - Ihateyou - 12.09.2014

delete this post