How to use argument {Float,_}... in 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: How to use argument {Float,_}... in function? (
/showthread.php?tid=354237)
How to use argument {Float,_}... in function? -
Prosettur - 26.06.2012
Example:
format(sring,200,"%s",HERE MUST BE THIS ARGUMENT);
How?
Re: How to use argument {Float,_}... in function? -
JaTochNietDan - 26.06.2012
https://sampforum.blast.hk/showthread.php?tid=77000
Explained quite well there.
Re: How to use argument {Float,_}... in function? -
Prosettur - 26.06.2012
Problem.
Код:
FileGet(Filename[],const Format[],{Argument}:...)
{
if(!fexist(Filename)) return 0;
new File:Handle = fopen(Filename,io_read);
new String[150];
fread(Handle,String);
for(new X = 1; X < numargs(); X++)
{
new Arguments = Argument:getarg(X);
sscanf(String,Format,Arguments);
}
fclose(Handle);
return 1;
}
Код:
C:\Documents and Settings\user\Pulpit\Serwer\filterscripts\Truck.pwn(7) : warning 213: tag mismatch
C:\Documents and Settings\user\Pulpit\Serwer\filterscripts\Truck.pwn(52) : warning 213: tag mismatch
Код:
public OnFilterScriptInit()
{
new cos[1];
FileGet("Cos.ini","i i i",cos[0]);
return 1;
}
Re: How to use argument {Float,_}... in function? -
JaTochNietDan - 26.06.2012
I believe in that case what you are looking for is just the ..., as the stuff within the curly brackets defines a tag type to allow. You need only use the ... for integers:
pawn Код:
FileGet(Filename[], const Format[], ...)
{
if(!fexist(Filename)) return 0;
new File:Handle = fopen(Filename,io_read);
new String[150];
fread(Handle,String);
for(new X = 1; X < numargs(); X++)
{
new Arguments = getarg(X);
sscanf(String, Format, Arguments);
}
fclose(Handle);
return 1;
}