Pass variables of types like File or Text to timer function?
#1

Hi,

how can I pass a variable initialized with a type like File or Text to a timer function?

If I just pass the variable I get "warning 213: tag mismatch". But it's working.


Example:
Code:
SomeFunction()
{
    new File:myFile = fopen("myfile.txt", io_read);
    if (myFile)
    {
        SetTimerEx("MyTimer", 10000, false, "d", myFile);// Compiler throws "warning 213: tag mismatch"
    }
}

forward MyTimer(File:file);
public MyTimer(File:file)
{
    // do something with the file handle
}
How can I get rid of this warning?
Reply
#2

SetTimerEx("MyTimer", 10000, false, "i", _:myFile);
Reply
#3

You can get rid of the tag mismatch warning like this:
Code:
SetTimerEx("MyTimer", 10000, false, "d", _:myFile);
Edit: slow
Reply
#4

Check what you are missing...You are missing something which is basically what the "tag mismatch" warning means.

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#5

Quote:
Originally Posted by Kar
View Post
SetTimerEx("MyTimer", 10000, false, "i", _:myFile);
Works! Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)