Pivity

Keeping Hunger While Changing Job

Last read Never
#1

Is it possible to make the percentage of hunger not replenished when spawning, when changing jobs?

#2

Once again blind shot, not sure if this works, it might cause some issues but give it a try:


DarkRP/gamemode/modules/hungermod/sv_hungermod.lua

comment the first 4 lines out (add --[[ in front of line 1 and a --]] at the end of line 4

Same thing as before, this will be overwritten as soon as you update DarkRP!

Friendly x 1
#3

Could use the following:

hook.Add("InitPostEntity", "RemoveHMPlayerSpawn", function()

hook.Remove("PlayerSpawn", "HMPlayerSpawn")

end)


Might be worth learning Lua or getting yourself a developer instead of asking here. You won't learn much here.

Winner x 1Friendly x 1
#4

BullyHunter I'm amazed by the fact that I didn't think of this. Literally the easiest and cleanest solution.

Friendly x 2
#5

Thanks, guys.The best.

#6

Can you tell me how to make hunger turn off when no one is playing as a cook?

#7

There should be some addons that could do that:


https://github.com/EstevanTH/MR_GMod_miscellaneous_scripts/tree/master/DarkRP/No%20Hunger%20when%20no%20Cook


Just looked into the code it seems to check on every tick whether there's a cook online or not. If you have a huge server with a lot of players this might go into perfomance... Not sure tho, give it a try, but keep it in mind if you ever face lag issues in future.

#8

Thanks, the server is quite big. Well, Ill try to use it. Its cool when there are people like you who help noobs like me :)

#9

That's what the forums are made for, as long as you ask nicely there will usually always be people willing to help!

Best of luck!

Winner x 1
#10

I personally check on every job change rather than every tick, since people aren't changing jobs 66 times a second.

You can use this hook OnPlayerChangedTeam and then use the break keyword to stop looping through your players once it finds a cook or something

Winner x 1
Users viewing this thread
Nobody