Guest User

warr

a guest
Jan 27th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.85 KB | None | 0 0
  1. /*
  2.  
  3. ex_War made by dock
  4. DO NOT REMOVE CREDITS
  5.  
  6. Verzija: 0.1 beta
  7.  
  8. */
  9.  
  10. #include <a_samp>
  11. #include <zcmd>
  12. #include <sscanf2>
  13. #include <foreach>
  14.  
  15. #define COLOR_GREY 0xB4B5B7FF
  16. #define COLOR_RED 0xFF0000AA
  17. #define COLOR_LB 0x00FFFFAA
  18. #define COLOR_LR 0xF05D5DAA
  19.  
  20. #define COL_GREY "{B3B5B7}"
  21.  
  22. #define SEM SendClientMessage(playerid, COLOR_RED, " (WAR) "COL_GREY"Nemate ovlasti da korisite ovu komandu!");
  23. #define ID_INVALID SendClientMessage(playerid, COLOR_RED, " (WAR) "COL_GREY"Igrac nije online!");
  24.  
  25. #define War_VW 44 // promenite ako vam ne odgovara..
  26.  
  27. #define func%0(%1) forward%0(%1); \
  28. public%0(%1)
  29.  
  30. new WarBrojanje1 = 0;
  31. new WarBrojanje2 = 0;
  32. new WarTim[MAX_PLAYERS] = 0;
  33. new WarZapocet = 0;
  34. new warbrojanje;
  35. new war;
  36.  
  37. new Float:War1_x,Float:War1_y,Float:War1_z,Float:War1_r,Float:War2_x,Float:War2_y,Float:War2_z,Float:War2_r;
  38.  
  39. //Mape za war, dodajete ovako:
  40. //{-2146.3772, -103.2873, 35.3203, 260.7090, -2106.1848, -269.6343, 35.3203, 354.9998}
  41. // ma kraju { } morate imati zarez (ovako: {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},) osim kod zadnjih koordinata..
  42. forward SafeGivePlayerWeapon(plyid, weaponid, ammo);
  43. new Float:WarMape[][8] =
  44. {
  45. {-2146.3772,-103.2873,35.3203,260.7090,0,0,0,0}
  46. };
  47.  
  48. public OnFilterScriptInit()
  49. {
  50. print("\n--------------------------------------");
  51. print(" ex_War by loaded");
  52. print("--------------------------------------\n");
  53. return 1;
  54. }
  55.  
  56. public OnFilterScriptExit()
  57. {
  58. return 1;
  59. }
  60.  
  61. //Komande
  62.  
  63. CMD:war(playerid,params[])
  64. {
  65. if(!Admin(playerid, 2)) return SEM
  66. new id, tim;
  67. if(sscanf(params,"ui",id,tim)) return SendClientMessage(playerid, COLOR_GREY, "*Koristi: /war [id igraca] [tim (0-2)]");
  68. else if(id == INVALID_PLAYER_ID) return ID_INVALID
  69. WarTim[id] = tim;
  70. if(WarTim[id] == 0) { SetPlayerColor(playerid, 0xffffffff); }
  71. else if(WarTim[id] == 1) { SetPlayerColor(playerid, 0xff0000aa); }
  72. else if(WarTim[id] == 2) { SetPlayerColor(playerid, 0x0000ffaa); }
  73. new str[256];
  74. new ime[MAX_PLAYER_NAME]; GetPlayerName(playerid,ime,sizeof(ime));
  75. new igrac[MAX_PLAYER_NAME]; GetPlayerName(id,igrac,sizeof(igrac));
  76. format(str,256," War | Prozvani ste na war od admina %s!", ime);
  77. SendClientMessage(id, COLOR_LB, str);
  78. format(str,256," War | Prozvali ste igraca %s na war!", igrac);
  79. SendClientMessage(playerid, COLOR_LB, str);
  80. return 1;
  81. }
  82.  
  83. CMD:warpokreni(playerid,params[])
  84. {
  85. if(!Admin(playerid,2)) return SEM
  86. new mapa, vreme;
  87. if(sscanf(params,"ii",mapa,vreme)) return SendClientMessage(playerid, COLOR_GREY, "*Koristi: /warpokreni [id mape] [vreme (u minutima)]"), SendClientMessage(playerid, COLOR_GREY, "*IDevi mapa: 0) Ime mape");
  88. -2146.3772 = WarMape[mapa][0]; -103.2873 = WarMape[mapa][1]; 35.3203 = WarMape[mapa][2]; 260.7090 = WarMape[mapa][3];
  89. War2_x = WarMape[mapa][4]; War2_y = WarMape[mapa][5]; War2_z = WarMape[mapa][6]; War2_r = WarMape[mapa][7];
  90. war = SetTimer("WarTimer", vreme*60000, false);
  91. warbrojanje = SetTimer("WarBrojanje", 3000, true);
  92. foreach(Player,i)
  93. {
  94. if(WarTim[i] > 0)
  95. {
  96. SpawnPlayer(i);
  97. }
  98. }
  99. WarZapocet = 1;
  100. return 1;
  101. }
  102.  
  103. CMD:warzaustavi(playerid,params[])
  104. {
  105. if(!Admin(playerid,2)) return SEM
  106. new str[256];
  107. format(str,256," War | War je zavrsen! TIM 1: %d, TIM 2: %d", WarBrojanje1, WarBrojanje2);
  108. SendWarMessage(COLOR_RED, str);
  109. KillTimer(war);
  110. WarTimer();
  111. WarBrojanje2 = 0;
  112. WarBrojanje1 = 0;
  113. return 1;
  114. }
  115.  
  116. func WarTimer()
  117. {
  118. foreach(Player, i)
  119. {
  120. if(WarTim[i] > 0)
  121. {
  122. if(WarTim[i] == 1)
  123. {
  124. new str[256];
  125. format(str,256," War | War je zavrsen! Vi: %d, Oni: %d", WarBrojanje1, WarBrojanje2);
  126. SendWarMessage(COLOR_LR, str);
  127. }
  128. else if(WarTim[i] == 2)
  129. {
  130. new str[256];
  131. format(str,256," War | War je zavrsen! Vi: %d, Oni: %d", WarBrojanje2, WarBrojanje1);
  132. SendWarMessage(COLOR_LR, str);
  133. }
  134. WarTim[i] = 0;
  135. WarZapocet = 0;
  136. WarBrojanje2 = 0;
  137. WarBrojanje1 = 0;
  138. SpawnPlayer(i);
  139. KillTimer(warbrojanje);
  140. }
  141. }
  142. return 1;
  143. }
  144.  
  145. func WarBrojanje()
  146. {
  147. foreach(Player, i)
  148. {
  149. if(WarTim[i] > 0)
  150. {
  151. if(WarTim[i] == 1)
  152. {
  153. new str[256];
  154. format(str,256,"~w~war~n~~g~Vi: ~w~%d~n~~r~Oni: ~w~%d", WarBrojanje1, WarBrojanje2);
  155. GameTextForPlayer(i, str, 3000, 4);
  156. }
  157. else if(WarTim[i] == 2)
  158. {
  159. new str[256];
  160. format(str,256,"~w~war~n~~g~Vi: ~w~%d~n~~r~Oni: ~w~%d", WarBrojanje2, WarBrojanje1);
  161. GameTextForPlayer(i, str, 3000, 4);
  162. }
  163. }
  164. }
  165. return 1;
  166. }
  167.  
  168. stock Admin(playerid, level)
  169. {
  170. if(IsPlayerAdmin(playerid)) return 1;
  171. if(CallRemoteFunction("GetPlayerWarAdmin", "d", playerid) >= level) return 1;
  172. return 0;
  173. }
  174.  
  175. stock SendWarMessage(color,text[])
  176. {
  177. foreach(Player,i)
  178. {
  179. if(WarTim[i] > 0)
  180. {
  181. SendClientMessage(i, color, text);
  182. }
  183. }
  184. return 1;
  185. }
  186.  
  187. public OnPlayerRequestClass(playerid, classid)
  188. {
  189. return 1;
  190. }
  191.  
  192. public OnPlayerConnect(playerid)
  193. {
  194. return 1;
  195. }
  196.  
  197. public OnPlayerDisconnect(playerid, reason)
  198. {
  199. return 1;
  200. }
  201.  
  202. public OnPlayerSpawn(playerid)
  203. {
  204. if(WarTim[playerid] == 0) { SetPlayerColor(playerid, 0xffffffff); }
  205. else if(WarTim[playerid] == 1) { SetPlayerColor(playerid, 0xff0000aa); }
  206. else if(WarTim[playerid] == 2) { SetPlayerColor(playerid, 0x0000ffaa); }
  207. if(WarZapocet == 1)
  208. {
  209. if(WarTim[playerid] == 1)
  210. {
  211. SetPlayerVirtualWorld(playerid, War_ 0);
  212. SetPlayerPos(playerid, -2146.3772, -103.2873, 35.3203);
  213. SetPlayerFacingAngle(playerid, War1_ 260.7090);
  214. SetPlayerHealth(playerid, 100);
  215. SetPlayerArmour(playerid, 100);
  216. SetPlayerSkin(playerid,115);
  217. SafeGivePlayerWeapon(playerid, 24, 200);// dodajte jos oruzja ako vam je volja :D
  218. SafeGivePlayerWeapon(playerid, 31, 500);
  219. return 1;
  220. }
  221. else if(WarTim[playerid] == 2)
  222. {
  223. SetPlayerVirtualWorld(playerid, 0);
  224. SetPlayerPos(playerid, -2106.1848, -269.6343, 35.3203);
  225. SetPlayerFacingAngle(playerid, 354.9998);
  226. SetPlayerHealth(playerid, 100);
  227. SetPlayerArmour(playerid, 100);
  228. SetPlayerSkin(playerid,107);
  229. GivePlayerWeapon(playerid, 24, 200);// dodajte jos oruzja ako vam je volja :D
  230. GivePlayerWeapon(playerid, 31, 500);
  231. return 1;
  232. }
  233. }
  234. return 1;
  235. }
  236.  
  237. public OnPlayerDeath(playerid, killerid, reason)
  238. {
  239. new ime[MAX_PLAYER_NAME]; GetPlayerName(killerid, ime, sizeof(ime));
  240. new igrac[MAX_PLAYER_NAME]; GetPlayerName(playerid, igrac, sizeof(igrac));
  241. if(WarZapocet == 1)
  242. {
  243. if(WarTim[killerid] == 1)
  244. {
  245. if(WarTim[playerid] == 1)
  246. {
  247. WarBrojanje2++;
  248. SendClientMessage(playerid, COLOR_RED, "*Protivnici su dobili bod jer ste TKali!");
  249. }
  250. else
  251. {
  252. WarBrojanje1++;
  253. new str[256];
  254. format(str,256," (War) Igrac %s je ubio %s", ime, igrac);
  255. SendWarMessage(COLOR_LR, str);
  256. }
  257. }
  258. if(WarTim[killerid] == 2)
  259. {
  260. if(WarTim[playerid] == 2)
  261. {
  262. WarBrojanje1++;
  263. SendClientMessage(playerid, COLOR_RED, "*Protivnici su dobili bod jer ste TKali!");
  264. }
  265. else
  266. {
  267. WarBrojanje2++;
  268. new str[256];
  269. format(str,256," (War) Igrac %s je ubio %s", ime, igrac);
  270. SendWarMessage(COLOR_LR, str);
  271. }
  272. }
  273. }
  274. return 1;
  275. }
  276.  
  277. public OnVehicleSpawn(vehicleid)
  278. {
  279. return 1;
  280. }
  281.  
  282. public OnVehicleDeath(vehicleid, killerid)
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnPlayerText(playerid, text[])
  288. {
  289. return 1;
  290. }
  291.  
  292. /*public OnPlayerCommandText(playerid, cmdtext[])
  293. {
  294. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  295. {
  296. // Do something here
  297. return 1;
  298. }
  299. return 0;
  300. }*/
  301.  
  302. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  303. {
  304. return 1;
  305. }
  306.  
  307. public OnPlayerExitVehicle(playerid, vehicleid)
  308. {
  309. return 1;
  310. }
  311.  
  312. public OnPlayerStateChange(playerid, newstate, oldstate)
  313. {
  314. return 1;
  315. }
  316.  
  317. public OnPlayerEnterCheckpoint(playerid)
  318. {
  319. return 1;
  320. }
  321.  
  322. public OnPlayerLeaveCheckpoint(playerid)
  323. {
  324. return 1;
  325. }
  326.  
  327. public OnPlayerEnterRaceCheckpoint(playerid)
  328. {
  329. return 1;
  330. }
  331.  
  332. public OnPlayerLeaveRaceCheckpoint(playerid)
  333. {
  334. return 1;
  335. }
  336.  
  337. public OnRconCommand(cmd[])
  338. {
  339. return 1;
  340. }
  341.  
  342. public OnPlayerRequestSpawn(playerid)
  343. {
  344. return 1;
  345. }
  346.  
  347. public OnObjectMoved(objectid)
  348. {
  349. return 1;
  350. }
  351.  
  352. public OnPlayerObjectMoved(playerid, objectid)
  353. {
  354. return 1;
  355. }
  356.  
  357. public OnPlayerPickUpPickup(playerid, pickupid)
  358. {
  359. return 1;
  360. }
  361.  
  362. public OnVehicleMod(playerid, vehicleid, componentid)
  363. {
  364. return 1;
  365. }
  366.  
  367. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  368. {
  369. return 1;
  370. }
  371.  
  372. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  373. {
  374. return 1;
  375. }
  376.  
  377. public OnPlayerSelectedMenuRow(playerid, row)
  378. {
  379. return 1;
  380. }
  381.  
  382. public OnPlayerExitedMenu(playerid)
  383. {
  384. return 1;
  385. }
  386.  
  387. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  388. {
  389. return 1;
  390. }
  391.  
  392. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  393. {
  394. return 1;
  395. }
  396.  
  397. public OnRconLoginAttempt(ip[], password[], success)
  398. {
  399. return 1;
  400. }
  401.  
  402. public OnPlayerUpdate(playerid)
  403. {
  404. return 1;
  405. }
  406.  
  407. public OnPlayerStreamIn(playerid, forplayerid)
  408. {
  409. return 1;
  410. }
  411.  
  412. public OnPlayerStreamOut(playerid, forplayerid)
  413. {
  414. return 1;
  415. }
  416.  
  417. public OnVehicleStreamIn(vehicleid, forplayerid)
  418. {
  419. return 1;
  420. }
  421.  
  422. public OnVehicleStreamOut(vehicleid, forplayerid)
  423. {
  424. return 1;
  425. }
  426.  
  427. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  428. {
  429. return 1;
  430. }
  431.  
  432. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  433. {
  434. return 1;
  435. }
  436. public SafeGivePlayerWeapon(plyid, weaponid, ammo)
  437. {
  438. /* new curHour, curMinute, curSecond;
  439. gettime(curHour, curMinute, curSecond);
  440. ScriptWeaponsUpdated[plyid] = curSecond;*/
  441. GivePlayerWeapon(plyid, weaponid, ammo);
  442. //UpdateWeaponSlots(plyid);
  443. return 1;
  444. }
  445.  
  446. // ================== < [ CREDITS DOCK ] > ================== //
Advertisement
Add Comment
Please, Sign In to add comment