Jump to content
Sign in to follow this  
Desrat

check is task exists

Recommended Posts

How would I evaluate if a task already exists? I need to see if it exists so I can remove it if necessary. Ive tried with no success.

if (isNull tskobj1) then {
// do nothing
} else {
player removeSimpleTask tskobj1;
};

Share this post


Link to post
Share on other sites

isNil checks if something is defined - remember to wrap it in quotes

if (isNil "tskobj1") then

Edited by cuel

Share this post


Link to post
Share on other sites

How are you in a situation where you're unsure which tasks a player has? You create the tasks, how can you not know? :)

Share this post


Link to post
Share on other sites

Mission is random generated but this script repeats every time a new task is created, so if a task already exists I delete it and create a new one, however when the mission starts (or JIP) the client has no mission so it can't be deleted.

If I don't check for its existence and code around it a "undefined variable" error occurs.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×