SetTimerEx
#1

hi guys, is there any possibility to set a variable after a timer has count up to a specified value like Variable=69?(without new public fuction())
ok you can also help me if somebody would tell me a little bit about the function "SetTimerEx"!

here my utopian imagination:
(hope there is a way to script something like this)
pawn Код:
SetTimerEx("???", 1000, false, Variable++);//to incease with one it's than 70 after the timer has count up
hope one sophisticated scripter can help me
Reply
#2

So you want to start the timer 70 times and then no more?
Reply
#3

double post...
Reply
#4

As you did it it shouldn`t work.

Why don`t you increase the variable by one in the function "??" you call after 1000ms?

Like that:

Код:
public SetTimerEx("VariableIncrease", 1000, false, "d", Variable);

VariableIncrease(&var){
	var++;
}
Reply
#5

lol first, thanks for the proposals! But I want to know how i can set a variable after a certain time like var1?
and on timer2 var2 and so on
I dont want to create for 100 variables 100 functions like
pawn Код:
Timer1=SetTimer("Function_for_varibale_1",3000,false); //Everywhere in a public function
pawn Код:
Timer2=SetTimer("Function_for_varibale_2",3000,false); //Everywhere in another public function
pawn Код:
public Function_for_varibale_1()
{
var1++;
}
pawn Код:
public Function_for_varibale_2()
{
var2++;
}
I just need a timer who set a variable after this timer's time(I've over 50 variable) So i need 50 timer but i also need 50 public functions? hope u know what i mean
Reply
#6

Why would you create a new function for each variable?

You only need one function and you simply pass in each variable you want to change.

Let`s say you got var1, var2 and var3 you want to increase by one.

You use the function in the code above and call it for each variable like this:

SetTimerEx("VariableIncrease", 1000, false, "d", var1);
SetTimerEx("VariableIncrease", 1000, false, "d", var2);
SetTimerEx("VariableIncrease", 1000, false, "d", var3);

And all of them will be increased by one after 1k ms.
Reply
#7

ok is your example like this:
pawn Код:
SetTimerEx("VariableIncrease", 1000, false, "d", var1);
pawn Код:
public VariableIncrease()
{
var1++;
var2++;
}
But After 1 second ALSO var2 will set but i Dont want this.
Reply
#8

Look at my code which is not like yours.

Код:
SetTimerEx("VariableIncrease", 1000, false, "d", var1);

VariableIncrease(&var){
	var++;
}
This will increase var1 by 1.

If you want to increase other variables you can just do:

Код:
SetTimerEx("VariableIncrease", 1000, false, "d", var2);
SetTimerEx("VariableIncrease", 1000, false, "d", var3);
SetTimerEx("VariableIncrease", 1000, false, "d", var4);
and so on...
Reply
#9

Код:
SetTimerEx("VariableIncrease", 1000, false, "d", var1);

VariableIncrease(&var){
	var++;
}
but var1 is not equal to var
or?
Reply
#10

Nah... simply explained: in VariableIncrease the variable you pass in when doing SetTimerEx gets called "var".

In the first case "var1" gets declared as var inside the function.
When you pass in var2, var2 gets declared as var and so on.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)