AddFoodExhaustion
#1
I want to make player's food bar be decreased on moving. I tried with this, but don't work.
Code:
function OnPlayerMoving(Player)
    Player:AddFoodExhaustion(1)
end
What's wrong? How can AddFoodExhaustion be used? If you can, add an explanation on the wiki.
I saw that in Player.cpp is used like this:
Code:
Player:AddFoodExhaustion(0.3f)
I tried with it but I get a malformed numbers error.
Reply
Thanks given by:
#2
Haven't yet looked at the actual code behind this, my guess is that the hunger is not sent to the client in the AddFoodExhaustion() function.

As for the malformed number, "0.3f" is a c/c++'s way of saying "this number is a single-precision floating-point number, rather than double-precision floating-point number"; in Lua, you need to drop the f: "0.3".
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)