Posts: 716
Threads: 92
Joined: May 2018
So, assuming i have in an array a coordinates of all robbery places, like this:
pawn Код:
LoadRobberies()
{
RobberyP[0] = CreateDynamicSphere(2065.439453125, -1897.5510253906, 13.19670009613, 3.0);
RobberyP[1] = CreateDynamicSphere(1497.7467041016, -1749.8747558594, 15.088212013245, 3.0);
//And so on...
return 1;
}
How i can create objects with streamer without doing:
CreateDynamicObject multiple times? (I have 40 robbery places).
Basically, i wanna create an object based on the coordinates in that array.
Posts: 716
Threads: 92
Joined: May 2018
Tried in this way:
pawn Код:
new const RobOjbects[][RobIcons] =
{
{2067.4,-1831.2,13.5},
{488.0,-1734.0,34.4},
{720.016,-454.625,15.328}
};
enum RobIcons
{
Float:XXX,
Float:YYY,
Float:ZZZ
}
for(new i = 0; i < sizeof(AtmObjects); i ++)
{
CreateDynamicObject(19324, RobOjbects[i][XXX], RobOjbects[i][YYY], RobOjbects[i][ZZZ], 0.0, 0.0, 0.0, 100);
}
But getting this:
error 017: undefined symbol "RobIcons"
error 010: invalid function or declaration
Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
You must declare the enum before the array. So just move it up.
Posts: 1,071
Threads: 24
Joined: Aug 2014
Reputation:
0
Declare the RobIcon enum before RobObject enum.
Posts: 716
Threads: 92
Joined: May 2018
Ok managed to fix, now i wanna create mapicons.
I did in this way:
pawn Код:
for(new i = 0; i < sizeof(AtmObjects); i ++)
{
CreateDynamicObject(19324, AtmObjects[i][XXX], AtmObjects[i][YYY], AtmObjects[i][ZZZ], 0.0, 0.0, 0.0, 100);
CreateDynamicMapIcon(AtmObjects[i][XXX][0], AtmObjects[i][YYY][1], AtmObjects[i][ZZZ][2], 15, 0, 0, .streamdistance = 200.0);
}
(Forget all the code above, i changed from rob to atm objects).
And got this at the CreateDynamicMapIcon line:
Quote:
error 001: expected token: ",", but found "["
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
fatal error 107: too many error messages on one line
|
EDIT: Just checked now...object doesn't appear :/
Posts: 1,915
Threads: 64
Joined: Jan 2016
Reputation:
0
`AtmObjects[i][XXX]` is enough, you don't need to add an additional dimension.
Posts: 716
Threads: 92
Joined: May 2018
Quote:
Originally Posted by Dayrion
`AtmObjects[i][XXX]` is enough, you don't need to add an additional dimension.
|
So just:
CreateDynamicObject(19324, AtmObjects[i][XXX], 0.0, 0.0, 0.0, 100);
?
EDIT: Tried, doesnt work.
Posts: 716
Threads: 92
Joined: May 2018
pawn Код:
new const AtmObjects[][AtmIcons] =
{
{2065.439453125, -1897.5510253906, 13.19670009613},
{1497.7467041016, -1749.8747558594, 15.088212013245},
{2093.5124511719, -1359.5474853516, 23.62727355957},
{1155.6235351563, -1464.9141845703, 15.44321346283},
{1482.7761230469, -1010.3353881836, 26.48664855957},
{2139.4487304688, -1164.0811767578, 23.63508605957}
};
enum AtmIcons
{
Float:XXX,
Float:YYY,
Float:ZZZ
}
I'm getting an error on your code:
Код:
error 001: expected token: ",", but found "["
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
fatal error 107: too many error messages on one line
Referred to the CreateDynamicObject line.