HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <cstrike>
  5. #include <fun>
  6.  
  7. #define IsPlayer(%1) ( 1 <= %1 <= g_maxplayers )
  8.  
  9. // ColorChat
  10. enum Color
  11. {
  12. NORMAL = 1,
  13. GREEN, // zold
  14. TEAM_COLOR, // Piros, Kek, Szurke
  15. GREY, // Szurke
  16. RED, // Piros
  17. BLUE, // Kek
  18. }
  19.  
  20. new TeamName[][] =
  21. {
  22. "",
  23. "TERRORIST",
  24. "CT",
  25. "SPECTATOR"
  26. }
  27.  
  28. new sPrefix[] = "[.:Deagle Kor:.]" ;
  29.  
  30. new g_maxplayers;
  31. new SysTime;
  32. new bool:deagleround = false;
  33. new Trie:g_tBuyCommands;
  34.  
  35. public plugin_init( )
  36. {
  37. register_plugin( "Deagle Fordulo", "1.0", "Yousef" );
  38.  
  39. register_clcmd( "deagle_round", "DRound", ADMIN_BAN, "Deagle kör indítása." ); // active deagle round
  40.  
  41. register_cvar( "deagle_wait", "20" );
  42. register_cvar( "deagle_ammo", "10" );
  43.  
  44. new const szBuyCommands[ ][ ] =
  45. {
  46. "usp", "glock", "deagle", "p228", "elites", //letiltja ezeket a fegyokat nem lehet felvenni., meg a parancsokat is letiltja.
  47. "fn57", "m3", "xm1014", "mp5", "tmp", "p90",
  48. "mac10", "ump45", "ak47", "galil", "famas",
  49. "sg552", "m4a1", "aug", "scout", "awp", "g3sg1",
  50. "sg550", "m249", "vest", "vesthelm", "flash",
  51. "hegren", "sgren", "defuser", "nvgs", "shield",
  52. "primammo", "secammo", "km45", "9x19mm", "nighthawk",
  53. "228compact", "fiveseven", "12gauge", "autoshotgun",
  54. "mp", "c90", "cv47", "defender", "clarion", "krieg552",
  55. "bullpup", "magnum", "d3au1", "krieg550",
  56. "buy", "buyammo1", "buyammo2", "buyequip", "cl_autobuy",
  57. "cl_rebuy", "cl_setautobuy", "cl_setrebuy", "jointeam", "drop"
  58. }
  59.  
  60. g_tBuyCommands = TrieCreate( );
  61. for( new i = 0; i < sizeof( szBuyCommands ); i++ )
  62. {
  63. TrieSetCell( g_tBuyCommands, szBuyCommands[ i ], i );
  64. }
  65.  
  66. register_logevent( "RoundStart", 2, "1=Round_Start" );
  67. register_logevent( "RoundEnd", 2, "1=Round_End" );
  68.  
  69. register_touch("weaponbox", "player", "fw_BlockWeaponPickUp");
  70. register_touch("armoury_entity", "player", "fw_BlockWeaponPickUp");
  71. register_touch("weapon_shield", "player", "fw_BlockWeaponPickUp");
  72.  
  73. g_maxplayers = get_maxplayers();
  74. }
  75.  
  76. public RoundStart( )
  77. {
  78. SysTime = get_systime();
  79. }
  80.  
  81. public plugin_end( )
  82. {
  83. TrieDestroy( g_tBuyCommands );
  84. }
  85.  
  86. public DRound( id, level, cid )
  87. {
  88. if( !cmd_access( id, level, cid, 1 ) )
  89. return PLUGIN_HANDLED;
  90.  
  91. if( deagleround == true )
  92. {
  93. console_print( id, "Deagle fordulóban már aktiválva ebben a körben" );
  94. return PLUGIN_HANDLED;
  95. }
  96.  
  97. new deaglewait = get_cvar_num( "deagle_wait" );
  98. if( get_systime() - SysTime > deaglewait )
  99. {
  100. console_print( id, "Nem tudja aktiválni a Deagle fordulóban, mert már játszott ebben a körben %d másodpercet", deaglewait );
  101. return PLUGIN_HANDLED;
  102. }
  103.  
  104. deagleround = true;
  105. new iPlayers[32], iNum, Players;
  106. get_players( iPlayers, iNum, "ach" );
  107.  
  108. for( new i = 0 ; i < iNum ; i++ )
  109. {
  110. Players = iPlayers[i];
  111. strip_user_weapons( Players );
  112.  
  113. give_item( Players, "weapon_knife" );
  114. give_item( Players, "weapon_deagle" );
  115.  
  116. new deagleammo = get_cvar_num( "deagle_ammo" )
  117.  
  118. if( deagleammo <= 0 )
  119. {
  120. cs_set_weapon_ammo( find_ent_by_owner( 1, "weapon_deagle", Players ), 0 );
  121. }
  122. else
  123. {
  124. cs_set_weapon_ammo( find_ent_by_owner( 1, "weapon_deagle", Players ), deagleammo );
  125. }
  126. }
  127.  
  128. new AdminName[32];
  129. get_user_name( id, AdminName, charsmax( AdminName ) );
  130.  
  131. ColorChat( 0, RED, "^4%s ^3 Az Admin ^4%s ^3Indított egy Deagle fordulót!!.", sPrefix, AdminName );
  132. ColorChat( 0, RED, "^4%s ^3 Az Admin ^4%s ^3Indított egy Deagle fordulót!!.", sPrefix, AdminName );
  133. ColorChat( 0, RED, "^4%s ^3 Az Admin ^4%s ^3Indított egy Deagle fordulót!!.", sPrefix, AdminName );
  134. return PLUGIN_HANDLED;
  135. }
  136.  
  137.  
  138. public fw_BlockWeaponPickUp(iTouched, iToucher)
  139. {
  140. if( deagleround )
  141. {
  142. if( IsPlayer( iToucher ) )
  143. return PLUGIN_HANDLED;
  144. }
  145.  
  146. return PLUGIN_CONTINUE
  147. }
  148.  
  149. public RoundEnd( )
  150. {
  151. deagleround = false;
  152. }
  153.  
  154. public client_kill( id )
  155. {
  156. if( deagleround == true )
  157. {
  158. console_print( id, "Ön Nem tudja használni a kill parancsot deagle forduló-ban!!!" );
  159. console_print( id, "Ön Nem tudja használni a kill parancsot deagle forduló-ban!!!" );
  160. console_print( id, "Ön Nem tudja használni a kill parancsot deagle forduló-ban!!!" );
  161. return PLUGIN_HANDLED;
  162. }
  163.  
  164. return PLUGIN_CONTINUE;
  165. }
  166.  
  167.  
  168. public client_command( client )
  169. {
  170. if( deagleround )
  171. {
  172. if( !is_user_alive( client ) )
  173. {
  174. return PLUGIN_CONTINUE;
  175. }
  176.  
  177. static szArg[ 15 ];
  178.  
  179. if( read_argv( 0, szArg, 14 ) > 13 )
  180. {
  181. return PLUGIN_CONTINUE;
  182. }
  183.  
  184. strtolower( szArg );
  185. if( TrieKeyExists( g_tBuyCommands, szArg ) )
  186. {
  187. return PLUGIN_HANDLED
  188. }
  189. }
  190.  
  191. return PLUGIN_CONTINUE;
  192. }
  193.  
  194. // ColorChat
  195. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  196. {
  197. if( !get_playersnum() ) return;
  198.  
  199. new message[256];
  200.  
  201. switch(type)
  202. {
  203. case NORMAL:
  204. {
  205. message[0] = 0x01;
  206. }
  207. case GREEN: // zold
  208. {
  209. message[0] = 0x04;
  210. }
  211. default: // feher, piros, kek
  212. {
  213. message[0] = 0x03;
  214. }
  215. }
  216.  
  217. vformat(message[1], 251, msg, 4);
  218.  
  219. message[192] = '^0';
  220.  
  221. new team, ColorChange, index, MSG_Type;
  222.  
  223. if(id)
  224. {
  225. MSG_Type = MSG_ONE;
  226. index = id;
  227. } else {
  228. index = FindPlayer();
  229. MSG_Type = MSG_ALL;
  230. }
  231.  
  232. team = get_user_team(index);
  233. ColorChange = ColorSelection(index, MSG_Type, type);
  234.  
  235. ShowColorMessage(index, MSG_Type, message);
  236.  
  237. if(ColorChange)
  238. {
  239. Team_Info(index, MSG_Type, TeamName[team]);
  240. }
  241. }
  242.  
  243. ShowColorMessage(id, type, message[])
  244. {
  245. static bool:saytext_used;
  246. static get_user_msgid_saytext;
  247. if(!saytext_used)
  248. {
  249. get_user_msgid_saytext = get_user_msgid("SayText");
  250. saytext_used = true;
  251. }
  252. message_begin(type, get_user_msgid_saytext, _, id);
  253. write_byte(id)
  254. write_string(message);
  255. message_end();
  256. }
  257.  
  258. Team_Info(id, type, team[])
  259. {
  260. static bool:teaminfo_used;
  261. static get_user_msgid_teaminfo;
  262. if(!teaminfo_used)
  263. {
  264. get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
  265. teaminfo_used = true;
  266. }
  267. message_begin(type, get_user_msgid_teaminfo, _, id);
  268. write_byte(id);
  269. write_string(team);
  270. message_end();
  271.  
  272. return 1;
  273. }
  274.  
  275. ColorSelection(index, type, Color:Type)
  276. {
  277. switch(Type)
  278. {
  279. case RED:
  280. {
  281. return Team_Info(index, type, TeamName[1]);
  282. }
  283. case BLUE:
  284. {
  285. return Team_Info(index, type, TeamName[2]);
  286. }
  287. case GREY:
  288. {
  289. return Team_Info(index, type, TeamName[0]);
  290. }
  291. }
  292.  
  293. return 0;
  294. }
  295.  
  296. FindPlayer()
  297. {
  298. new i = -1;
  299.  
  300. while(i <= get_maxplayers())
  301. {
  302. if(is_user_connected(++i))
  303. return i;
  304. }
  305.  
  306. return -1;
  307. }
  308. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  309. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  310. */
  311.