Guest User

Christmass System!

a guest
Nov 23rd, 2014
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.62 KB | None | 0 0
  1. // Filterscript by Adrian Petre,nu stergeti creditele!!!
  2.  
  3. #define FILTERSCRIPT // Definirea de Filescript.
  4.  
  5. #include <a_samp>
  6. //#include <Double-O-Icons> // Asta lasatil asa.
  7.  
  8. #define COLOR_LIME 0x00FF00DC //Culoarea LIME(verde mai deschis) pentru caciula de mos craciun
  9. #define GREY 0xAFAFAFAA // Culoarea gri
  10. #define LIGHTGREEN 0x9ACD32AA //Culoarea verde deschis.
  11. #if defined FILTERSCRIPT // Definirea de Filescript.
  12.  
  13.  
  14. #define F_MAX_OBJECTS 1000 //Ai posibilitatea de a pune 1000 de obiecte create(de comanda /brad) pe server
  15. #define UpdateTime 300 //Update la timp pentru brazi
  16. #define ObjectsToStream 300 // 300 obiecte pe streamer..
  17. #define StreamRange 300.0 // Distanta in care vei vedea brazii.
  18. #pragma dynamic 30000 // O chestie importanta.
  19. #define MAX_XMASTREES 100 // Maximul de brazi pe server este de 100 pentru a nu se creea lag.
  20.  
  21. forward F_ObjectUpdate(bool:DontCheckDistance);
  22. forward F_StartUpdate();
  23.  
  24. new
  25. bool:snowOn[ 54 char ],
  26. snowObject[ 54 ][ 5 ],
  27. updateTimer [ 54 char ]
  28. ;
  29.  
  30. enum XmasTrees
  31. {
  32. XmasTreeX,
  33. Float:XmasX,
  34. Float:XmasY,
  35. Float:XmasZ,
  36. XmasObject1,
  37. XmasObject2,
  38. XmasObject3,
  39. XmasObject4,
  40. XmasObject5,
  41. XmasObject6,
  42. XmasObject7,
  43. XmasObject8,
  44. XmasObject9,
  45. XmasObject10,
  46.  
  47. };
  48. new Treepos[MAX_XMASTREES][XmasTrees];
  49.  
  50. enum OInfo
  51. {
  52. ModelID,
  53. ObjectID[MAX_PLAYERS],
  54. Float:ox,
  55. Float:oy,
  56. Float:oz,
  57. Float:orox,
  58. Float:oroy,
  59. Float:oroz,
  60. Float:ovdist,
  61. bool:ObjectCreated[MAX_PLAYERS],
  62. };
  63. new ObjectInfo[F_MAX_OBJECTS][OInfo];
  64. new bool:ObjectUpdatetRunning;
  65. new bool:CantCreateMore;
  66. new bool:RefreshObjects[MAX_PLAYERS];
  67. new Float:OldX[MAX_PLAYERS], Float:OldY[MAX_PLAYERS], Float:OldZ[MAX_PLAYERS];
  68.  
  69. public OnFilterScriptInit()
  70. {
  71. print("\n--------------------------------------");
  72. print(" Brad de Craciun by Adrian Pere ");
  73. print("--------------------------------------\n");
  74. return 1;
  75. }
  76.  
  77. public OnFilterScriptExit()
  78. {
  79. return 1;
  80. }
  81.  
  82. public OnPlayerConnect( playerid )
  83. {
  84. CreateSnow( playerid );
  85. return 1;
  86. }
  87.  
  88. public OnPlayerCommandText(playerid, cmdtext[])
  89. {
  90. if(strcmp(cmdtext, "/brad", true) == 0)
  91. {
  92. new Float:plocx,Float:plocy,Float:plocz; // Ia niste float-uri.
  93. GetPlayerPos(playerid, plocx, plocy, plocz); // Se iau coordonatele playerului.
  94. SetXmasTree(plocx,plocy,plocz);// Se iau coordonatele bradului si se creeaza.
  95. SetPlayerPos(playerid, plocx-2.5, plocy+2.5, plocz);//La aceasta pozitie se va creea bradul
  96. SendClientMessage(playerid, LIGHTGREEN, "Ai creat un brad de craciun!Felicitari.");
  97. return 1;
  98.  
  99. }
  100. if(strcmp(cmdtext, "/scoatebrad", true) == 0)
  101. {
  102. DeleteClosestXmasTree(playerid);
  103. SendClientMessage(playerid, LIGHTGREEN, "Ai scos un brad de craciun!Sarbatori fericite!");
  104. return 1;
  105.  
  106. }
  107. if(!strcmp(cmdtext, "/caciula", true))
  108. {
  109. if( snowOn{ playerid } )
  110. {
  111. DeleteSnow( playerid );
  112. SendClientMessage( playerid, 0x00FF00AA, "{FF0000}Sarbatori fericite!{FFFFFF}Ai oprit ninsoarea!" );
  113. }
  114. else
  115. {
  116. CreateSnow( playerid );
  117. SendClientMessage( playerid, 0x00FF00AA, "{FF0000}Craciunul soseste!{FFFFFF}Ninge!" );
  118. }
  119. return ( 1 );
  120. }
  121. if(!strcmp(cmdtext, "/caciula", true))
  122. {
  123. SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
  124. return SendClientMessage(playerid, 0x00FF00FF, "Ti-ai pus o caciula de Mos Craciun!Sarbatori fericite!");
  125. }
  126. if(!strcmp(cmdtext, "/scoatecaciula", true))
  127. {
  128. if(IsPlayerAttachedObjectSlotUsed(playerid, 3))
  129. {
  130. RemovePlayerAttachedObject(playerid, 3);
  131. SendClientMessage(playerid, 0x00FF00FF, "Ti-ai dat caciula de craciun jos!Sarbatori fericite!");
  132. }
  133. return 1;
  134. }
  135. if(strcmp(cmdtext, "/scoatetotibrazii", true) == 0)
  136. {
  137. DeleteAllXmasTree();
  138. SendClientMessage(playerid, LIGHTGREEN, "Ai scos toti brazii de pe server!Sarbatori fericite!");
  139. return 1;
  140.  
  141.  
  142. }
  143. return 0;
  144. }
  145.  
  146. public F_StartUpdate()
  147. {
  148. SetTimer("F_ObjectUpdate", UpdateTime, 1);
  149. }
  150.  
  151. stock F_CreateObject(modelid, Float:x, Float:y, Float:z, Float:rox, Float:roy, Float:roz, Float:vdist=0.0)
  152. {
  153. if(ObjectUpdatetRunning == false)
  154. {
  155. SetTimer("F_StartUpdate", F_MAX_OBJECTS/2, 0);
  156. ObjectUpdatetRunning = true;
  157. }
  158.  
  159. new objectid;
  160.  
  161. if(CantCreateMore == false)
  162. {
  163. for(new i; i<F_MAX_OBJECTS; i++)
  164. {
  165. if(i == F_MAX_OBJECTS-1)
  166. {
  167. printf("Obiectele de la brazi (%i) au ajuns la limita!", F_MAX_OBJECTS);
  168. CantCreateMore = true;
  169. }
  170. if(ObjectInfo[i][ModelID] == 0)
  171. {
  172. objectid = i;
  173. break;
  174. }
  175. }
  176. }
  177. else
  178. {
  179. return -1;
  180. }
  181.  
  182. if(modelid == 0)
  183. {
  184. printf("Comanda invalida a obiectului (%i)", objectid);
  185. return -1;
  186. }
  187.  
  188. ObjectInfo[objectid][ModelID] = modelid;
  189. ObjectInfo[objectid][ox] = x;
  190. ObjectInfo[objectid][oy] = y;
  191. ObjectInfo[objectid][oz] = z;
  192. ObjectInfo[objectid][orox] = rox;
  193. ObjectInfo[objectid][oroy] = roy;
  194. ObjectInfo[objectid][oroz] = roz;
  195. ObjectInfo[objectid][ovdist] = vdist;
  196. return objectid;
  197. }
  198.  
  199. stock F_IsValidObject(objectid)
  200. {
  201. if(ObjectInfo[objectid][ModelID] == 0 || objectid == -1)
  202. {
  203. return 0;
  204. }
  205. return 1;
  206. }
  207.  
  208. stock F_DestroyObject(objectid)
  209. {
  210. if(F_IsValidObject(objectid))
  211. {
  212. for(new playerid; playerid<MAX_PLAYERS; playerid++)
  213. {
  214. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid) && ObjectInfo[objectid][ObjectCreated][playerid] == true)
  215. {
  216. DestroyPlayerObject(playerid, ObjectInfo[objectid][ObjectID][playerid]);
  217. ObjectInfo[objectid][ObjectCreated][playerid] = false;
  218. }
  219. }
  220. ObjectInfo[objectid][ModelID] = 0;
  221. return 1;
  222. }
  223. return 0;
  224. }
  225.  
  226. stock F_MoveObject(objectid, Float:x, Float:y, Float:z, Float:speed)
  227. {
  228. if(F_IsValidObject(objectid))
  229. {
  230. new time;
  231. for(new playerid; playerid<MAX_PLAYERS; playerid++)
  232. {
  233. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid) && ObjectInfo[objectid][ObjectCreated][playerid] == true)
  234. {
  235. time = MovePlayerObject(playerid, ObjectInfo[objectid][ObjectID][playerid], x, y, z, speed);
  236. }
  237. }
  238. return time;
  239. }
  240. return 0;
  241. }
  242.  
  243. stock F_StopObject(objectid)
  244. {
  245. if(F_IsValidObject(objectid))
  246. {
  247. for(new playerid; playerid<MAX_PLAYERS; playerid++)
  248. {
  249. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid) && ObjectInfo[objectid][ObjectCreated][playerid] == true)
  250. {
  251. StopPlayerObject(playerid, ObjectInfo[objectid][ObjectID][playerid]);
  252. }
  253. }
  254. return 1;
  255. }
  256. return 0;
  257. }
  258.  
  259. stock F_SetObjectPos(objectid, Float:x, Float:y, Float:z)
  260. {
  261. if(F_IsValidObject(objectid))
  262. {
  263. ObjectInfo[objectid][ox] = x;
  264. ObjectInfo[objectid][oy] = y;
  265. ObjectInfo[objectid][oz] = z;
  266. for(new playerid; playerid<MAX_PLAYERS; playerid++)
  267. {
  268. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid) && ObjectInfo[objectid][ObjectCreated][playerid] == true)
  269. {
  270. SetPlayerObjectPos(playerid, ObjectInfo[objectid][ObjectID][playerid], x, y, z);
  271. }
  272. }
  273. return 1;
  274. }
  275. return 0;
  276. }
  277.  
  278. stock F_GetObjectPos(objectid, &Float:x, &Float:y, &Float:z)
  279. {
  280. if(F_IsValidObject(objectid))
  281. {
  282. x = ObjectInfo[objectid][ox];
  283. y = ObjectInfo[objectid][oy];
  284. z = ObjectInfo[objectid][oz];
  285. return 1;
  286. }
  287. else
  288. {
  289. return 0;
  290. }
  291. }
  292.  
  293. stock F_SetObjectRot(objectid, Float:rox, Float:roy, Float:roz)
  294. {
  295. if(F_IsValidObject(objectid))
  296. {
  297. ObjectInfo[objectid][orox] = rox;
  298. ObjectInfo[objectid][oroy] = roy;
  299. ObjectInfo[objectid][oroz] = roz;
  300. for(new playerid; playerid<MAX_PLAYERS; playerid++)
  301. {
  302. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid) && ObjectInfo[objectid][ObjectCreated][playerid] == true)
  303. {
  304. SetPlayerObjectRot(playerid, ObjectInfo[objectid][ObjectID][playerid], rox, roy, roz);
  305. }
  306. }
  307. return 1;
  308. }
  309. return 0;
  310. }
  311.  
  312. stock F_GetObjectRot(objectid, &Float:rox, &Float:roy, &Float:roz)
  313. {
  314. if(F_IsValidObject(objectid))
  315. {
  316. rox = ObjectInfo[objectid][orox];
  317. roy = ObjectInfo[objectid][oroy];
  318. roz = ObjectInfo[objectid][oroz];
  319. return 1;
  320. }
  321. else
  322. {
  323. return 0;
  324. }
  325. }
  326.  
  327. stock F_RefreshObjects(playerid)
  328. {
  329. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
  330. {
  331. RefreshObjects[playerid] = true;
  332. new Float:x, Float:y, Float:z;
  333. GetPlayerPos(playerid, x, y, z);
  334. F_PlayerObjectUpdate(playerid, x, y, z);
  335. return 1;
  336. }
  337. return 0;
  338. }
  339.  
  340. stock F_Streamer_OnPlayerConnect(playerid)
  341. {
  342. for(new objectid; objectid<F_MAX_OBJECTS; objectid++)
  343. {
  344. ObjectInfo[objectid][ObjectCreated][playerid] = false;
  345. }
  346. OldX[playerid] = 999999999.99;
  347. OldY[playerid] = 999999999.99;
  348. OldZ[playerid] = 999999999.99;
  349. RefreshObjects[playerid] = false;
  350. return 1;
  351. }
  352.  
  353. public F_ObjectUpdate(bool:DontCheckDistance)
  354. {
  355. new Float:ObjDistance[F_MAX_OBJECTS];
  356. new Closest[ObjectsToStream];
  357. new ObjectArr[F_MAX_OBJECTS];
  358. new nr;
  359. new bool:Firstloop;
  360. new bool:DontDestroy[F_MAX_OBJECTS];
  361.  
  362. for(new playerid; playerid<MAX_PLAYERS; playerid++)
  363. {
  364. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
  365. {
  366. if(!IsPlayerInRangeOfPoint(playerid, 1.0, OldX[playerid], OldY[playerid], OldZ[playerid]) || DontCheckDistance)
  367. {
  368. GetPlayerPos(playerid, OldX[playerid], OldY[playerid], OldZ[playerid]);
  369.  
  370. nr = 0;
  371. for(new objectid; objectid<F_MAX_OBJECTS; objectid++)
  372. {
  373. if(F_IsValidObject(objectid))
  374. {
  375. ObjDistance[objectid] = floatsqroot(floatpower(floatsub(ObjectInfo[objectid][ox],OldX[playerid]),2)+floatpower(floatsub(ObjectInfo[objectid][oy],OldY[playerid]),2)+floatpower(floatsub(ObjectInfo[objectid][oz],OldZ[playerid]),2));
  376. if(floatcmp(ObjDistance[objectid], StreamRange) == -1)
  377. {
  378. ObjectArr[nr] = objectid;
  379. nr++;
  380. }
  381. }
  382. }
  383.  
  384. Closest = "";
  385.  
  386. if(nr > ObjectsToStream)
  387. {
  388. for(new loop; loop<ObjectsToStream; loop++)
  389. {
  390. Firstloop = true;
  391. for(new objectid; objectid<nr; objectid++)
  392. {
  393. if((ObjDistance[ObjectArr[objectid]] != 999999999.99) && ((floatcmp(ObjDistance[ObjectArr[objectid]], ObjDistance[Closest[loop]]) == -1) || Firstloop))
  394. {
  395. Firstloop = false;
  396. Closest[loop] = ObjectArr[objectid];
  397. }
  398. }
  399. ObjDistance[Closest[loop]] = 999999999.99;
  400. }
  401. }
  402. else
  403. {
  404. for(new objectid; objectid<nr; objectid++)
  405. {
  406. Closest[objectid] = ObjectArr[objectid];
  407. }
  408. }
  409.  
  410. for(new objectid; objectid<F_MAX_OBJECTS; objectid++) { DontDestroy[objectid] = false; }
  411. for(new objectid; objectid<ObjectsToStream && objectid<nr; objectid++)
  412. {
  413. DontDestroy[Closest[objectid]] = true;
  414. }
  415.  
  416. for(new objectid; objectid<F_MAX_OBJECTS; objectid++)
  417. {
  418. if(ObjectInfo[objectid][ObjectCreated][playerid] == true && DontDestroy[objectid] == false)
  419. {
  420. DestroyPlayerObject(playerid, ObjectInfo[objectid][ObjectID][playerid]);
  421. ObjectInfo[objectid][ObjectCreated][playerid] = false;
  422. }
  423. }
  424.  
  425. for(new loop; loop<ObjectsToStream && loop<nr; loop++)
  426. {
  427. if(ObjectInfo[Closest[loop]][ObjectCreated][playerid] == false)
  428. {
  429. ObjectInfo[Closest[loop]][ObjectID][playerid] = CreatePlayerObject(playerid, ObjectInfo[Closest[loop]][ModelID], ObjectInfo[Closest[loop]][ox], ObjectInfo[Closest[loop]][oy], ObjectInfo[Closest[loop]][oz], ObjectInfo[Closest[loop]][orox], ObjectInfo[Closest[loop]][oroy], ObjectInfo[Closest[loop]][oroz], ObjectInfo[Closest[loop]][ovdist]);
  430. ObjectInfo[Closest[loop]][ObjectCreated][playerid] = true;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437.  
  438. stock F_ObjectUpdateForAll()
  439. {
  440. F_ObjectUpdate(true);
  441. }
  442.  
  443. stock F_PlayerObjectUpdate(playerid, Float:x, Float:y, Float:z)
  444. {
  445. if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
  446. {
  447. OldX[playerid] = x;
  448. OldY[playerid] = y;
  449. OldZ[playerid] = z;
  450.  
  451. new nr;
  452. new Float:ObjDistance[F_MAX_OBJECTS];
  453. new ObjectArr[F_MAX_OBJECTS];
  454. for(new objectid; objectid<F_MAX_OBJECTS; objectid++)
  455. {
  456. if(F_IsValidObject(objectid))
  457. {
  458. ObjDistance[objectid] = floatsqroot(floatpower(floatsub(ObjectInfo[objectid][ox],x),2)+floatpower(floatsub(ObjectInfo[objectid][oy],y),2)+floatpower(floatsub(ObjectInfo[objectid][oz],z),2));
  459. if(floatcmp(ObjDistance[objectid], StreamRange) == -1)
  460. {
  461. ObjectArr[nr] = objectid;
  462. nr++;
  463. }
  464. }
  465. }
  466.  
  467. new Closest[ObjectsToStream];
  468.  
  469. if(nr > ObjectsToStream)
  470. {
  471. for(new loop; loop<ObjectsToStream; loop++)
  472. {
  473. new bool:Firstloop = true;
  474. for(new objectid; objectid<nr; objectid++)
  475. {
  476. if((ObjDistance[ObjectArr[objectid]] != 999999999.99) && ((floatcmp(ObjDistance[ObjectArr[objectid]], ObjDistance[Closest[loop]]) == -1) || Firstloop))
  477. {
  478. Firstloop = false;
  479. Closest[loop] = ObjectArr[objectid];
  480. }
  481. }
  482. ObjDistance[Closest[loop]] = 999999999.99;
  483. }
  484. }
  485. else
  486. {
  487. for(new objectid; objectid<nr; objectid++)
  488. {
  489. Closest[objectid] = ObjectArr[objectid];
  490. }
  491. }
  492.  
  493. new bool:DontDestroy[F_MAX_OBJECTS];
  494. for(new objectid; objectid<ObjectsToStream && objectid<nr; objectid++)
  495. {
  496. DontDestroy[Closest[objectid]] = true;
  497. }
  498.  
  499. for(new objectid; objectid<F_MAX_OBJECTS; objectid++)
  500. {
  501. if(ObjectInfo[objectid][ObjectCreated][playerid] == true && (DontDestroy[objectid] == false || RefreshObjects[playerid] == true))
  502. {
  503. DestroyPlayerObject(playerid, ObjectInfo[objectid][ObjectID][playerid]);
  504. ObjectInfo[objectid][ObjectCreated][playerid] = false;
  505. }
  506. }
  507. RefreshObjects[playerid] = false;
  508.  
  509. for(new loop; loop<ObjectsToStream && loop<nr; loop++)
  510. {
  511. if(ObjectInfo[Closest[loop]][ObjectCreated][playerid] == false)
  512. {
  513. ObjectInfo[Closest[loop]][ObjectID][playerid] = CreatePlayerObject(playerid, ObjectInfo[Closest[loop]][ModelID], ObjectInfo[Closest[loop]][ox], ObjectInfo[Closest[loop]][oy], ObjectInfo[Closest[loop]][oz], ObjectInfo[Closest[loop]][orox], ObjectInfo[Closest[loop]][oroy], ObjectInfo[Closest[loop]][oroz], ObjectInfo[Closest[loop]][ovdist]);
  514. ObjectInfo[Closest[loop]][ObjectCreated][playerid] = true;
  515. }
  516. }
  517. }
  518. }
  519. #define SetPlayerPos F_SetPlayerPos
  520. stock F_SetPlayerPos(playerid, Float:x, Float:y, Float:z)
  521. {
  522. F_PlayerObjectUpdate(playerid, x, y, z);
  523. SetPlayerPos(playerid, x, y, z);
  524. }
  525.  
  526. stock SetXmasTree(Float:x,Float:y,Float:z)
  527. {
  528. for(new i = 0; i < sizeof(Treepos); i++)
  529. {
  530. if(Treepos[i][XmasTreeX] == 0)
  531. {
  532. Treepos[i][XmasTreeX]=1;
  533. Treepos[i][XmasX]=x;
  534. Treepos[i][XmasY]=y;
  535. Treepos[i][XmasZ]=z;
  536. Treepos[i][XmasObject1] = F_CreateObject(19076, x, y, z-1.0,0,0,300);//xmas tree
  537. Treepos[i][XmasObject2] = F_CreateObject(19054, x, y+1.0, z-0.4,0,0,300);//XmasBox1
  538. Treepos[i][XmasObject3] = F_CreateObject(19058, x+1.0, y, z-0.4,0,0,300);//XmasBox5
  539. Treepos[i][XmasObject4] = F_CreateObject(19056, x, y-1.0, z-0.4,0,0,300);//XmasBox3
  540. Treepos[i][XmasObject5] = F_CreateObject(19057, x-1.0, y, z-0.4,0,0,300);//XmasBox4
  541. Treepos[i][XmasObject6] = F_CreateObject(19058, x-1.5, y+1.5, z-1.0,0,0,300);//XmasBox5
  542. Treepos[i][XmasObject7] = F_CreateObject(19055, x+1.5, y-1.5, z-1.0,0,0,300);//XmasBox2
  543. Treepos[i][XmasObject8] = F_CreateObject(19057, x+1.5, y+1.5, z-1.0,0,0,300);//XmasBox4
  544. Treepos[i][XmasObject9] = F_CreateObject(19054, x-1.5, y-1.5, z-1.0,0,0,300);//XmasBox1
  545. Treepos[i][XmasObject10] = F_CreateObject(3526, x, y, z-1.0,0,0,300);//Airportlight - for flashing affect
  546. return 1;
  547. }
  548. }
  549. return 0;
  550. }
  551.  
  552. stock DeleteAllXmasTree()
  553. {
  554. for(new i = 0; i < sizeof(Treepos); i++)
  555. {
  556. if(Treepos[i][XmasTreeX] == 1)
  557. {
  558. Treepos[i][XmasTreeX]=0;
  559. Treepos[i][XmasX]=0.0;
  560. Treepos[i][XmasY]=0.0;
  561. Treepos[i][XmasZ]=0.0;
  562. F_DestroyObject(Treepos[i][XmasObject1]);
  563. F_DestroyObject(Treepos[i][XmasObject2]);
  564. F_DestroyObject(Treepos[i][XmasObject3]);
  565. F_DestroyObject(Treepos[i][XmasObject4]);
  566. F_DestroyObject(Treepos[i][XmasObject5]);
  567. F_DestroyObject(Treepos[i][XmasObject6]);
  568. F_DestroyObject(Treepos[i][XmasObject7]);
  569. F_DestroyObject(Treepos[i][XmasObject8]);
  570. F_DestroyObject(Treepos[i][XmasObject9]);
  571. F_DestroyObject(Treepos[i][XmasObject10]);
  572. }
  573. }
  574. return 0;
  575. }
  576.  
  577. stock DeleteClosestXmasTree(playerid)
  578. {
  579. for(new i = 0; i < sizeof(Treepos); i++)
  580. {
  581. if(IsPlayerInRangeOfPoint(playerid, 3.0, Treepos[i][XmasX], Treepos[i][XmasY], Treepos[i][XmasZ]))
  582. {
  583. if(Treepos[i][XmasTreeX] == 1)
  584. {
  585. Treepos[i][XmasTreeX]=0;
  586. Treepos[i][XmasX]=0.0;
  587. Treepos[i][XmasY]=0.0;
  588. Treepos[i][XmasZ]=0.0;
  589. F_DestroyObject(Treepos[i][XmasObject1]);
  590. F_DestroyObject(Treepos[i][XmasObject2]);
  591. F_DestroyObject(Treepos[i][XmasObject3]);
  592. F_DestroyObject(Treepos[i][XmasObject4]);
  593. F_DestroyObject(Treepos[i][XmasObject5]);
  594. F_DestroyObject(Treepos[i][XmasObject6]);
  595. F_DestroyObject(Treepos[i][XmasObject7]);
  596. F_DestroyObject(Treepos[i][XmasObject8]);
  597. F_DestroyObject(Treepos[i][XmasObject9]);
  598. F_DestroyObject(Treepos[i][XmasObject10]);
  599. return 1;
  600. }
  601. }
  602. }
  603. return 0;
  604. }
  605. stock CreateSnow( playerid )
  606. {
  607. if( snowOn{ playerid } )
  608. return ( 0 );
  609.  
  610. new Float:pPos[ 3 ];
  611. GetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
  612.  
  613. for( new i = 0; i < 5; i ++ )
  614. snowObject[ playerid ][ i ] = CreateObject( 18864, pPos[ 0 ] + random( 25 ), pPos[ 1 ] + random ( 25 ), pPos[ 2 ] - 5, random( 100 ), random( 100 ), random( 100 ), -1, -1, playerid );
  615.  
  616. snowOn{ playerid } = true;
  617. return ( 1 );
  618. }
  619.  
  620. stock DeleteSnow( playerid )
  621. {
  622. if( !snowOn{ playerid } )
  623. return ( 0 );
  624.  
  625. for( new i = 0; i < 5; i ++ )
  626. DestroyObject( snowObject[ playerid ][ i ] );
  627.  
  628. KillTimer( updateTimer{ playerid } );
  629. snowOn{ playerid } = false;
  630. return ( 1 );
  631. }
  632. #endif
Advertisement
Add Comment
Please, Sign In to add comment