Problem with function tags - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with function tags (
/showthread.php?tid=67239)
Problem with function tags -
Amit_B - 27.02.2009
Hello.
I tried to create my own fopen function..
But anything I do just dont work.
It's always give warning(s) because the function / variables tag.
Here is the function:
pawn Код:
stock file_open(fname[],mode=1)
{
if(!isValidFName(fname)) return -1, printf("ERROR: invalid file name (file_open(\"%s\",%d))",fname,mode);
if(!fexist(fname) && mode != 1 && mode != 4) return -2, printf("ERROR: file not exist (file_open(\"%s\",%d))",fname,mode);
new filemode:fMod = io_write;
switch(mode)
{
case 1: fMod = io_write;
case 2: fMod = io_append;
case 3: fMod = io_read;
case 4: fMod = io_readwrite;
}
new File:f = fopen(fname,fMod);
if(!f) return 0;
return f;
}
I tried to use "File:" before the function name... still not work.
Thanks for helpers.
Amit_B
Re: Problem with function tags -
Nubotron - 27.02.2009
You can not return 2 types of variables.