SA-MP Forums Archive
Enum epic problem ! - 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: Enum epic problem ! (/showthread.php?tid=268150)



Enum epic problem ! - MJ! - 11.07.2011

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 !?


Re: Enum epic problem ! - fordawinzz - 11.07.2011

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


Re: Enum epic problem ! - MJ! - 11.07.2011

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




Re: Enum epic problem ! - Jeffry - 11.07.2011

I can't explain the problem but better use:

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


Jeffry


Re: Enum epic problem ! - MJ! - 11.07.2011

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