HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1.  
  2. #include <amxmodx>
  3. #include <fun>
  4. #include <fakemeta>
  5.  
  6. #define PLUGIN_NAME "Surf Ski 2 Admin Menu"
  7. #define PLUGIN_VERSION "1.3c"
  8. #define PLUGIN_AUTHOR "tuty"
  9.  
  10. #define ACCESS_CMD ADMIN_SLAY
  11. #define TELEPORT_SOUND "common/bodydrop2.wav"
  12. #define _LOG_TO_AMXX 1 // put 0 to disable the log
  13. #define VOL_ZERODOTSEVEN 0.7
  14.  
  15. static const CT_4SpawnOrigins[][ 3 ] =
  16. {
  17. { -214, 3715, 41 },
  18. { -448, 3714, 41 },
  19. { -223, 3311, 41 },
  20. { -448, 3308, 41 }
  21. };
  22.  
  23. static const T_4SpawnOrigins[][ 3 ] =
  24. {
  25. { -778, 3705, 41 },
  26. { -554, 3722, 41 },
  27. { -778, 3288, 41 },
  28. { -570, 3347, 41 }
  29. };
  30.  
  31. static const Scout_Place[][ 3 ] =
  32. {
  33. { -317, 943, -1161 },
  34. { -672, 933, -1161 }
  35. };
  36.  
  37. static const Gun_Room[][ 3 ] =
  38. {
  39. { -689, -949, -138 },
  40. { -590, -958, -138 },
  41. { -485, -947, -138 },
  42. { -396, -961, -138 },
  43. { -324, -960, -138 },
  44. { -688, -840, -138 },
  45. { -594, -844, -138 },
  46. { -486, -866, -138 },
  47. { -398, -852, -138 },
  48. { -331, -845, -138 },
  49. { -383, -697, -138 },
  50. { -317, -683, -138 }
  51. };
  52.  
  53. static const Mario_Room[][ 3 ] =
  54. {
  55. { 3610, 1053, -2317 },
  56. { 3612, 629, -2317 },
  57. { 3403, 1079, -2273 },
  58. { 3081, 1091, -2317 },
  59. { 3391, 641, -2317 },
  60. { 3056, 578, -2317 },
  61. { 3116, 285, -2275 },
  62. { 3343, 245, -2317 }
  63. };
  64.  
  65. static const Awp_Place[][ 3 ] =
  66. {
  67. { 1795, -1070, -159 },
  68. { 1544, -1075, -159 },
  69. { 1304, -1072, -159 }
  70. };
  71.  
  72. new gSelectedPlayer[ 33 ];
  73. new gEnabled;
  74. new szFormatEx[ 40 ];
  75.  
  76. public plugin_init()
  77. {
  78. register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
  79. gEnabled = register_cvar( "surfski2_adminmenu", "1" );// enable / disable the plugin
  80.  
  81. new map[ 32 ];
  82. get_mapname( map, charsmax( map ) );
  83.  
  84. if( equal( map, "surf_ski_2" ) )
  85. {
  86. register_clcmd( "say /surfski2menu", "openMenuSurf" );
  87. register_clcmd( "say surfski2menu", "openMenuSurf" );
  88. register_clcmd( "say_team /surfski2menu", "openMenuSurf" );
  89. register_clcmd( "say_team surfski2menu", "openMenuSurf" );
  90. }
  91.  
  92. register_dictionary( "surfski2_adminmenu.txt" );
  93. }
  94.  
  95.  
  96. public plugin_precache()
  97. {
  98. precache_sound( TELEPORT_SOUND );
  99. }
  100.  
  101.  
  102. public openMenuSurf( id )
  103. {
  104. if( get_pcvar_num( gEnabled ) != 1 )
  105. {
  106. client_print( id, print_chat, "[SurfSki2] %L", id, "SURFSKI2_DISABLED" );
  107. return PLUGIN_CONTINUE;
  108. }
  109.  
  110. if( !(get_user_flags( id ) & ACCESS_CMD ) )
  111. {
  112. client_print( id, print_chat, "[SurfSki2] %L", id, "SURFSKI2_RESTRICTED" );
  113. return PLUGIN_CONTINUE;
  114. }
  115.  
  116. formatex( szFormatEx, charsmax( szFormatEx ), "\r%L", id, "SURFSKI2_SELECT" );
  117. new menu = menu_create( szFormatEx, "menu_handler" );
  118.  
  119. new players[ 32 ], idString[ 3 ], name[ 32 ], num, pid, i;
  120. get_players( players, num );
  121.  
  122. for( i = 0; i < num; i++ )
  123. {
  124. pid = players[ i ];
  125. num_to_str( pid, idString, charsmax( idString ) );
  126. get_user_name( pid, name, charsmax( name ) );
  127.  
  128. menu_additem( menu, name, idString );
  129. }
  130.  
  131. menu_display( id, menu );
  132.  
  133. return PLUGIN_CONTINUE;
  134. }
  135.  
  136.  
  137. public menu_handler( id, menu, item )
  138. {
  139. if( item >= 0 )
  140. {
  141. new access, callback, idString[ 3 ];
  142. menu_item_getinfo( menu, item, access, idString, charsmax( idString ), _, _, callback );
  143. new pid = str_to_num( idString );
  144.  
  145. if( is_user_alive( pid ) )
  146. {
  147. gSelectedPlayer[ id ] = pid;
  148. DoCommand( id );
  149. }
  150. }
  151.  
  152. menu_destroy( menu );
  153.  
  154. return PLUGIN_HANDLED;
  155. }
  156.  
  157.  
  158. public DoCommand( id )
  159. {
  160. formatex( szFormatEx, charsmax( szFormatEx ), "\r%L", id, "SURFSKI2_MOVETO" );
  161. new menu = menu_create( szFormatEx, "location_menu" );
  162.  
  163. formatex( szFormatEx, charsmax( szFormatEx ), "\d%L", id, "SURFSKI2_GUNROOM" );
  164. menu_additem( menu, szFormatEx, "0" );
  165.  
  166. formatex( szFormatEx, charsmax( szFormatEx ), "\d%L", id, "SURFSKI2_SCOUTPLACE" );
  167. menu_additem( menu, szFormatEx, "1" );
  168.  
  169. formatex( szFormatEx, charsmax( szFormatEx ), "\d%L", id, "SURFSKI2_MARIOROOM" );
  170. menu_additem( menu, szFormatEx, "2" );
  171.  
  172. formatex( szFormatEx, charsmax( szFormatEx ), "\d%L", id, "SURFSKI2_AWPPLACE" );
  173. menu_additem( menu, szFormatEx, "3" );
  174.  
  175. formatex( szFormatEx, charsmax( szFormatEx ), "\d%L", id, "SURFSKI2_CTSPAWN" );
  176. menu_additem( menu, szFormatEx, "4" );
  177.  
  178. formatex( szFormatEx, charsmax( szFormatEx ), "\d%L", id, "SURFSKI2_TSPAWN" );
  179. menu_additem( menu, szFormatEx, "5" );
  180. menu_display( id, menu );
  181. }
  182.  
  183.  
  184. public location_menu( id, menu, item )
  185. {
  186. if( item >= 0 )
  187. {
  188. new access, callback, actionString[ 2 ];
  189. menu_item_getinfo( menu, item, access, actionString, charsmax( actionString ), _, _, callback );
  190.  
  191. new action = str_to_num( actionString );
  192. new pid = gSelectedPlayer[ id ];
  193.  
  194. new Aname[ 32 ], Tname[ 32 ];
  195. get_user_name( id, Aname, charsmax( Aname ) );
  196. get_user_name( pid, Tname, charsmax( Tname ) );
  197.  
  198. if( is_user_alive( pid ) )
  199. {
  200. switch( action )
  201. {
  202. case 0:
  203. {
  204. set_user_origin( pid, Gun_Room[ random_num( 0, charsmax( Gun_Room ) ) ] );
  205. }
  206.  
  207. case 1:
  208. {
  209. set_user_origin( pid, Scout_Place[ random_num( 0, charsmax( Scout_Place ) ) ] );
  210. }
  211.  
  212. case 2:
  213. {
  214. set_user_origin( pid, Mario_Room[ random_num( 0, charsmax( Mario_Room ) ) ] );
  215. }
  216.  
  217. case 3:
  218. {
  219. set_user_origin( pid, Awp_Place[ random_num( 0, charsmax( Awp_Place ) ) ] );
  220. }
  221.  
  222. case 4:
  223. {
  224. set_user_origin( pid, CT_4SpawnOrigins[ random_num( 0, charsmax( CT_4SpawnOrigins ) ) ] );
  225. }
  226.  
  227. case 5:
  228. {
  229. set_user_origin( pid, T_4SpawnOrigins[ random_num( 0, charsmax( T_4SpawnOrigins ) ) ] );
  230. }
  231. }
  232.  
  233. emit_sound( pid, CHAN_STATIC, TELEPORT_SOUND, VOL_ZERODOTSEVEN, ATTN_NORM, 0, PITCH_NORM );
  234. teleport_effect( pid );
  235. }
  236.  
  237. client_print( 0, print_chat, "%L", LANG_PLAYER, "SURFSKI2_ACTIVITY", Aname, Tname );
  238.  
  239. set_hudmessage( 255, 170, 42, -1.0, 0.79, 2, 6.0, 5.0 );
  240. show_hudmessage( pid, "%L", pid, "SURFSKI2_TELEPORTED" );
  241.  
  242. #if defined _LOG_TO_AMXX == 1
  243. log_amx( "%L", LANG_SERVER, "SURFSKI2_LOGAMX", Aname, Tname );
  244. #endif
  245. }
  246.  
  247. menu_destroy( menu );
  248.  
  249. return PLUGIN_HANDLED;
  250. }
  251.  
  252.  
  253. stock teleport_effect( index )
  254. {
  255. new Velocity[ 3 ];
  256. set_pev( index, pev_velocity, Velocity );
  257.  
  258. new iOrigin[ 3 ];
  259. get_user_origin( index, iOrigin, 0 );
  260.  
  261. message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin );
  262. write_byte( TE_TELEPORT );
  263. write_coord( iOrigin[ 0 ] );
  264. write_coord( iOrigin[ 1 ] );
  265. write_coord( iOrigin[ 2 ] );
  266. message_end();
  267.  
  268. message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin );
  269. write_byte( TE_TAREXPLOSION );
  270. write_coord( iOrigin[ 0 ] );
  271. write_coord( iOrigin[ 1 ] );
  272. write_coord( iOrigin[ 2 ] );
  273. message_end();
  274. }
  275.