Enum epic problem !
#1

Hello guys. Let's say i have an array:
pawn Код:
new const Float: Coords[1][3] =
{
    {2002.8436,-1645.1097,7.17220}
};
and an enumeration
pawn Код:
enum
{
    _X,
    _Y,
    _Z
}
And if I do like this:
pawn Код:
// OnPlayerCommandText
if(!strcmp(cmdtext, "/test", true))
    SetPlayerPos(playerid, Coords[0][_X], Coords[0][_Y], Coords[0][_Z]);
He teleports me somewhere, and i get a very very very big LOW FPS, and i can't move, and it got LAG, and it show me the message: Stay within your world bound !

But if i do like this:
pawn Код:
// OnPlayerCommandText
if(!strcmp(cmdtext, "/test", true))
    SetPlayerPos(playerid, Coords[0][0], Coords[0][1], Coords[0][2]);
It teleports me correctly ...

Why !?
Reply
#2

maybe because the _X,_Y,_Z are not defined? in the first const you have the coords .
Reply
#3

They are defined in the enumeration, and them vals are:
PHP код:
_X 0
_Y 
1
_Z 

Reply
#4

I can't explain the problem but better use:

pawn Код:
#define _X 0
#define _Y 1
#define _Z 2
Should work then.


Jeffry
Reply
#5

Yea, i know this, or like this:
pawn Код:
const _X = 0,
      _Y = 1,
      _Z = 2;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)