12.06.2013, 04:42
Good idea,
This is not all of the code obviously but just to show you how it is. The object creation is on timers because otherwise SA-MP can't handle 15k of them being created at once. r_CreateObject() is used for streaming purposes with ******'s modelsize include so that an object with a larger collision radius is streamed before a smaller object.
Код:
[21:33:33] [debug] Run time error 4: "Array index out of bounds" [21:33:33] [debug] Accessing element at index 16000 past array upper bound 15999 [21:33:33] [debug] AMX backtrace: [21:33:33] [debug] #0 0000748c in ?? (0x00000360, 0xc50598a4, 0x44d99c29, 0xbe8f6944, 0x00000000, ... <2 arguments>) from Objects.amx [21:33:33] [debug] #1 000e6220 in ?? () from Objects.amx [21:33:33] [debug] #2 000ea36c in public Objects21 () from Objects.amx
Код:
#define STREAM_CONSTANT 180 //forward Objects1(); //forward Objects2(); ... forward Objects21(); public OnFilterScriptInit() { SetTimer("Objects21", 21000, 0); return 1; } new objects[15000][2], some_var = 0; stock r_CreateObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { objects[ some_var ][ 0 ] = CreateDynamicObject(modelid, x, y, z, rx, ry, rz, -1, -1, -1, STREAM_CONSTANT + GetColSphereRadius(modelid)); objects[ some_var ][1] = modelid; some_var++; return 1; } stock CreateObjects21() { r_CreateObject(2000,-983.6800000,2811.7900000,73.7900000,0.0000000,0.0000000,0.0000000); return 1; } public Objects21() { CreateObjects21(); return 1; }