[HELP]2D variable problem. -
Ronaldo_raul™ - 19.06.2012
I am trying to use the camera look at function to show the players point. So, there was many camera sites and I wanted em randomly. I made a 2D variable -
pawn Код:
new Float:Cams[4][6] =
{ //Cam Co-Ordinates //Spawn Co-Ordinates
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
The one on the right sides are the lookat co-ordinates.
pawn Код:
new CamPoints = random(sizeof(Cams));
SetPlayerCameraPos(playerid, Cams[CamPoints][0], Cams[CamPoints][1], Cams[CamPoints][2]);
SetPlayerCameraLookAt(playerid, Cams[CamPoints][3], Cams[CamPoints][4], Cams[CamPoints][5]);
Somewhere in my script.
Problem is it doesn't show the right point. Co-Ordinates are perfect. But it doesn't work when I try it in 2D variable.
If just try with 2D variable it works.
Help is much appreciated.
Re: [HELP]2D variable problem. -
FUNExtreme - 19.06.2012
That should work.. Although the last value of an array doesn't have a ","
So..
pawn Код:
new Float:Cams[4][6] =
{ //Cam Co-Ordinates //Spawn Co-Ordinates
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
{xxx,xxx,xxx , xxxx,xxxx,xxxx},
{xxx,xxx,xxx , xxxx,xxxx,xxxx} //No "," here
};
Re: [HELP]2D variable problem. -
Ronaldo_raul™ - 19.06.2012
So, This should be corrected one -
pawn Код:
new Float:Cams[4][6] =
{ //Cam Co-Ordinates //Spawn Co-Ordinates
{-1276.6558, 673.2457, 5.3714 , -1275.6641, 673.4034, 5.0515},
{-1273.0865, 867.9253, 4.8847 , -1272.1237, 868.2120, 4.4398},
{-2788.0381, -295.9537, 7.1319 , -2788.9910, -295.6427, 6.7172},
{365.5145, -2007.3859, 7.7309 , 365.0089, -2006.5144, 7.3015}
};
You mean I have to add or I have to remove ?
EDIT on adding "," on the last array give me unexpected error -
pawn Код:
C:\Users\Vyom\Desktop\New HTDMDM Server\DM\vkcDM.pwn(168) : error 018: initialization data exceeds declared size
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Re: [HELP]2D variable problem. -
FUNExtreme - 19.06.2012
You have to remove it. In your original post you had one, that needed to be deleted. Which is what I tried to point at, sorry for the confusion.
You might want to check out my Random spawns tutorial, it explains exactly what you want to do. Just in a different context!
Random spawns tutorial
Re: [HELP]2D variable problem. -
Ronaldo_raul™ - 25.06.2012
Erm, Doesn't works. Still facing the problem.
Sorry for the late reply I was engaged in some of family works.