Advertisement
Froki

Untitled

Nov 27th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <dhudmessage>
  6. #include <hamsandwich>
  7. #include <colorchat>
  8. #include <fun>
  9. #include <cstrike>
  10. #include <engine>
  11. #include <fakemeta>
  12.  
  13. #define PLUGIN "Heavy Team Turnir"
  14. #define VERSION "1.0"
  15. #define AUTHOR "Fr0zen"
  16.  
  17.  
  18.  
  19. #define OFFSET_CLIPAMMO 51
  20. #define OFFSET_LINUX_WEAPONS 4
  21. #define fm_cs_set_weapon_ammo(%1,%2) set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)
  22.  
  23. // players offsets
  24. #define m_pActiveItem 373
  25.  
  26. new bool:pokrenutturnir;
  27. new PokretanjeTurnira[ 33 ];
  28. const iCountTime = 30;
  29.  
  30. new g_iCountdownEntity;
  31. new g_iCounter;
  32. const NOCLIP_WPN_BS = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4));
  33.  
  34. new const g_MaxClipAmmo[] =
  35. {
  36. 0,
  37. 13, //CSW_P228
  38. 0,
  39. 10, //CSW_SCOUT
  40. 0, //CSW_HEGRENADE
  41. 7, //CSW_XM1014
  42. 0, //CSW_C4
  43. 30,//CSW_MAC10
  44. 30, //CSW_AUG
  45. 0, //CSW_SMOKEGRENADE
  46. 15,//CSW_ELITE
  47. 20,//CSW_FIVESEVEN
  48. 25,//CSW_UMP45
  49. 30, //CSW_SG550
  50. 35, //CSW_GALIL
  51. 25, //CSW_FAMAS
  52. 12,//CSW_USP
  53. 20,//CSW_GLOCK18
  54. 10, //CSW_AWP
  55. 30,//CSW_MP5NAVY
  56. 100,//CSW_M249
  57. 8, //CSW_M3
  58. 30, //CSW_M4A1
  59. 30,//CSW_TMP
  60. 20, //CSW_G3SG1
  61. 0, //CSW_FLASHBANG
  62. 7, //CSW_DEAGLE
  63. 30, //CSW_SG552
  64. 30, //CSW_AK47
  65. 0, //CSW_KNIFE
  66. 50//CSW_P90
  67. };
  68.  
  69.  
  70. public plugin_init() {
  71. register_plugin(PLUGIN, VERSION, AUTHOR)
  72.  
  73. register_clcmd("say /turnir", "Turnir");
  74. RegisterHam(Ham_Spawn, "player", "hamspawn", 1);
  75. set_task(1.0, "Obavjestenje", _, _, _, "b");
  76. }
  77.  
  78. public client_putinserver(id)
  79. {
  80. set_task(0.2, "PokretanjeTurniraProvera", id );
  81. register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=1" );
  82. }
  83.  
  84.  
  85. public Turnir(id)
  86. {
  87. if(PokretanjeTurnira[id]) {
  88. new menu = menu_create("\rDa li Zelis Pokrenuti Turnir?", "Turnir_Handle") ;
  89. menu_additem(menu, "\yDa ");
  90. menu_additem(menu, "\yNe");
  91. menu_display(id, menu);
  92. }
  93. else
  94. ColorChat(id, TEAM_COLOR, "^4[Turnir]^3 Nemas dozvolu za pokretanje turnira");
  95. }
  96.  
  97. public Turnir_Handle(id, iMenu, iItem)
  98. {
  99. switch(iItem)
  100. {
  101. case 0:
  102. {
  103. turnir2(id);
  104. }
  105. case 1:
  106. {
  107. menu_destroy(iMenu);
  108. }
  109. case MENU_EXIT:
  110. {
  111. menu_destroy(iMenu);
  112. return PLUGIN_HANDLED;
  113. }
  114. }
  115. return PLUGIN_CONTINUE;
  116. }
  117.  
  118. public turnir2(id)
  119. {
  120. if(pokrenutturnir) {
  121. ColorChat(id, TEAM_COLOR,"^4[Turnir]^3 Turnir je vec pokrenut");
  122. return PLUGIN_HANDLED;
  123. }
  124. set_task(1.0, "Event_CurWeapon", id);
  125. ColorChat(0, TEAM_COLOR, "^4[TURNIR]^3 Turnir je poceo, sretno svima :)");
  126. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  127. show_dhudmessage(0, "Turnir je poceo ,sretno svima :)");
  128. server_cmd("amx_cvar mp_timelimit 60")
  129. g_iCountdownEntity = create_entity( "info_target" );
  130. entity_set_string( g_iCountdownEntity , EV_SZ_classname , "countdown_entity" );
  131. register_think( "countdown_entity" , "fw_CountdownEntThink" );
  132. set_task(3570.0, "ShowCountdown", id); // ovde ide 3570.0
  133. set_task(900.0, "minuta45", id);
  134. set_task(1800.0, "minuta30", id);
  135. set_task(2700.0, "minuta15", id);
  136. set_task(3000.0, "minuta10", id);
  137. set_task(3300.0, "minuta5", id);
  138. set_task(3420.0, "minuta3", id);
  139. server_cmd("amx_cvar sv_restartround 1");
  140. pokrenutturnir = true;
  141. return PLUGIN_HANDLED;
  142. }
  143.  
  144.  
  145. public ShowCountdown()
  146. {
  147. g_iCounter = iCountTime;
  148. entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 1.0 );
  149. is_valid_ent(g_iCountdownEntity)
  150. is_valid_ent(g_iCounter)
  151. }
  152.  
  153. public fw_CountdownEntThink( iEntity )
  154. {
  155. if ( iEntity == g_iCountdownEntity )
  156. {
  157. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  158. show_dhudmessage( 0 , "[Turnir se zavrsava za : %d ]" , --g_iCounter );
  159.  
  160. if ( g_iCounter )
  161. entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 1.0 );
  162. else
  163. server_cmd( "amx_map de_inferno" );
  164. }
  165. }
  166.  
  167.  
  168. public PokretanjeTurniraProvera( id ) {
  169.  
  170. new SteamID[ 32 ];
  171. get_user_authid( id, SteamID, 31 );
  172.  
  173. new broj_linija = file_size( "addons/amxmodx/configs/t-admin.ini", 1 );
  174. new linija[ 256 ], broj;
  175.  
  176. for( new i = 0; i < broj_linija; i++ ) {
  177.  
  178. read_file( "addons/amxmodx/configs/t-admin.ini", i, linija, 255, broj );
  179. if( broj > 0 && containi( linija, SteamID ) != -1 )
  180. PokretanjeTurnira[ id ] = true;
  181. }
  182. return PLUGIN_CONTINUE;
  183. }
  184.  
  185. public hamspawn ( iPlayer ) {
  186. if(pokrenutturnir == true && is_user_alive( iPlayer ) ) {
  187. give_item( iPlayer, "weapon_hegrenade");
  188. give_item( iPlayer, "weapon_flashbang");
  189. give_item( iPlayer, "weapon_flashbang");
  190. give_item( iPlayer, "weapon_smokegrenade");
  191. }
  192. }
  193.  
  194. public minuta45 ()
  195. {
  196. ColorChat(0, TEAM_COLOR, "^x04[Turnir]^x03 Turnir se zavrsava za^4 45 minuta.");
  197. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  198. show_dhudmessage( 0 , "[Turnir se zavrsava za 45 minuta.]");
  199. }
  200.  
  201. public minuta30 ()
  202. {
  203. ColorChat(0, TEAM_COLOR, "^x04[Turnir]^x03 Turnir se zavrsava za^4 30 minuta.");
  204. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  205. show_dhudmessage( 0 , "[Turnir se zavrsava za 30 minuta.]");
  206. }
  207.  
  208. public minuta15 ()
  209. {
  210. ColorChat(0, TEAM_COLOR, "^x04[Turnir]^x03 Turnir se zavrsava za^4 15 minuta.");
  211. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  212. show_dhudmessage( 0 , "[Turnir se zavrsava za 15 minuta.]");
  213. }
  214.  
  215. public minuta10()
  216. {
  217. ColorChat(0, TEAM_COLOR, "^x04[Turnir]^x03 Turnir se zavrzava za^4 10 minuta.");
  218. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  219. show_dhudmessage(0, "[Turnir se zavrzava za 10 minuta.]")
  220. }
  221.  
  222.  
  223.  
  224. public minuta5 ()
  225. {
  226. ColorChat(0, TEAM_COLOR, "^x04[Turnir]^x03 Turnir se zavrsava za^4 5 minuta.");
  227. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  228. show_dhudmessage( 0 , "[Turnir se zavrsava za 5 minuta.]");
  229. }
  230.  
  231. public minuta3 ()
  232. {
  233. ColorChat(0, TEAM_COLOR, "^x04[Turnir]^x03 Turnir se zavrsava za^4 3 minuta.");
  234. set_dhudmessage( 0, 255, 255, -1.0, -1.0, 0, 6.0, 6.0 );
  235. show_dhudmessage( 0 , "[Turnir se zavrsava za 3 minuta.]");
  236. }
  237.  
  238.  
  239. public Obavjestenje() {
  240. if(pokrenutturnir == true) {
  241. set_dhudmessage(0, 255, 255, 0.81, 0.52, 0, 6.0, 12.0); // ovde ide -1,0
  242. show_dhudmessage(0, "[Turnir je u toku]^n[Turnir Plugin by Fr0zen]");
  243. }
  244. }
  245.  
  246. public Event_CurWeapon( id )
  247. {
  248. new iWeapon = read_data(2);
  249. if( !( NOCLIP_WPN_BS & (1<<iWeapon) ) && pokrenutturnir == true)
  250. fm_cs_set_weapon_ammo( get_pdata_cbase(id, m_pActiveItem) , g_MaxClipAmmo[ iWeapon ] );
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement