29.12.2014, 02:39
Hey, How do I get my object to randomly spawn? I've looked through the forums couldn't find much. I'm having a few issues how I should exactly code it.
Can't manage to get it to spawn.:\
How do I get this object to spawn randomly, what did I do wrong?
pawn Код:
new Float:Spawns[][] =
{
{-2236.210,-2568.430,31.140},
{-2241.000,-2552.900,31.140},
{-2251.390,-2563.750,31.140},
{-2204.330,-2516.560,29.880},
{-2203.080,-2501.970,29.840}
}
pawn Код:
new spawn[5];
public OnGameModeInit()
{
new randspawn = random(sizeof(Spawns));
spawn[0] = CreateDynamicObject(12814, Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
spawn[1] = CreateDynamicObject(12814, Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
spawn[2] = CreateDynamicObject(12814, Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
spawn[3] = CreateDynamicObject(12814, Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
spawn[4] = CreateDynamicObject(12814, Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
}
How do I get this object to spawn randomly, what did I do wrong?