HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /****************************************************
  2.  * AMX Mod X Script for Counter-Strike 1.6 *
  3.  * by "SilverTide" *
  4.  * Knives Only *
  5.  * Version 0.1a *
  6.  * Email = miketomasello@gmail.com *
  7.  * http://warcraft3server.com *
  8.  * *
  9.  * Credits: *
  10.  * Billythekid - I had to use his knifes only *
  11.  * plugin as a reference. *
  12.  * *
  13.  * Admin Commands - *
  14.  * amx_knivesonly <1|0> (Default: 0) *
  15.  * [ Enables or Disables knives only mode ] *
  16.  * *
  17.  * Client Commands- *
  18.  * say /voteknivesonly *
  19.  * [ Starts a vote for knives only mode ] *
  20.  * *
  21.  * *
  22.  * PLUGIN DESCRIPTION : ----------------- *
  23.  * Users will be forced to use knives *
  24.  * only, any other weapons will be *
  25.  * removed. *
  26.  * *
  27.  ****************************************************/
  28.  
  29. #include <amxmodx>
  30. #include <amxmisc>
  31. #include <fun>
  32.  
  33. new knifeonly = 0;
  34. new choice[2];
  35. new voteknivesonly[] = "\yCsak ke's?\w^n^n1. Igen^n2. Nem";
  36.  
  37. public plugin_init () {
  38. register_plugin("Knives Only", "0.1a", "SilverTide");
  39. register_concmd ( "amx_knivesonly", "cmdknives_only", ADMIN_LEVEL_A, "- Be/Kikapcsolja a csak ke's mo'dot." );
  40. register_concmd ( "amx_voteknivesonly", "cmdvoteknives_only", ADMIN_VOTE, "- Csak ke's szavaza's indita'sa(Admin)." );
  41. register_concmd ( "say /voteknivesonly", "cmdvote", ADMIN_VOTE, "- Csak ke's szavaza's indita'sa." );
  42. register_menucmd ( register_menuid("\yKnives Only?"), (1<<0)|(1<<1), "count_votes" );
  43. register_event ( "CurWeapon", "knife", "b" );
  44. }
  45.  
  46. public cmdknives_only ( id ) {
  47. new arg[2];
  48. read_argv ( 1, arg, 1 );
  49. set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
  50.  
  51. if ( equal ( arg, "1" ) ) {
  52. knifeonly = 1;
  53. client_cmd ( id, "weapon_knife" );
  54. console_print ( id, "Csak ke's mo'd kikapcsolva" );
  55. show_hudmessage ( 0, "Csak ke's mo'd bekapcsolva." );
  56. } else if ( equal ( arg, "0" ) ) {
  57. knifeonly = 0
  58. console_print ( id, "Csak ke's mo'd ki van kapcsolva" );
  59. show_hudmessage ( 0, "Csak ke's mo'd ki van kapcsolva" );
  60. } else {
  61. if ( knifeonly == 0 ){
  62. console_print ( id, "Haszna'lat: amx_knivesonly 1 = Be 0 = Ki Jelenleg: Ki" );
  63. }
  64. if ( knifeonly == 1 ){
  65. console_print ( id, "Haszna'lat: amx_knivesonly 1 = Be 0 = Ki Jelenleg: Be" );
  66. }
  67. }
  68.  
  69. return PLUGIN_CONTINUE;
  70. }
  71.  
  72. public knife ( id ) {
  73. if ( knifeonly == 0 ) {
  74. // Do Nothing;
  75. }
  76. if ( knifeonly == 1 ) {
  77. new clip, ammo;
  78. new usersweapon = get_user_weapon ( id, clip, ammo );
  79.  
  80. if ( usersweapon == CSW_KNIFE ) {
  81. // Do Nothing
  82. } else {
  83. // Bury player and strip of weapons, then return to starting position
  84. new origin[3];
  85. get_user_origin ( id, origin );
  86. origin[2] -= 500;
  87. set_user_origin ( id, origin );
  88. new iwpn, iwpns[32], nwpn[32];
  89. get_user_weapons ( id, iwpns, iwpn );
  90. for ( new a = 0; a < iwpn; ++a ) {
  91. get_weaponname ( iwpns[a], nwpn, 31 );
  92. engclient_cmd ( id, "drop", nwpn );
  93. }
  94. new origin2[3];
  95. get_user_origin ( id, origin2 );
  96. origin2[2] += 500;
  97. set_user_origin ( id, origin2 );
  98. // Select the knife
  99. client_cmd ( id, "weapon_knife" );
  100. }
  101. }
  102. return PLUGIN_CONTINUE;
  103. }
  104.  
  105. public cmdvote ( id ) {
  106. new Float:voting = get_cvar_float ( "amx_last_voting" );
  107. if ( voting > get_gametime () ) {
  108. client_print ( id, print_chat, "*Jelenleg fut a szavaza's.*" );
  109. return PLUGIN_HANDLED;
  110. }
  111. if ( voting && voting + get_cvar_float ( "amx_vote_delay" ) > get_gametime() ) {
  112. client_print ( id, print_chat, "*Va'rj egy kicsit, miel'o'tt u'jra szavazna'l.*" );
  113. return PLUGIN_HANDLED;
  114. }
  115. new menu_msg[256];
  116. new name[32];
  117. format ( menu_msg, 255, voteknivesonly );
  118. new Float:votetime = get_cvar_float("amx_vote_time") + 10.0;
  119. get_user_info ( id, "name", name, 31 );
  120. set_cvar_float ( "amx_last_voting", get_gametime() + votetime );
  121. show_menu ( 0, (1<<0)|(1<<1), menu_msg, floatround ( votetime ) );
  122. set_hudmessage ( 200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 2 );
  123.  
  124. show_hudmessage ( 0, "%s elinditotta a csak kes modot", name );
  125. set_task ( votetime, "check_the_votes" );
  126. choice[0] = choice[1] = 0;
  127. return PLUGIN_HANDLED;
  128. }
  129.  
  130. public cmdvoteknives_only ( id ) {
  131. new Float:voting = get_cvar_float ( "amx_last_voting" );
  132. if ( voting > get_gametime () ) {
  133. client_print ( id, print_chat, "*A szavaza's ma'r fut.*" );
  134. return PLUGIN_HANDLED;
  135. }
  136. if ( voting && voting + get_cvar_float( "amx_vote_delay" ) > get_gametime () ) {
  137. client_print ( id, print_chat, "*Va'rj egy kicsit, miel'o'tt u'jra szavazna'l.*" );
  138. return PLUGIN_HANDLED;
  139. }
  140. new menu_msg[256];
  141. format ( menu_msg, 255, voteknivesonly );
  142. new Float:votetime = get_cvar_float ( "amx_vote_time" ) + 10.0;
  143. set_cvar_float ( "amx_last_voting", get_gametime() + votetime );
  144. show_menu ( 0, (1<<0)|(1<<1), menu_msg, floatround ( votetime ) );
  145. set_task ( votetime, "check_the_votes" );
  146. client_print ( 0, print_chat, "*A szavaza's elindult.*" );
  147. choice[0] = choice[1] = 0;
  148. return PLUGIN_HANDLED;
  149. }
  150.  
  151. public count_votes ( id, key ) {
  152. if ( get_cvar_float ( "amx_vote_answers" ) ) {
  153. new name[32];
  154. get_user_name ( id, name, 31 );
  155. client_print ( 0, print_chat, "* %s a(z) %s opcio'ra szavazott", name, key ? "csak kes" : "a csak kesre" );
  156. }
  157. ++choice[key];
  158. return PLUGIN_HANDLED;
  159. }
  160.  
  161. public check_the_votes ( id ) {
  162. if ( choice[0] > choice[1] ) {
  163. server_cmd ( "amx_knivesonly 1" );
  164. client_print ( 0, print_chat, "* A csak ke's mo'd megszavazva. (On ^"%d^") (Off ^"%d^"). *", choice[0], choice[1] );
  165. } else {
  166. server_cmd ( "amx_knivesonly 0" );
  167. client_print ( 0, print_chat, "* A csak ke's mo'd elutasitva. (On ^"%d^") (Off ^"%d^"). *", choice[0], choice[1] );
  168. }
  169. return PLUGIN_CONTINUE;
  170. }