A tricky one (funcname[])
#1

im curious about is
is it possible to remove the "funcname[]) from SetTimer(funcname[], interval, repeating)

for a simple and clear example

from
SetTimer(funcname[], interval, repeating)
to
SetTimer(interval, repeating)


thanks in advance

Lookin

EDIT: btw im just curious Timers have nothing to do with why im wondering it was just the simplest code so that there where no hassles in the question
Reply
#2

Set a timer to do what? You're not making any sense.
Reply
#3

#define SetMyTimer(%1,%2) SetTimer(#MyTimer,%1,%2)

If that's what you mean.
Reply
#4

Quote:
Originally Posted by Dan..
Посмотреть сообщение
#define SetMyTimer(%1,%2) SetTimer(#MyTimer,%1,%2)

If that's what you mean.
That doesn't make sense either.
Reply
#5

Timers execute the code in a function after a set interval. Setting a timer without specifying the function is like displaying a transparent textdraw to a player!
Reply
#6

you could use a blank function name, however why not tell us the real reason you're wondering
Reply
#7

ok.
for example:
I wanted to make a timer include that made one timer work like
pawn Код:
ST(S(5), 1); // 5 seconds
rather than
pawn Код:
SetTimer(funcname[], interval, repeating)
im just using
pawn Код:
SetTimer(interval, repeating)
so that i can have multiple functions using just one timer
like this

pawn Код:
public DoSomeThingHere1()
{
    SendClientMessageToAll(LIGHT_BLUE,"MSG1");
    ST(S(5),1); //5 seconds
    return 1;
}

public DoSomeThingHere2()
{
    SendClientMessageToAll(LIGHT_BLUE,"MSG2");
    ST(S(5),1); //5 seconds
    return 1;
}
also was going to add in a question, may as well do it here. how would i make processing cmds and timers to read and write faster?
Reply
#8

Isn't that exactly what y_timers does?
Reply
#9

I have no idea ive never looked at the inc

anyways im just wondering if it can be done or not ive never said im working on anything
Reply
#10

Quote:
Originally Posted by Lookin
Посмотреть сообщение
ok.
for example:
I wanted to make a timer include that made one timer work like
pawn Код:
ST(S(5), 1); // 5 seconds
rather than
pawn Код:
SetTimer(funcname[], interval, repeating)
im just using
pawn Код:
SetTimer(interval, repeating)
so that i can have multiple functions using just one timer
like this

pawn Код:
public DoSomeThingHere1()
{
    SendClientMessageToAll(LIGHT_BLUE,"MSG1");
    ST(S(5),1); //5 seconds
    return 1;
}

public DoSomeThingHere2()
{
    SendClientMessageToAll(LIGHT_BLUE,"MSG2");
    ST(S(5),1); //5 seconds
    return 1;
}
also was going to add in a question, may as well do it here. how would i make processing cmds and timers to read and write faster?
Quote:
Originally Posted by ******
Посмотреть сообщение
I'm still not clear how you want to specify which functions are called by your timer without that parameter...



There are multiple libraries for that - the most famous is probably ZCMD, but I'd say y_commands (and y_timers for timers).
Ok

public DoSomeThingHere2()
{
SendClientMessageToAll(LIGHT_BLUE,"MSG2");
ST(S(5),1); //only starts the timer in this function for the duration the function is called
return 1;
}

so that all it needs to do is count to the set amount of time (in this case S(5)) this function is used for rather than use a public and function name, all it knows is to use this function for the time set

And i didnt really plan it out or anything i was just curious if it was possible.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)