values in new float doesn't get the info - 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: values in new float doesn't get the info (
/showthread.php?tid=604311)
values in new float doesn't get the info -
JohnBlaze1971 - 03.04.2016
Hi, Finally i am here to ask help lmao.
Ok so my problem is as follows. You may first see the codes :
Код:
new Float:Spawns[][] =
{
{PosX[playerid],PosY[playerid],PosZ[playerid],Angle[playerid]},
{PosX1[playerid],PosY1[playerid],PosZ1[playerid],Angle1[playerid]},
{PosX2[playerid],PosY2[playerid],PosZ2[playerid],Angle2[playerid]},
{PosX3[playerid],PosY3[playerid],PosZ3[playerid],Angle3[playerid]},
{PosX4[playerid],PosY4[playerid],PosZ4[playerid],Angle4[playerid]},
{PosX5[playerid],PosY5[playerid],PosZ5[playerid],Angle5[playerid]}
};
Ok, so i am using the positions as random by 1 command. I am working on an include which i will release soon. But, i got these errors, When i run the include file from another script( new ).
Код:
\pawno\include\randompos.inc(158) : error 020: invalid symbol name ""
\pawno\include\randompos.inc(163) : error 010: invalid function or declaration
Help me for this. Thank you.
John_Blaze ( WSRPG )
Re: values in new float doesn't get the info -
Nero_3D - 03.04.2016
Arrays can only be declared with constant values
But why don't you use 2d arrays for PosX, PosY, ... instead of PosX, PosX1, PosX2?
With 2d arrays you could do
PHP код:
GetRandomPos(playerid, Float: X, Float: Y, Float: Z, Float: A) {
new
rand = random(sizeof PosX)
;
X = PosX[rand][playerid];
Y = PosY[rand][playerid];
Z = PosZ[rand][playerid];
A = Angle[rand][playerid];
}