Give array value for an array - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Give array value for an array (
/showthread.php?tid=181769)
Give array value for an array -
godknightx - 07.10.2010
Hi.
I would like to give an array value for an array.
Its work with integer, but with float, not.
E.g:
Код:
#include <a_samp>
new test[20][20][2];
public OnGameModeInit()
{
test[0][0] = {12, 51};
return 1;
}
But with Float no, why?
Код:
\debug.pwn(7) : warning 213: tag mismatch
Код:
#include <a_samp>
new Float:test[20][20][2];
public OnGameModeInit()
{
test[0][0] = {12.25, 51.69};
return 1;
}
Thanx for the help
Re: Give array value for an array -
Rachael - 07.10.2010
You might have to use an enum to assign float values in this way to this kind of array, although I think you can only set the values like this under the variable definition. Also, for a multi dimensional array of this size, it may be difficult to get the format right.
here is an example of a smaller array.
pawn Код:
enum array_dat { Float:fielda,Float:fieldb };
new test[2][2][array_dat] =
{
{
{ 12.5,16.3 },
{ 12.5,16.3 }
},
{
{ 12.5,16.3 },
{ 12.5,16.3 }
}
};
hope this helps
I am pretty sure there is an easier way to do this, it really depends on how and why you are using these variables.
Re: Give array value for an array -
godknightx - 07.10.2010
Thanx, but i could solv it
Код:
test[0][0] = Float:{12.25, 51.69};
Re: Give array value for an array -
Rachael - 07.10.2010
yes that is much easier. I learn something new every day.