Pass variables of types like File or Text to timer function? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Pass variables of types like File or Text to timer function? (
/showthread.php?tid=338975)
Pass variables of types like File or Text to timer function? -
Programie - 01.05.2012
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?
Re: Pass variables of types like File or Text to timer function? -
Kar - 01.05.2012
SetTimerEx("MyTimer", 10000, false, "i", _:myFile);
Re: Pass variables of types like File or Text to timer function? -
Finn - 01.05.2012
You can get rid of the tag mismatch warning like this:
Code:
SetTimerEx("MyTimer", 10000, false, "d", _:myFile);
Edit: slow
Re: Pass variables of types like File or Text to timer function? -
Passout - 01.05.2012
Check what you are missing...You are missing something which is basically what the "tag mismatch" warning means.
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: Pass variables of types like File or Text to timer function? -
Programie - 01.05.2012
Quote:
Originally Posted by Kar
SetTimerEx("MyTimer", 10000, false, "i", _:myFile);
|
Works! Thanks