TonyVk

Prepreke

Oct 30th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.51 KB | None | 0 0
  1. #define MAX_PREPREKA 10
  2. #define PREPREKA_SRINA 5
  3. #define PREPREKA_DUZINA 5
  4. new aPrepreka[MAX_PREPREKA];
  5. new PreprekaSlot[2][MAX_PLAYERS];
  6. new Iterator:it_prepreka<MAX_PREPREKA>;
  7.  
  8.  
  9. ////////////////////////////////////////////////
  10. public OnPlayerEnterDynamicArea(playerid, areaid)
  11. {
  12. foreach(new i:it_prepreka)
  13. {
  14. if(aPrepreka[i]==areaid)
  15. {
  16. if(!IsPlayerInAnyVehicle(playerid)) return 1;
  17. new vehicleid = GetPlayerVehicleID(playerid);
  18. new panels, doors, lights, tires;
  19. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  20. UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 15);
  21. return 1;
  22. }
  23. }
  24. return 1;
  25. }
  26. ////////////////////////////////////////////////
  27. YCMD:prepreka(playerid, params[], help)
  28. {
  29. #pragma unused help
  30. if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,"MC:RP | "CRVENA"Moras se ulogovati da bi koristio ovu komandu!");
  31. if(PlayerInfo[playerid][pClan] == 1 || PlayerInfo[playerid][pLider] == 1 || PlayerInfo[playerid][pClan] == 7 || PlayerInfo[playerid][pLider] == 7)
  32. {
  33. if(PolicajacNaDuznosti[playerid] == 0) return SendClientMessage(playerid, -1, ""PLAVA"(LSPD) "SIVA"Niste uzeli znacku(duznost) pa nemozete koristi tu komandu!");
  34. if(PlayerInfo[playerid][pRank] < 3) return SCM(playerid, -1, ""PLAVA"[GRESKA] "BELA"Morate biti rank 3+ da bi koristili ovu komandu!");
  35. new id,Float:A; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A);
  36. if(sscanf(params, "i", id))
  37. {
  38. SCM(playerid, -1, ""PPLAVA"MC:RP Pomoc | "BELA"/prepreka [Prepreke (1-4)]");
  39. SCM(playerid, -1, "|------------------PREPREKE-----------------|");
  40. SCM(playerid, -1, ""PPLAVA"(1). "BELA"M - Za Gume");
  41. SCM(playerid, -1, ""PPLAVA"(2). "BELA"V - Za Gume");
  42. SCM(playerid, -1, ""PPLAVA"(3). "BELA"Velika Blokada");
  43. SCM(playerid, -1, ""PPLAVA"(4). "BELA"Obicna Prepreka");
  44. SCM(playerid, -1, "|------------------------------------------------|");
  45. return 1;
  46. }
  47. if(id == 1)
  48. {
  49. if(Prepreka1Kreirana[playerid] == false)
  50. {
  51. Prepreka1[playerid] = CreateDynamicObject(2899, X, Y, Z-0.9, 0.0, 0.0, A+180);
  52. Prepreka1Kreirana[playerid] = true;
  53. new Float:x ,Float:y ,Float:z ;
  54. GetPlayerPos(playerid ,x ,y ,z);
  55. new freeSlot = Iter_Free(it_prepreka);
  56. PreprekaSlot[0][playerid] = freeSlot;
  57. Iter_Add(it_prepreka,freeSlot);
  58. aPrepreka[freeSlot] = CreateDynamicRectangle(x-2.2 ,y ,x + PREPREKA_SRINA ,y + PREPREKA_DUZINA );
  59. SCM(playerid, -1, ""SIVA"INFO | "BELA"Postavili ste prepreku!");
  60. }
  61. else return SCM(playerid, -1, ""PLAVA"(GRESKA) "BELA"Vec imate kreiranu tu prepreku.");
  62. }
  63. else if(id == 2)
  64. {
  65. if(Prepreka2Kreirana[playerid] == false)
  66. {
  67. Prepreka2[playerid] = CreateDynamicObject(2892, X+5, Y, Z-1, 0.0, 0.0, A+180);
  68. Prepreka2Kreirana[playerid] = true;
  69. new Float:x ,Float:y ,Float:z ;
  70. GetPlayerPos(playerid ,x ,y ,z);
  71. new freeSlot = Iter_Free(it_prepreka);
  72. PreprekaSlot[1][playerid] = freeSlot;
  73. Iter_Add(it_prepreka,freeSlot);
  74. aPrepreka[freeSlot] = CreateDynamicRectangle(x-2.2 ,y ,x + PREPREKA_SRINA ,y + PREPREKA_DUZINA );
  75. SCM(playerid, -1, ""SIVA"INFO | "BELA"Postavili ste prepreku!");
  76. }
  77. else return SCM(playerid, -1, ""PLAVA"(GRESKA) "BELA"Vec imate kreiranu tu prepreku.");
  78. }
  79. else if(id == 3)
  80. {
  81. if(Prepreka3Kreirana[playerid] == false)
  82. {
  83. Prepreka3[playerid] = CreateDynamicObject(981, X+5, Y, Z-0.5, 0.00000000, 0.00000000, 0.00000000);
  84. Prepreka3Kreirana[playerid] = true;
  85. SCM(playerid, -1, ""SIVA"INFO | "BELA"Postavili ste prepreku!");
  86. }
  87. else return SCM(playerid, -1, ""PLAVA"(GRESKA) "BELA"Vec imate kreiranu tu prepreku.");
  88. }
  89. else if(id == 4)
  90. {
  91. if(Prepreka4Kreirana[playerid] == false)
  92. {
  93. Prepreka4[playerid] = CreateDynamicObject(1228, X+5, Y, Z-0.5, 0.00000000, 0.00000000, 0.00000000);
  94. Prepreka4Kreirana[playerid] = true;
  95. SCM(playerid, -1, ""SIVA"INFO | "BELA"Postavili ste prepreku!");
  96. }
  97. else return SendClientMessage(playerid, -1, ""PLAVA"(GRESKA) "BELA"Vec imate kreiranu tu prepreku.");
  98. }
  99. else return SCM(playerid, -1, ""PLAVA"(GRESKA) "BELA"Pogresan ID prepreke (1-4)!");
  100. }
  101. else SendClientMessage(playerid,-1,""PLAVA"[GRESKA] "SIVA"Samo clanovi LSPD!");
  102. return 1;
  103. }
  104.  
  105.  
  106.  
  107.  
  108.  
  109. ///////////////////////////////////////////////////////
  110. YCMD:unistiprepreku(playerid, params[],help)
  111. {
  112. #pragma unused help
  113. if(PlayerInfo[playerid][pClan] == 1 || PlayerInfo[playerid][pLider] == 1 || PlayerInfo[playerid][pClan] == 7 || PlayerInfo[playerid][pLider] == 7)
  114. {
  115. if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,"MC:RP | "CRVENA"Moras se ulogovati da bi koristio ovu komandu!");
  116. if(PolicajacNaDuznosti[playerid] == 0) return SendClientMessage(playerid, -1, ""PLAVA"(LSPD) "SIVA"Niste uzeli znacku(duznost) pa nemozete koristi tu komandu!");
  117. new id;
  118. if(sscanf(params, "i", id)) return SCM(playerid,-1, ""PPLAVA"MC:RP Pomoc | "SIVA"/unistiprepreku [Prepreke (1-4)]");
  119. if(id == 1)
  120. {
  121. if(Prepreka1Kreirana[playerid] == true)
  122. {
  123. DestroyDynamicObject(Prepreka1[playerid]);
  124. SCM(playerid, -1, ""SIVA"INFO | "BELA"Unistili ste prepreku!");
  125. Prepreka1Kreirana[playerid] = false;
  126. Iter_Remove(it_prepreka,PreprekaSlot[0][playerid]);
  127. DestroyDynamicArea(aPrepreka[PreprekaSlot[0][playerid]]);
  128. aPrepreka[playerid] = 0;
  129. PreprekaSlot[0][playerid] = 0;
  130. }
  131. else return SendClientMessage(playerid, -1, ""PLAVA"(GRESKA) "BELA"Ta prepreka nije kreirana!");
  132. }
  133. else if(id == 2)
  134. {
  135. if(Prepreka2Kreirana[playerid] == true)
  136. {
  137. DestroyDynamicObject(Prepreka2[playerid]);
  138. SCM(playerid, -1, ""SIVA"INFO | "BELA"Unistili ste prepreku!");
  139. Prepreka2Kreirana[playerid] = false;
  140. Iter_Remove(it_prepreka,PreprekaSlot[1][playerid]);
  141. DestroyDynamicArea(aPrepreka[PreprekaSlot[1][playerid]]);
  142. aPrepreka[playerid] = 0;
  143. PreprekaSlot[1][playerid] = 0;
  144. }
  145. else return SendClientMessage(playerid, -1, ""PLAVA"(GRESKA) "BELA"Ta prepreka nije kreirana!");
  146. }
  147. else if(id == 3)
  148. {
  149. if(Prepreka3Kreirana[playerid] == true)
  150. {
  151. DestroyDynamicObject(Prepreka3[playerid]);
  152. SCM(playerid, -1, ""SIVA"INFO | "BELA"Unistili ste prepreku!");
  153. Prepreka3Kreirana[playerid] = false;
  154. }
  155. else return SendClientMessage(playerid, -1, ""PLAVA"(GRESKA) "BELA"Ta prepreka nije kreirana!");
  156. }
  157. else if(id == 4)
  158. {
  159. if(Prepreka4Kreirana[playerid] == true)
  160. {
  161. DestroyDynamicObject(Prepreka4[playerid]);
  162. SCM(playerid, -1, ""SIVA"INFO | "BELA"Unistili ste prepreku!");
  163. Prepreka4Kreirana[playerid] = false;
  164. }
  165. else return SendClientMessage(playerid, -1, ""PLAVA"(GRESKA) "BELA"Ta prepreka nije kreirana!");
  166. }
  167. else return SCM(playerid, -1, ""PLAVA"(GRESKA) "BELA"Pogresan ID prepreke!");
  168. } else SendClientMessage(playerid,-1,""PLAVA"[GRESKA] "SIVA"Samo clanovi LSPD/FBI!");
  169. return 1;
  170. }
Advertisement
Add Comment
Please, Sign In to add comment