objm.pwn 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. /*
  2. * =============================================================================================== *
  3. * =============================================================================================== *
  4. * =============================================================================================== *
  5. * =============================================================================================== *
  6. * ================================ Codectile's ================================ *
  7. * ================================ Objectometry ================================ *
  8. * ================================ -Library- ================================ *
  9. * ================================ -Version 1.0- ================================ *
  10. * ================================ ================================ *
  11. * =============================================================================================== *
  12. * =============================================================================================== *
  13. * =============================================================================================== *
  14. */
  15. /*
  16. Introduction: This include helps in creating objects in different types of circular paths/tracks.This include is still under development.
  17. The functions below will not work unless streamer plugin is included in your script.
  18. There are total 6 different types of functions -
  19. CreateDynamicObjectCircle(playerid,modelid,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz,Float:radius,Float:sep,bool:facecenter=false)
  20. CreateDynamicObjectSpiral(playerid,modelid,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz,Float:radius,Float:hsep,Float:vsep,bool:facecenter=false)
  21. CreateDynamicObjectCylinder(playerid,modelid,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz,Float:radius,Float:hsep,Float:vsep,parts,bool:facecenter=false)
  22. CreateDynamicObjectWhirl(playerid,modelid,Float:posx,Float:posy,Float:posz,Float:rx,Float:ry,Float:rz,Float:radius,Float:sep,bool:facecenter=false)
  23. CreateDynamicCircleIn(playerid,modelid,Float:posx,Float:posy,Float:posz,Float:rx,Float:ry,Float:rz,Float:radius,Float:sep,parts,bool:facecenter=false)
  24. CreateDynamicCircleOut(playerid,modelid,Float:posx,Float:posy,Float:posz,Float:rx,Float:ry,Float:rz,Float:radius,Float:sep,parts,bool:facecenter=false)
  25. Dependencies: Streamer Plugin (Incognito)
  26. Bugs: None yet.
  27. Source Code: www.github.com/codectile
  28. Credits: Incognito
  29. Note: This include has been modified and integrated for use in Texture Studio
  30. */
  31. /* The following codes are too much fragile, please "do not edit them". */
  32. /* Creates object in a circular path */
  33. #define MAX_OBM 2000
  34. enum OBMINFO
  35. {
  36. OMBID,
  37. OMBModel,
  38. Float:OBMX,
  39. Float:OBMY,
  40. Float:OBMZ,
  41. Float:OBMRX,
  42. Float:OBMRY,
  43. Float:OBMRZ,
  44. }
  45. static OBMStack[MAX_PLAYERS][MAX_OBM][OBMINFO];
  46. public OnFilterScriptInit()
  47. {
  48. for(new i = 0; i < MAX_PLAYERS; i++)
  49. {
  50. for(new j = 0; j < MAX_OBM; j++) OBMStack[i][j][OMBID] = -1;
  51. }
  52. #if defined OM_OnFilterScriptInit
  53. OM_OnFilterScriptInit();
  54. #endif
  55. return 1;
  56. }
  57. #if defined _ALS_OnFilterScriptInit
  58. #undef OnFilterScriptInit
  59. #else
  60. #define _ALS_OnFilterScriptInit
  61. #endif
  62. #define OnFilterScriptInit OM_OnFilterScriptInit
  63. #if defined OM_OnFilterScriptInit
  64. forward OM_OnFilterScriptInit();
  65. #endif
  66. public OnFilterScriptExit()
  67. {
  68. foreach(new i : Player) ClearOBMStack(i);
  69. #if defined OM_OnFilterScriptExit
  70. OM_OnFilterScriptExit();
  71. #endif
  72. return 1;
  73. }
  74. #if defined _ALS_OnFilterScriptExit
  75. #undef OnFilterScriptExit
  76. #else
  77. #define _ALS_OnFilterScriptExit
  78. #endif
  79. #define OnFilterScriptExit OM_OnFilterScriptExit
  80. #if defined OM_OnFilterScriptExit
  81. forward OM_OnFilterScriptExit();
  82. #endif
  83. public OnPlayerDisconnect(playerid, reason)
  84. {
  85. ClearOBMStack(playerid);
  86. #if defined OM_OnPlayerDisconnect
  87. OM_OnPlayerDisconnect(playerid, reason);
  88. #endif
  89. return 1;
  90. }
  91. #if defined _ALS_OnPlayerDisconnect
  92. #undef OnPlayerDisconnect
  93. #else
  94. #define _ALS_OnPlayerDisconnect
  95. #endif
  96. #define OnPlayerDisconnect OM_OnPlayerDisconnect
  97. #if defined OM_OnPlayerDisconnect
  98. forward OM_OnPlayerDisconnect(playerid, reason);
  99. #endif
  100. ClearOBMStack(playerid)
  101. {
  102. for(new i = 0; i < MAX_OBM; i++)
  103. {
  104. if(OBMStack[playerid][i][OMBID] != -1)
  105. {
  106. DestroyDynamicObject(OBMStack[playerid][i][OMBID]);
  107. OBMStack[playerid][i][OMBID] = -1;
  108. }
  109. }
  110. return 1;
  111. }
  112. ApplyOBM(playerid)
  113. {
  114. ClearGroup(playerid);
  115. new index;
  116. new time = GetTickCount();
  117. db_begin_transaction(EditMap);
  118. for(new i = 0; i < MAX_OBM; i++)
  119. {
  120. if(OBMStack[playerid][i][OMBID] != -1)
  121. {
  122. index = AddDynamicObject(OBMStack[playerid][i][OMBModel],
  123. OBMStack[playerid][i][OBMX], OBMStack[playerid][i][OBMY], OBMStack[playerid][i][OBMZ],
  124. OBMStack[playerid][i][OBMRX], OBMStack[playerid][i][OBMRY], OBMStack[playerid][i][OBMRZ]
  125. );
  126. SaveUndoInfo(index, UNDO_TYPE_CREATED, time);
  127. GroupedObjects[playerid][index] = true;
  128. UpdateObject3DText(index, true);
  129. OnUpdateGroup3DText(index);
  130. }
  131. }
  132. db_end_transaction(EditMap);
  133. return 1;
  134. }
  135. static AddOBMObject(playerid,modelid,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz)
  136. {
  137. for(new i = 0; i < MAX_OBM; i++)
  138. {
  139. if(OBMStack[playerid][i][OMBID] == -1)
  140. {
  141. OBMStack[playerid][i][OMBID] = CreateDynamicObject(modelid, x, y, z, rx, ry, rz, MapSetting[mVirtualWorld], MapSetting[mInterior], -1, 300.0, 300.0);
  142. OBMStack[playerid][i][OMBModel] = modelid;
  143. OBMStack[playerid][i][OBMX] = x;
  144. OBMStack[playerid][i][OBMY] = y;
  145. OBMStack[playerid][i][OBMZ] = z;
  146. OBMStack[playerid][i][OBMRX] = rx;
  147. OBMStack[playerid][i][OBMRY] = ry;
  148. OBMStack[playerid][i][OBMRZ] = rz;
  149. return i;
  150. }
  151. }
  152. return 1;
  153. }
  154. CreateDynamicObjectCircle(playerid,modelid,deg,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:sep,bool:facecenter=false)
  155. {
  156. if(facecenter == false)
  157. {
  158. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0;
  159. for(new i = 0;i < deg;i += 1)
  160. {
  161. if(angle <= float(deg))
  162. {
  163. x = posx+radius*floatcos(angle,degrees);
  164. y = posy+radius*floatsin(angle,degrees);
  165. AddOBMObject(playerid,modelid, x, y, posz,rx,ry,rz+orz);
  166. angle = angle+sep;
  167. }
  168. else break;
  169. }
  170. }
  171. else
  172. {
  173. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z,Float:detrx,Float:detry,Float:detrz;
  174. for(new i = 0;i < float(deg);i += 1)
  175. {
  176. if(angle <= deg)
  177. {
  178. x=posx+radius*floatcos(angle,degrees);
  179. y=posy+radius*floatsin(angle,degrees);
  180. // Translate to rotation
  181. AttachPoint(x, y, posz,
  182. orx, ory, angle-180.0+orz,
  183. posx, posy, posz, rx, ry, rz,
  184. x, y, z,
  185. detrx, detry, detrz
  186. );
  187. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  188. angle = angle+sep;
  189. }
  190. else break;
  191. }
  192. }
  193. Streamer_Update(playerid);
  194. return 1;
  195. }
  196. /* Creates objects in a Spherical path */
  197. CreateDynamicObjectSphere(playerid,modelid,deg,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:hsep,Float:vsep,bool:facecenter=false)
  198. {
  199. if(facecenter == false)
  200. {
  201. new Float:x, Float:y, Float:z;
  202. for(new Float:lat = -90.0; lat <= 90.0; lat += vsep)
  203. for(new Float:lon = -180.0, Float:angle = float(clamp(deg, 0, 360) - 180); lon <= angle; lon += hsep)
  204. {
  205. x = radius * -(floatcos(lat, degrees) * floatsin(-lon, degrees));
  206. y = radius * floatcos(lat, degrees) * floatcos(-lon, degrees);
  207. z = radius * floatsin(lat, degrees);
  208. AddOBMObject(playerid, modelid, posx + x, posy + y, posz + z, rx, ry, rz + orz);
  209. }
  210. }
  211. else
  212. {
  213. new Float:x, Float:y, Float:z, Float:detrx, Float:detry, Float:detrz;
  214. for(new Float:lat = -90.0; lat <= 90.0; lat += vsep)
  215. for(new Float:lon = -180.0, Float:angle = float(clamp(deg, 0, 360) - 180); lon <= angle; lon += hsep)
  216. {
  217. x = -(floatcos(lat, degrees) * floatsin(-lon, degrees));
  218. y = floatcos(lat, degrees) * floatcos(-lon, degrees);
  219. z = floatsin(lat, degrees);
  220. AttachPoint(x * radius, y * radius, z * radius, orx + 90 - lat, ory, orz + 180.0 - lon,
  221. posx, posy, posz, rx, ry, rz,
  222. x, y, z, detrx, detry, detrz
  223. );
  224. AddOBMObject(playerid, modelid, posx + x, posy + y, posz + z, detrx, detry, detrz);
  225. }
  226. }
  227. Streamer_Update(playerid);
  228. return 1;
  229. }
  230. /*
  231. x = (a + b * deg) * floatcos(deg, degrees);
  232. y = (a + b * deg) * floatsin(deg, degrees);
  233. */
  234. /* Creates objects in an Archimedean spiral path */
  235. CreateDynamicObjectSpiral(playerid,modelid,deg,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:hsep,Float:vsep,bool:facecenter=false)
  236. {
  237. if(facecenter == false)
  238. {
  239. new Float:x, Float:y, Float:c,
  240. Float:away, Float:around,
  241. Float:thetaMax = ((deg + 180) / 360 * 2) * (3.141593),
  242. Float:awayStep = radius / thetaMax;
  243. for(new Float:theta = hsep / awayStep; theta <= thetaMax; )
  244. {
  245. away = awayStep * theta,
  246. around = theta;
  247. x = floatcos(around) * away,
  248. y = floatsin(around) * away,
  249. AddOBMObject(playerid,modelid, posx + x, posy + y, posz + c,orx,ory,rz+orz);
  250. //c += vsep;
  251. c = vsep + floatsqroot(floatpower(floatcos(around) * away, 2) + (floatpower(floatsin(around) * away, 2)));
  252. theta += hsep / away;
  253. }
  254. }
  255. else
  256. {
  257. new Float:x, Float:y, Float:z, Float:c,
  258. Float:detrx,Float:detry,Float:detrz,
  259. Float:away, Float:around,
  260. Float:thetaMax = ((deg + 180) / 360 * 2) * (3.141593),
  261. Float:awayStep = radius / thetaMax;
  262. for(new Float:theta = hsep / awayStep; theta <= thetaMax; )
  263. {
  264. away = awayStep * theta,
  265. around = theta;
  266. x = floatcos(around) * away,
  267. y = floatsin(around) * away,
  268. // Translate to rotation
  269. AttachPoint(
  270. posx + x, posy + y, posz + c, orx, ory, atan2(y, x) + orz,
  271. posx, posy, posz, rx, ry, rz,
  272. x, y, z, detrx, detry, detrz
  273. );
  274. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  275. //c += vsep;
  276. c = vsep + floatsqroot(floatpower(floatcos(around) * away, 2) + (floatpower(floatsin(around) * away, 2)));
  277. theta += hsep / away;
  278. }
  279. }
  280. Streamer_Update(playerid);
  281. return 1;
  282. }
  283. /* Creates objects in a Helical path */
  284. CreateDynamicObjectHelix(playerid,modelid,deg,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:hsep,Float:vsep,bool:facecenter=false)
  285. {
  286. if(facecenter == false)
  287. {
  288. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:c = 0.0;
  289. for(new i = 0;i < deg;i += 1)
  290. {
  291. if(angle <= float(deg))
  292. {
  293. x=posx+radius*floatcos(angle,degrees);
  294. y=posy+radius*floatsin(angle,degrees);
  295. AddOBMObject(playerid,modelid, x, y, posz+c,rx,ry,rz+orz);
  296. c = c+vsep;
  297. angle = angle+hsep;
  298. }
  299. else break;
  300. }
  301. }
  302. else
  303. {
  304. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z, Float:c = 0.0, Float:detrx,Float:detry,Float:detrz;
  305. for(new i = 0;i < deg;i += 1)
  306. {
  307. if(angle <= float(deg))
  308. {
  309. x=posx+radius*floatcos(angle,degrees);
  310. y=posy+radius*floatsin(angle,degrees);
  311. // Translate to rotation
  312. AttachPoint(x, y, posz+c,
  313. orx, ory, angle+180.0+orz,
  314. posx, posy, posz, rx, ry, rz,
  315. x, y, z,
  316. detrx, detry, detrz
  317. );
  318. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  319. c=c+vsep;
  320. angle = angle+hsep;
  321. }
  322. else break;
  323. }
  324. }
  325. Streamer_Update(playerid);
  326. return 1;
  327. }
  328. /* Creates objects in a Cylinderical path */
  329. CreateDynamicObjectCylinder(playerid,modelid,deg,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:hsep,Float:vsep,parts,bool:facecenter=false)
  330. {
  331. if(facecenter == false)
  332. {
  333. new Float:angle=0.0,Float:x=0.0,Float:y=0.0,Float:c=0.0;
  334. for(new j=0;j<parts;j++)
  335. {
  336. angle = 0.0,x = 0.0,y = 0.0;
  337. for(new i=0;i<deg;i+=1)
  338. {
  339. if(angle <= float(deg))
  340. {
  341. x=posx+radius*floatcos(angle,degrees);
  342. y=posy+radius*floatsin(angle,degrees);
  343. AddOBMObject(playerid,modelid, x, y, posz+c,rx,ry,rz+orz);
  344. angle=angle+hsep;
  345. }
  346. else break;
  347. }
  348. c=c+vsep;
  349. }
  350. }
  351. else
  352. {
  353. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z, Float:c = 0.0, Float:detrx,Float:detry,Float:detrz;
  354. for(new j=0;j<parts;j++)
  355. {
  356. angle = 0.0,x = 0.0,y = 0.0;
  357. for(new i=0;i<deg;i+=1)
  358. {
  359. if(angle <= float(deg))
  360. {
  361. x=posx+radius*floatcos(angle,degrees);
  362. y=posy+radius*floatsin(angle,degrees);
  363. // Translate to rotation
  364. AttachPoint(x, y, posz+c,
  365. orx, ory, angle+180.0+orz,
  366. posx, posy, posz, rx, ry, rz,
  367. x, y, z,
  368. detrx, detry, detrz
  369. );
  370. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  371. angle=angle+hsep;
  372. }
  373. else break;
  374. }
  375. c=c+vsep;
  376. }
  377. }
  378. Streamer_Update(playerid);
  379. return 1;
  380. }
  381. /* Creates objects in a Conical path */
  382. CreateDynamicObjectCone(playerid,modelid,deg,Float:posx,Float:posy,Float:posz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:hsep,Float:vsep,parts,bool:facecenter=false)
  383. {
  384. if(facecenter == false)
  385. {
  386. new Float:angle=0.0,Float:x=0.0,Float:y=0.0,Float:c=0.0;
  387. for(new j=0;j<parts;j++)
  388. {
  389. /*| No Radius
  390. j4| *
  391. j3| * *
  392. j2| * *
  393. j1| * *
  394. j0| * *
  395. */// Full Radius
  396. angle = 0.0,x = 0.0,y = 0.0;
  397. new Float:rad = radius - ((radius / (parts - 1)) * j);
  398. for(new i=0;i<deg;i+=1)
  399. {
  400. if(angle <= float(deg))
  401. {
  402. x=posx+rad*floatcos(angle,degrees);
  403. y=posy+rad*floatsin(angle,degrees);
  404. AddOBMObject(playerid,modelid, x, y, posz+c,rx,ry,rz+orz);
  405. angle=angle+hsep;
  406. }
  407. else break;
  408. }
  409. c=c+vsep;
  410. }
  411. }
  412. else
  413. {
  414. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z, Float:c = 0.0, Float:detrx,Float:detry,Float:detrz;
  415. for(new j=0;j<parts;j++)
  416. {
  417. angle = 0.0,x = 0.0,y = 0.0;
  418. new Float:rad = radius - ((radius / (parts - 1)) * j);
  419. for(new i=0;i<deg;i+=1)
  420. {
  421. if(angle <= float(deg))
  422. {
  423. x=posx+rad*floatcos(angle,degrees);
  424. y=posy+rad*floatsin(angle,degrees);
  425. // Translate to rotation
  426. AttachPoint(x, y, posz+c,
  427. orx, ory, angle+180.0+orz,
  428. posx, posy, posz, rx, ry, rz,
  429. x, y, z,
  430. detrx, detry, detrz
  431. );
  432. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  433. angle=angle+hsep;
  434. }
  435. else break;
  436. }
  437. c=c+vsep;
  438. }
  439. }
  440. Streamer_Update(playerid);
  441. return 1;
  442. }
  443. /* Creates objects in a reversed "6" type of path */
  444. CreateDynamicObjectWhirl(playerid,modelid,deg,Float:posx,Float:posy,Float:posz,Float:rx,Float:ry,Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:sep,bool:facecenter=false)
  445. {
  446. if(facecenter == false)
  447. {
  448. new Float:angle=0.0,Float:x=0.0,Float:y=0.0;
  449. for(new i=0;i<deg;i+=1)
  450. {
  451. if(angle <= float(deg))
  452. {
  453. x=posx+(radius-i)*floatcos(angle,degrees);
  454. y=posy+(radius-i)*floatsin(angle,degrees);
  455. AddOBMObject(playerid,modelid, x, y, posz,rx,ry,rz+orz);
  456. angle=angle+sep;
  457. }
  458. else break;
  459. }
  460. }
  461. else
  462. {
  463. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z,Float:detrx,Float:detry,Float:detrz;
  464. for(new i = 0;i < deg;i += 1)
  465. {
  466. if(angle <= float(deg))
  467. {
  468. x=posx+(radius-i)*floatcos(angle,degrees);
  469. y=posy+(radius-i)*floatsin(angle,degrees);
  470. // Translate to rotation
  471. AttachPoint(x, y, posz,
  472. orx, ory, angle+180.0+orz,
  473. posx, posy, posz, rx, ry, rz,
  474. x, y, z,
  475. detrx, detry, detrz
  476. );
  477. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  478. angle=angle+sep;
  479. }
  480. else break;
  481. }
  482. }
  483. Streamer_Update(playerid);
  484. return 1;
  485. }
  486. /* Creates objects in a circular path within a circular pathed object */
  487. CreateDynamicCircleIn(playerid,modelid,deg,Float:posx,Float:posy,Float:posz,Float:rx,Float:ry,Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:sep,parts,bool:facecenter=false)
  488. {
  489. if(facecenter == false)
  490. {
  491. new Float:angle=0.0,Float:x=0.0,Float:y=0.0;
  492. for(new j=0;j<parts;j++)
  493. {
  494. angle=0.0,x=0.0,y=0.0;
  495. for(new i=0;i<deg;i+=1)
  496. {
  497. if(angle <= float(deg))
  498. {
  499. x=posx+(radius)*floatcos(angle,degrees);
  500. y=posy+(radius)*floatsin(angle,degrees);
  501. AddOBMObject(playerid,modelid, x, y, posz,rx,ry,rz+orz);
  502. angle=angle+sep;
  503. }
  504. else break;
  505. }
  506. radius-=2.5;
  507. }
  508. }
  509. else
  510. {
  511. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z,Float:detrx,Float:detry,Float:detrz;
  512. for(new j=0;j<parts;j++)
  513. {
  514. angle=0.0,x=0.0,y=0.0;
  515. for(new i=0;i<deg;i+=1)
  516. {
  517. if(angle <= float(deg))
  518. {
  519. x=posx+(radius)*floatcos(angle,degrees);
  520. y=posy+(radius)*floatsin(angle,degrees);
  521. // Translate to rotation
  522. AttachPoint(x, y, posz,
  523. orx, ory, angle+180.0+orz,
  524. posx, posy, posz, rx, ry, rz,
  525. x, y, z,
  526. detrx, detry, detrz
  527. );
  528. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  529. angle=angle+sep;
  530. }
  531. else break;
  532. }
  533. radius-=2.5;
  534. }
  535. }
  536. Streamer_Update(playerid);
  537. return 1;
  538. }
  539. /* Creates objects in a circular path outside a circular pathed object */
  540. CreateDynamicCircleOut(playerid,modelid,deg,Float:posx,Float:posy,Float:posz,Float:rx,Float:ry,Float:rz, Float:orx, Float:ory, Float:orz, Float:radius,Float:sep,parts,bool:facecenter=false)
  541. {
  542. if(facecenter == false)
  543. {
  544. new Float:angle=0.0,Float:x=0.0,Float:y=0.0;
  545. for(new j=0;j<parts;j++)
  546. {
  547. angle=0.0,x=0.0,y=0.0;
  548. for(new i=0;i<deg;i+=1)
  549. {
  550. if(angle <= float(deg))
  551. {
  552. x=posx+(radius)*floatcos(angle,degrees);
  553. y=posy+(radius)*floatsin(angle,degrees);
  554. AddOBMObject(playerid,modelid, x, y, posz,rx,ry,rz+orz);
  555. angle=angle+sep;
  556. }
  557. else break;
  558. }
  559. radius+=2.5;
  560. }
  561. }
  562. else
  563. {
  564. new Float:angle = 0.0,Float:x = 0.0,Float:y = 0.0,Float:z,Float:detrx,Float:detry,Float:detrz;
  565. for(new j=0;j<parts;j++)
  566. {
  567. angle=0.0,x=0.0,y=0.0;
  568. for(new i=0;i<deg;i+=1)
  569. {
  570. if(angle <= float(deg))
  571. {
  572. x=posx+(radius)*floatcos(angle,degrees);
  573. y=posy+(radius)*floatsin(angle,degrees);
  574. // Translate to rotation
  575. AttachPoint(x, y, posz,
  576. orx, ory, angle+180.0+orz,
  577. posx, posy, posz, rx, ry, rz,
  578. x, y, z,
  579. detrx, detry, detrz
  580. );
  581. AddOBMObject(playerid,modelid, x, y, z, detrx, detry, detrz);
  582. angle=angle+sep;
  583. }
  584. else break;
  585. }
  586. radius+=2.5;
  587. }
  588. }
  589. Streamer_Update(playerid);
  590. return 1;
  591. }
  592. //==========================================================================================
  593. /* Creates objects in a line */
  594. CreateDynamicLine(playerid, modelid, Float:sx, Float:sy, Float:sz, Float:ex, Float:ey, Float:ez, Float:orx, Float:ory, Float:orz, segs)
  595. {
  596. new Float:dx = (ex - sx),
  597. Float:dy = (ey - sy),
  598. Float:dz = (ez - sz),
  599. Float:d = VectorSize(dx, dy, dz);
  600. new Float:step = d / segs;
  601. dx /= d; dy /= d; dz /= d;
  602. for(new Float:j; j <= segs * step; j += step)
  603. AddOBMObject(
  604. playerid, modelid,
  605. sx + (j * dx), sy + (j * dy), sz + (j * dz),
  606. orx, ory, orz
  607. );
  608. Streamer_Update(playerid);
  609. return 1;
  610. }
  611. /* Creates objects in a line */
  612. CreateDynamicQuadrilateral(playerid, modelid, Float:cx, Float:cy, Float:cz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:length, Float:width, lsegs, wsegs, bool:fill)
  613. {
  614. length -= 1.0, width -= 1.0,
  615. lsegs -= 1, wsegs -= 1;
  616. new Float:sx = cx - (length / 2.0), Float:sy = cy - (width / 2.0),
  617. Float:ex = cx + (length / 2.0), Float:ey = cy + (width / 2.0),
  618. Float:dx = (ex - sx), Float:dy = (ey - sy),
  619. Float:lstep = dx / lsegs, Float:wstep = dy / wsegs;
  620. new Float:nx, Float:ny, Float:nz, Float:nrx, Float:nry, Float:nrz;
  621. for(new Float:x, Float:mx = lsegs * lstep; x <= mx; x += lstep) {
  622. for(new Float:y, Float:my = wsegs * wstep; y <= my; y += wstep) {
  623. if(fill || (x == 0.0 || y == 0.0 || x == mx || y == my)) {
  624. AttachPoint(
  625. sx + x, sy + y, cz, orx, ory, orz,
  626. cx, cy, cz, rx, ry, rz,
  627. nx, ny, nz, nrx, nry, nrz
  628. );
  629. AddOBMObject(playerid, modelid, nx, ny, nz, nrx, nry, nrz);
  630. }
  631. }
  632. }
  633. return 1;
  634. }
  635. /* Creates objects in a line */
  636. CreateDynamicPrism(playerid, modelid, Float:cx, Float:cy, Float:cz, Float:rx, Float:ry, Float:rz, Float:orx, Float:ory, Float:orz, Float:length, Float:width, Float:height, lsegs, wsegs, hsegs, bool:fill)
  637. {
  638. length -= 1.0, width -= 1.0,
  639. lsegs -= 1, wsegs -= 1;
  640. new Float:sx = cx - (length / 2.0), Float:sy = cy - (width / 2.0), Float:sz = cz - (height / 2.0),
  641. Float:ex = cx + (length / 2.0), Float:ey = cy + (width / 2.0), Float:ez = cz + (height / 2.0),
  642. Float:dx = (ex - sx), Float:dy = (ey - sy), Float:dz = (ez - sz),
  643. Float:lstep = dx / lsegs, Float:wstep = dy / wsegs, Float:hstep = dz / hsegs;
  644. new Float:nx, Float:ny, Float:nz, Float:nrx, Float:nry, Float:nrz;
  645. for(new Float:x, Float:mx = lsegs * lstep; x <= mx; x += lstep) {
  646. for(new Float:y, Float:my = wsegs * wstep; y <= my; y += wstep) {
  647. for(new Float:z, Float:mz = hsegs * hstep; z <= mz; z += hstep) {
  648. if(fill || (x == 0.0 || y == 0.0 || z == 0.0 || x == mx || y == my || z == mz)) {
  649. AttachPoint(
  650. sx + x, sy + y, sy + y, orx, ory, orz,
  651. cx, cy, cz, rx, ry, rz,
  652. nx, ny, nz, nrx, nry, nrz
  653. );
  654. AddOBMObject(playerid, modelid, nx, ny, nz, nrx, nry, nrz);
  655. }
  656. }
  657. }
  658. }
  659. return 1;
  660. }
  661. /* Creates objects in a line */
  662. /*CreateDynamicPrism(playerid, modelid,
  663. Float:cx, Float:cy, Float:cz,
  664. Float:l, Float:w, Float:h,
  665. Float:rx, Float:ry, Float:rz,
  666. Float:orz, Float:ory, Float:orz,
  667. segs, bool:fill)
  668. {
  669. const
  670. Float:halve = l / 2.0,
  671. Float:d = VectorSize(l, w, h),
  672. Float:step = d / segs;
  673. new
  674. Float:sx = cx - halve,
  675. Float:sy = cy - halve,
  676. Float:sz = cz - halve;
  677. // Float:ex = cx + halve,
  678. // Float:ey = cy + halve,
  679. // Float:ez = cz + halve;
  680. l /= d; w /= d; h /= d;
  681. for(new Float:j; j <= segs * step; j += step)
  682. AddOBMObject(
  683. playerid, modelid,
  684. sx + (j * l), sy + (j * w), sz + (j * h),
  685. orx, ory, orz
  686. );
  687. Streamer_Update(playerid);
  688. return 1;
  689. }*/
  690. //==========================================================================================