SA-MP Forums Archive
Dynamic value types to CallLocalFunction - 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: Dynamic value types to CallLocalFunction (/showthread.php?tid=376235)



Dynamic value types to CallLocalFunction - Kovacs_Richard - 09.09.2012

hello, i want call CallLocalFunction with dynamic variable type...(sry for my bad english)

i tried this code:
Код:
((form[funcid][0] == 's')?val[0]:(form[funcid][0] == 'f')?floatstr(val[0]):strval(val[0]))
but i got 2 errors:
Код:
X\pawno\include\loader.inc(165) : warning 213: tag mismatch
X\pawno\include\loader.inc(165) : error 033: array must be indexed (variable "val")
my last chance is 0-8 length formats and 3 type variables with this code:
Код:
	if(strlen(form[funcid]) == 2)
	{
	    /*
	        ii
	        ff
	        ss
	        if
	        fi
	        is
	        si
	        fs
	        sf
	    */
		
		if(form[funcid][0] == 'i' && form[funcid][1] == 'i')
		{ CallLocalFunction(func[funcid],form[funcid],strval(val[0]),strval(val[1])); }
		else if(form[funcid][0] == 'f' && form[funcid][1] == 'f')
		{ CallLocalFunction(func[funcid],form[funcid],floatstr(val[0]),floatstr(val[1])); }
		else if(form[funcid][0] == 's' && form[funcid][1] == 's')
		{ CallLocalFunction(func[funcid],form[funcid],val[0],val[1]); }
	}
anyone know a good solution?


Re: Dynamic value types to CallLocalFunction - Kovacs_Richard - 09.09.2012

okay thanks i will try it