Where would I look if I wanted to implement a gone idle call on #0? #88
-
So I realise this is somewhat of a thing that maybe not many people would want. I just need some help on, the server would have the ability, pseudo code style to do something like: server_loop starts: Is this something that would be doable? Where should I be looking here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Certainly doable, though I think you'd be better served just writing this in your database. Use a heart, task scheduler or similar mechanism if you have one. Schedule it to run every n, where n is your interval (300 seconds). Every run of your task, check connected players, and a property you add to your generic player class which keeps track of the last command time: for i in (connected_players())
if(time() - `i.last_command_time ! E_PROPNF => time()' > 300)
"Call your gone idle verb here";
endif
yin();
endfor In #0:do_command, before you return, update that property on the player with the current time. |
Beta Was this translation helpful? Give feedback.
Certainly doable, though I think you'd be better served just writing this in your database. Use a heart, task scheduler or similar mechanism if you have one. Schedule it to run every n, where n is your interval (300 seconds). Every run of your task, check connected players, and a property you add to your generic player class which keeps track of the last command time:
In #0:do_command, before you return, update that property on the player with the current time.
That code also falls back to the current time if the prop can't be found on…