createobject from array coords - 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: createobject from array coords (
/showthread.php?tid=650412)
createobject from array coords -
PepsiCola23 - 27.02.2018
so i got this array
PHP код:
new Float:ObjectCOORDS[6][3] = {
{1208.9227,-881.9604,42.9228}, // ls
{1011.0600,-1358.2766,13.3515},
{787.0550,-1608.8682,13.3906},
{2380.2878,-1890.4946,13.3891},
{2153.1802,-1173.5449,23.8234},
{1981.1147,-1277.8353,23.8203}
};
how can i create a function that autoamtically creates objects from this coordinates,at all coordinates,when the server starts?
Re: createobject from array coords -
Eoussama - 27.02.2018
Loop through the array and create your objects.
PHP код:
// sizeof(ObjectCOORDS) = 6
for(new i, j = sizeof(ObjectCOORDS); i<j; i++)
CreateObject(object_id, ObjectCOORDS[i][0], ObjectCOORDS[i][1], ObjectCOORDS[i][2], 0.0, 0.0, 0.0);
• ObjectCOORDS's dissection
Indices | 0 | 1 | 2 |
Values: 0 | 1208.9227 | -881.9604 | 42.9228 |
Values: 1 | 1011.0600 | -1358.2766 | 13.3515 |
Values: 2 | 787.0550 | -1608.8682 | 13.3906 |
Values; 3 | 2380.2878 | -1890.4946 | 13.3891 |
Values: 4 | 2153.1802 | -1173.5449 | 23.8234 |
Values: 5 | 1981.1147 | -1277.8353 | 23.8203 |
Re: createobject from array coords -
PepsiCola23 - 27.02.2018
Quote:
Originally Posted by Eoussama
Loop through the array and create your objects.
PHP код:
// sizeof(ObjectCOORDS) = 6
for(new i, j = sizeof(ObjectCOORDS); i<j; i++)
CreateObject(object_id, ObjectCOORDS[i][0], ObjectCOORDS[i][1], ObjectCOORDS[i][2], 0.0, 0.0, 0.0);
|
thank you,solved !