12.07.2016, 01:16
This
is Slower than this
The functions are example.
I think, because every time at Coords[*] is called, need load the value i and the value from Coords, if you use the array only a time no have differences between speed.
Sorry my bad english, someone smarter than me can explain better.
PHP Code:
new Float:Coords[5][4] = {
{0.0, 0.1, 0.2, 0.3},
{1.0, 1.1, 1.2, 1.3},
{2.0, 2.1, 2.2, 2.3},
{3.0, 3.1, 3.2, 3.3},
{4.0, 4.1, 4.2, 4.3}
};
function(){
new rand = random(sizeof(Coords));
foreach(new i: Player)
{
SetPlayerPos(playerid, Coords[rand][0], Coords[rand][1], Coords[rand][2]);
SetPlayerFacingAngle(playerid, Coords[rand][3]);
}
CreatePickup(1, 2, Coords[rand][0], Coords[rand][1], Coords[rand][2]);
Create3DTextLabel("You are here", -1, Coords[rand][0], Coords[rand][1], Coords[rand][2], 15.0, 0);
}
PHP Code:
new Float:Coords[5][4] = {
{0.0, 0.1, 0.2, 0.3},
{1.0, 1.1, 1.2, 1.3},
{2.0, 2.1, 2.2, 2.3},
{3.0, 3.1, 3.2, 3.3},
{4.0, 4.1, 4.2, 4.3}
};
function(){
new rand = random(sizeof(Coords));
new
Float:X = Coords[rand][0],
Float:Y = Coords[rand][1],
Float:Z = Coords[rand][2],
Float:Ang = Coords[rand][3]
;
foreach(new i: Player)
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, Coords[rand][3]);
}
CreatePickup(1, 2, X, Y, Z);
Create3DTextLabel("You are here", -1, X, Y, Z, 15.0, 0);
}
I think, because every time at Coords[*] is called, need load the value i and the value from Coords, if you use the array only a time no have differences between speed.
Sorry my bad english, someone smarter than me can explain better.