Hello,
I have problems implementing a set_task, which gets repeated as long as a variable is false. This was what I tried first:
Code:
public func1(id, opid) {
new params[2];
params[0] = id;
params[1] = opid;
while (status == false) {
set_task(5.0, "func2", 0, params, 2);
}
}
public func2(id, opid) {
client_print(0, print_chat, "IM IN FUNC2");
client_print(0, print_chat, "IM IN FUNC2");
client_print(0, print_chat, "IM IN FUNC2");
}
Result: CS freezes when calling func1().
Then I tried this:
Code:
public func1(id, opid) {
new params[2];
params[0] = id;
params[1] = opid;
set_task(5.0, "func2", 0, params, 2);
}
public func2(id, opid) {
new params[2];
params[0] = id;
params[1] = opid;
if (status == false) {
set_task(5.0, "func2", 0, params, 2);
}
client_print(0, print_chat, "IM IN FUNC2");
client_print(0, print_chat, "IM IN FUNC2");
client_print(0, print_chat, "IM IN FUNC2");
}
Result: func2() did not get executed a single time.
The variable "status" is false when calling func1() and gets true in a specific event. The task should be repeated as long as status is false. I can't get it why my attempts are unsuccesfull for this.