SA-MP Forums Archive
Random objects + spawns not being created - 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)
+--- Thread: Random objects + spawns not being created (/showthread.php?tid=387502)



Random objects + spawns not being created - V1ceC1ty - 25.10.2012

Hey, I'm currently trying to get some objects to be created with a random object ID and spawn but they don't seem to show up in game. I'm using Incognito's streamer plugin, there are no errors. Am I doing something wrong?

Here's what I've got;
pawn Code:
new Objects[] =
{
    849, 851, 852, 853, 854
};

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}
}

new spawn[5];
public OnGameModeInit()
{
    new randspawn = random(sizeof(Spawns));
    new randobject = random(sizeof(Objects));
    spawn[0] = CreateDynamicObject(Objects[randobject], Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
    spawn[1] = CreateDynamicObject(Objects[randobject], Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
    spawn[2] = CreateDynamicObject(Objects[randobject], Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
    spawn[3] = CreateDynamicObject(Objects[randobject], Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
    spawn[4] = CreateDynamicObject(Objects[randobject], Spawns[randspawn][0], Spawns[randspawn][1], Spawns[randspawn][2], 0, 0, 0, -1, -1, -1, 100.0);
}



Re: Random objects + spawns not being created - -=Dar[K]Lord=- - 25.10.2012

i think so u need to change

Objects[randobject][0]

to only

Objects[randobject]

think so i am not that good at randoming things .. try it and please remove [] from the object up there
when u use mine tech


Re: Random objects + spawns not being created - V1ceC1ty - 25.10.2012

Yes I already tried that, I thought it would work but it compiles with error 035: argument type mismatch


Re: Random objects + spawns not being created - V1ceC1ty - 25.10.2012

Could anyone possibly help with this?


Re: Random objects + spawns not being created - Glad2BeHere - 25.10.2012

Code:
new Float:Spawn[][4]
Code:
new Objects[1] =
{
    {849}, {851}, {852}, {853}, {854}
};
Try this


Re: Random objects + spawns not being created - V1ceC1ty - 25.10.2012

Tried it, "new Float:Spawn[][4]" would be "new Float:Spawn[][3] though, doesn't work


Re: Random objects + spawns not being created - Jarnu - 25.10.2012

Not sure but
You are doing single array here:

pawn Code:
new Object[] = ...
and using multi-array here:

pawn Code:
Objects[randobject][0]
just not sure.


Re: Random objects + spawns not being created - V1ceC1ty - 25.10.2012

Quote:
Originally Posted by Jarnu
View Post
Not sure but
You are doing single array here:

pawn Code:
new Object[] = ...
and using multi-array here:

pawn Code:
Objects[randobject][0]
just not sure.
Oh yeah, I fixed that earlier should have edited my post. I'll edit now but even like that it still doesn't work


Re: Random objects + spawns not being created - V1ceC1ty - 11.11.2012

Sorry for bumping old thread but I'm really having difficulties trying to work out why the objects are not showing up at all, can anyone help?


Re: Random objects + spawns not being created - XtremeR - 11.11.2012

tried using any other object plugin? like F_CreateObject or just CreateObject ?