How to store int and float in 1 variable
#1

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
Reply
#2

Код:
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?
Reply
#3

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

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
Reply
#5

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]);
Reply
#6

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
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)