Reducing a Variable OnPlayerUpdate
#1

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.
Reply
#2

It must be a float. Change the definition to:

pawn Код:
new Float:FireHealth;

FireHealth -= 0.5;
Reply
#3

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.
Reply
#4

bump.
Reply
#5

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

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

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
Reply
#8

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.
Reply
#9

https://sampwiki.blast.hk/wiki/Floatround
Reply
#10

delete this post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)