Posts: 1,233
Threads: 269
Joined: Oct 2008
Reputation:
0
Hey I have question, I want to make drug addiction system but lets say if player is addicted and if I put if statement under OnPlayerUpdate is this smart choice? Or should I make new call back and one timer that will be checking if player is addicted, how should I make that thing..?
Posts: 3,002
Threads: 86
Joined: Jul 2010
Reputation:
0
onplayerupdate is called very frequently per second per player. It's not a good idea to use it. I suggest making a timer instead. Maybe 0.5 to 1 second.
Posts: 1,241
Threads: 67
Joined: Dec 2013
No make a timer which checks each 1 Second
Posts: 1,233
Threads: 269
Joined: Oct 2008
Reputation:
0
Okay for example new callback and timer that will be checking that timer every 1 second:
new timer...
SetTimerEx..."Addicted" 1000
public Addicted
{
if(addicted... == 1)
{
Here?
Timer will be checking if player is addicted right? but I need to make some effect like loosing health every 5 minutes if player will be addicted, but that means if I will put timer under if statement that is checked every 1 second by timer it will start mulitply timers and it will fuck up my code?
Posts: 1,233
Threads: 269
Joined: Oct 2008
Reputation:
0
Yes I understand that but won't that 1 sec timer call other timer many times? because player is addicted and there is if statement about that if player is addicted it will call timers every second.. ? This is what I want to know and how to make it so it will call second timer only once
Posts: 1,233
Threads: 269
Joined: Oct 2008
Reputation:
0
I think this code is exactly what I'm looking for, thank you rep for all of you