SA-MP Forums Archive
stock or static stock - 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: stock or static stock (/showthread.php?tid=506244)



stock or static stock - andyandyy8 - 12.04.2014

Which of them is better ?
Quote:

stock IsPlayerNear(playerid,giveplayerid)
{
new Float: x[3];
GetPlayerPos(playerid, x[0], x[1], x[2]);
if(IsPlayerInRangeOfPoint(giveplayerid, 5, x[0], x[1], x[2])) return 1;
return 0;
}

or
Quote:

static stock IsPlayerNear(playerid,giveplayerid)
{
new Float: x[3];
GetPlayerPos(playerid, x[0], x[1], x[2]);
if(IsPlayerInRangeOfPoint(giveplayerid, 5, x[0], x[1], x[2])) return 1;
return 0;
}




AW: stock or static stock - Nero_3D - 12.04.2014

Well you need stock only if you create an include file
And static only if you want to restrict this function to the include file

For filterscripts or gamemode you should go with that
pawn Код:
IsPlayerNear(playerid, giveplayerid) {
    new
        Float: x,
        Float: y,
        Float: z
    ;
    return GetPlayerPos(playerid, x, y, z) && IsPlayerInRangeOfPoint(giveplayerid, 5.0, x, y, z);
}



Re: stock or static stock - SupaFool - 12.04.2014

I suggest Stock.


Re: stock or static stock - andyandyy8 - 12.04.2014

Thanks Nero_3D