What is the difference (About floats)
#1

Код:
new 
      Float:Pos1, 
      Float:Pos2, 
      Float:Pos3
;
and

Код:
new 
     Float:Pos[2]
;
I have three questions.

1) What is the difference ?

2) Can i use both at the same ?

3) Whichever is faster and better..etc
Reply
#2

1) What is the difference ? Floats store decimals for exact amounts such as Health. Not sure what else they do. Although they are required to get EXACT locations and EXACT Health etc

2) Can i use both at the same ? Yes for example
pawn Код:
SetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
3) Whichever is faster and better..etc . YOu mean?
Reply
#3

I know them. Both are doing the same but must be a difference.
Reply
#4

Yeah one of them takes the players X axis co-ords like a x axis on a globe a map or a graph

And One takes the Y axis Straight up and down - FOr samp Ahead and behnd

Z is Height and works the same way
Reply
#5

Sorry my bad English

I think you don't understand me.

I say what is the difference...

new Float:Pos[2]; and new Float:Pos1, Float:Pos2, Float:Pos3;
Reply
#6

One is an array and the others aren't. They behave exactly the same. Arrays are just more convenient for large groups of data.
Reply
#7

It's better to do Float:Pos[999999999999999] than doing 999999999999999 Float:Pos1, pos2, pos3 etc...
Reply
#8

When using arrays such as

pawn Код:
new Float:Pos[3];
You are able to insert a variable into the [ ] as it is counted as a parameter of the variable, allowing you to loop through everything.

pawn Код:
new Float:Pos[3];

for(new i = 0; i < sizeof(Pos); i++) {
    printf("pos is currently set to %d", i);
}
You would use a size of 3 because it starts from zero. To have X, Y, Z and rotation, you would need a size of 4.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)