SA-MP Forums Archive
How to store int and float in 1 variable - 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: How to store int and float in 1 variable (/showthread.php?tid=568881)



How to store int and float in 1 variable - basicllsw - 26.03.2015

I have business coord and interior and i want to store in
Код:
 new Float:BizExit[][] ={ { 123.2,22.2,11.2,66},{122.4,50.5,9.9,11} };
*3 digits of BizExit is x y z coord for biz and last digit is interior id

is possible to store that and if it's gone wrong can someone tell me how to store it together

Thanks


Re: How to store int and float in 1 variable - basicllsw - 26.03.2015

Код:
enum bizexit {
	Float:Pos[3],
	Int,
};
new BizExit[][bizexit];
like this? but i have static coord not dynamic coord.

when i used enum i must tell variable in all array like

Код:
BizExit[1][Pos][0]=122.2;BizExit[1][Pos][1]=50.0;BizExit[1][Pos][2]=10.0;BizExit[1][Int]=66;
That true or false?


Re: How to store int and float in 1 variable - Jefff - 26.03.2015

pawn Код:
enum bizexit
{
    Float:Pos[3],
    Int
};
new BizExit[][bizexit] = {
    {{123.2, 22.2, 11.2}, 66},
    {{122.4, 50.5, 9.9}, 11}
};



Re: How to store int and float in 1 variable - basicllsw - 26.03.2015

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
enum bizexit
{
    Float:Pos[3],
    Int
};
new BizExit[][bizexit] = {
    {{123.2, 22.2, 11.2}, 66},
    {{122.4, 50.5, 9.9}, 11}
};
it's this i want thank Jefff


Re: How to store int and float in 1 variable - Pottus - 26.03.2015

Man this looks so damn messy to me.

pawn Код:
enum bizexit
{
    Float:Pos[3],
    Int
};
Do it like this

pawn Код:
enum bizexit
{
    BizPosX,
    BizPosY,
    BizPosZ,
    Int
};

Think about what looks better.

Код:
SetPlayerPos(playerid, BizExit[index][Pos][0], BizExit[index][Pos][1], BizExit[index][Pos][2]);
OR

Код:
SetPlayerPos(playerid, BizExit[index][BizPosX], BizExit[index][BizPosY], BizExit[index][BizPosZ]);



Re: How to store int and float in 1 variable - hotspicytaco - 26.03.2015

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Man this looks so damn messy to me.

pawn Код:
enum bizexit
{
    Float:Pos[3],
    Int
};
Do it like this

pawn Код:
enum bizexit
{
    BizPosX,
    BizPosY,
    BizPosZ,
    Int
};
Don't do it like that. Do it like this:


pawn Код:
enum bizexit
{
    Float:BizPosX,
    Float:BizPosY,
    Float:BizPosZ,
    Int
};