SA-MP Forums Archive
question - 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: question (/showthread.php?tid=650072)



question - AstroPoid - 20.02.2018

if i used comman float in the top of filterscript , and i used it in multiple stuff for example ( a command or a public that call back the floats ), if 2 persons or more used them , the float value will be over each time one use ? or it will store both ?
for more explaniation:
Код:
new Float:x, Float:y, Float:z;

CMD:getmypos(playerid, paramas[])
{
	GetPlayerPos(playerid, x, y, z);
	return 1;
}



Re: question - iKarim - 20.02.2018

That's generally a bad practice and you should never do it unless you need to store the position globally which you'll need to use arrays for.

PHP код:
new Floatpos[MAX_PLAYERS][3];

CMD:getmypos(playeridparamas[])
{
    
GetPlayerPos(playeridpos[playerid][0],pos[playerid][1], pos[playerid][2]);
    return 
1;




Re: question - Mugala - 20.02.2018

it will replace, to store both u need player's variables like this.

PHP код:
new Float:x[MAX_PLAYERS],Float:y[MAX_PLAYERS],Float:z[MAX_PLAYERS]; 
and than
PHP код:
GetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]); 



Re: question - ISmokezU - 20.02.2018

Well the value would diffinitely change if it’s that what you’re asking. Unless you define a constant float!