Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Any possible way to make a function on a script run once?

Share questions, scripts and tutorials related to the ScriptAPI in SFD.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Ol1vver
Fighter
Fighter
Posts: 30
Joined: Mon Nov 19, 2018 4:55 pm
SFD Alias: Ol1vver
Started SFD: PreAlpha 1.6
Gender:

Any possible way to make a function on a script run once?

Post by Ol1vver » Tue Jan 01, 2019 5:02 pm

Hello,
I have a script that checks for the player's actions.
I want to make every action run only once, but instead it runs twice or more. (depends on what time you set to the timertrigger as we all know)
Something like this:

Code: Select all

public void CheckPlayers(TriggerArgs args)
{
	foreach(IPlayer ply in Game.GetPlayers())
	{
		if(ply.IsWalking && ply.IsBlocking(RunOnce1))
		{
			ply.Gib();
		}
		if(ply.IsIdle)
		{
			RunOnce1.Reset();
		}
	}
}
Basically something like script sleeping.

If you didn't understand something, PM me or reply to this post.
0 x
Why are you reading my signature?

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests