SA-MP Forums Archive
need help [system] - 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: need help [system] (/showthread.php?tid=651785)



need help [system] - BulletRaja - 27.03.2018

how can i make thirst system, like the player take steps then the thirst level should go automatically down i know i can done this with timer but i want to do this without timer if i can .


Re: need help [system] - FaLLenGirL - 27.03.2018

The question is you know how to do it with a timer ?
Cause, i think you are here just because you hope somebody will do this for you, and.. literally that's not a good idea.
I don't think so there's another solution just with a timer. It's the fastest way to make this system and it's not hard at all.


Re: need help [system] - AdamsLT - 27.03.2018

I guess you could try adding it into OnPlayerUpdate.
Maybe setting a variable to know when was the last update and only updating if a second has passed or whatever. Not sure if this is effective and worth the resources and could also work in unexpected ways since it triggers a different amount of times, depending on what the player is doing.

Other than that, you could go all around your gamemode and add an increase in thirst every time the player does something that would make him thirsty, like doing an animation or whatever.


Re: need help [system] - BulletRaja - 27.03.2018

Quote:
Originally Posted by AdamsLT
Посмотреть сообщение
I guess you could try adding it into OnPlayerUpdate.
Maybe setting a variable to know when was the last update and only updating if a second has passed or whatever. Not sure if this is effective and worth the resources and could also work in unexpected ways since it triggers a different amount of times, depending on what the player is doing.

Other than that, you could go all around your gamemode and add an increase in thirst every time the player does something that would make him thirsty, like doing an animation or whatever.
as somebody said me always be away from timers tahts why i dont want timer in my script


Re: need help [system] - FaLLenGirL - 27.03.2018

Yea well using timers it's not something bad. Using "OnPlayerUpdate" like a timer it is something really bad. Because your server can freeze, i had this problem in past because i used OnPlayerUpdate for all "timer" or how to say it for all that players must update into a normal timer i used with "OnPlayerUpdate". And my advice is to use the timers if you want to do this system, because from my opinion if you do everything right, nothing can go wrong.


Re: need help [system] - iKarim - 27.03.2018

Quote:
Originally Posted by BulletRaja
Посмотреть сообщение
as somebody said me always be away from timers tahts why i dont want timer in my script
There's nothing wrong with correctly using timers, that's something for sure. It depends on the interval, anything that's not called very frequently is and should be fine.


Re: need help [system] - BulletRaja - 28.03.2018

thanks all my thirst system is ready with timer for my dayz