SA-MP Forums Archive
how to random spawn - 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: how to random spawn (/showthread.php?tid=298968)



how to random spawn - Gooday - 23.11.2011

Hi guys how i can create random object spawned in different locations (like the mission for the FD object fire spawned in locations...)


Re: how to random spawn - Pharrel - 23.11.2011

pawn Код:
new Float:RandomFire[][] =
{
    {Float:X, Float:Y, Float:Z},//you need to replace X,Y n Z to your coordinates.
    {Float:X, Float:Y, Float:Z},
    {Float:X, Float:Y, Float:Z}
};

//use:
new fire = random(sizeof(RandomFire));
CreateObject(objectid,RandomFire[fire][0], RandomFire[fire][1], RandomFire[fire][2],0,0,0);



Re: how to random spawn - Kostas' - 23.11.2011

Something like that. Not sure
pawn Код:
// Variables
new Float:RandomObjectSpawn[][4] =
{
    // Positions, (X, Y, Z and Facing Angle)
    {-2796.9854, 1224.8180, 20.5429, 192.0335},
    {-2454.2170, 503.8759, 30.0790, 267.2932},
    {-2669.7322, -6.0874, 6.1328, 89.8853}
};

// OnGameModeInit()
public OnGameModeInit()
{
    CreateObject(2587, RandomObjectSpawn[rand][0], RandomObjectSpawn[rand][1],RandomObjectSpawn[rand][2], 0.0, 0.0, 96.0);
    return 1;
}
Edit: Pharrel was faster


Re: how to random spawn - Gooday - 24.11.2011

how i can add a timer and select the object/explosion i want?