21.09.2018, 12:43
I would like to know how random objects appear.
#define MAX_WORLD_CO 4 //You can also add the object ID, after coordinates like so {2443.20, 2872.08, 182.14, 2399/*Object ID*/} new Float:WorldCoordinates[MAX_WORLD_CO][3] = { {2443.20, 2872.08, 182.14}, //0 {2683.04, -1340.28, 150.90}, //1 {398.05, 1427.73, 184.44}, //2 {2283.20, 187.08, 182.14} //3 }; stock randomEx(min, max) { //Credits to ****** new rand = random(max-min)+min; return rand; } forward RandomWorldCoordinates(playerid); public RandomWorldCoordinates(playerid) { new ID = randomEx(0, MAX_WORLD_CO-1); //Create objects with this ID. (random). new Float: X, Float: Y, Float: Z; X = WorldCoordinates[ID][0]; Y = WorldCoordinates[ID][1]; Z = WorldCoordinates[ID][2]; CreateObject(2587, X, Y, Z, 0.0, 0.0, 96.0); // Object will render at its default distance. return 1; }