[SOLVED] How do you count down that a player is capturing something?

Post Reply
ChristienChapman
Member
Posts: 117
Joined: Sat May 28, 2022 00:04

[SOLVED] How do you count down that a player is capturing something?

by ChristienChapman » Post

My project has objects that need to be captured by players, however there is a cooldown timer that goes on for if a player is an enemy of the other team. If they are, then they will be able to capture the object after about 7.5 seconds. I could use minetest.after but what if the player moves away from the capture positions? How do I reset the timer or boolean to start timer if a player is not found at locations for capture? Whoever helps will be credited in my project.
Last edited by ChristienChapman on Thu Jul 14, 2022 00:33, edited 1 time in total.
God bless you.

List of releases:
Minetest Zombies Minigame - viewtopic.php?f=9&t=28442&p=412633#p412633

- > cdb_1d60e1a03f83

User avatar
Mr. Rar
Member
Posts: 109
Joined: Tue Oct 04, 2016 20:13
GitHub: MrRar
In-game: MrRar

Re: How do you count down that a player is capturing something?

by Mr. Rar » Post

minetest.after() returns an object that has a method cancel() that you can call to cancel the timer.
For example:
local job = minetest.after(1, my_event)
job:cencel()
"Only in Christ do we find real love, and the fullness of life. And so I invite you today to look to Christ." - St. John Paul II

ChristienChapman
Member
Posts: 117
Joined: Sat May 28, 2022 00:04

Re: How do you count down that a player is capturing something?

by ChristienChapman » Post

Wow thanks. This would have been great for a project I was working on but I recently cancelled it! Still great advice nonetheless thanks.
God bless you.

List of releases:
Minetest Zombies Minigame - viewtopic.php?f=9&t=28442&p=412633#p412633

- > cdb_1d60e1a03f83

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests