[Help] Calling function via string - 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: [Help] Calling function via string (
/showthread.php?tid=289687)
[Help] Calling function via string -
BloodMaster - 12.10.2011
How can I call function via string.
I have "xyz" saved at file like "xyz = 55.446,4244.4148,49974.54554", how i can call it in some function (Like SetPlayerPos)
Here is some examples;
Code:
string_with_this_floats = "55.446,4244.4148,49974.54554";
format(string,128,"%s",string_with_this_floats);
CallSomeFunction("SetPlayerPos", "fff",string);
or
Code:
string_with_this_floats = "55.446,4244.4148,49974.54554";
format(string,128,SetPlayerPos(playerid,%s),string_with_this_floats);
CallSomeFunction(string);
Or any way, just help
Re: [Help] Calling function via string -
IstuntmanI - 12.10.2011
Try with Sscanf + strfloat, or simply save x = posX, another line: y = posY, another line: z = posZ and SetPlayerPos( playerid, SetPlayerPos( playerid, dini_Float( file, "x" ), dini_Float( file, "y" ), dini_Float( file, "z" ) ); or with what writing system do you use.
Re: [Help] Calling function via string -
BloodMaster - 12.10.2011
sscanf + strfloat is good combination, I'm totally forgot of sscanf, ty very much...
Lock