Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.29 KB | None | 0 0
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Hide N Seek Training by SkazzY *
  3. * *
  4. * Cvars: *
  5. * sv_checkpistols (default 1) *
  6. * sv_respawn (default 1) *
  7. * hns_checkpoints_gochecks (default 1) *
  8. * hns_semiclip_enabled (defualt 1) *
  9. * hns_weapon_menu_enabled (default 1) *
  10. * hns_all_weapons_enabled (default 1) *
  11. * hns_hookspeed (default 660) *
  12. * hns_hook_allowed (default 1) *
  13. * hns_training_enabled (default 1) *
  14. * *
  15. * Say Commands: *
  16. * /training (Opens training menu) *
  17. * /weapons (Opens weapon menu) *
  18. * /allweapons (Gives you all weapons) *
  19. * /checkpoint (Saves checkpoint) *
  20. * /cp (Saves checkpoint) *
  21. * /gocheck (Teleports you to your checkpoint) *
  22. * /gc (Teleports you to your checkpoint) *
  23. * /stuck (Use this if you are stuck) *
  24. * /respawn (Respawns you) *
  25. * *
  26. * CL Commands: *
  27. * checkpoint (Saves checkpoint) *
  28. * cp (Saves checkpoint) *
  29. * gocheck (Teleports you to your checkpoint) *
  30. * gc (Teleports you to your checkpoint) *
  31. * stuck (Use this if you are stuck) *
  32. * *
  33. * Thanks to: *
  34. * AssKicR because of his KZ Multiplugin *
  35. * Geesu because of his respawn forever plugin *
  36. * Thanks to xPaw for making semiclip *
  37. * *
  38. * Change List: *
  39. * Version 2.8: *
  40. * Made so you can place checkpoint while ducking *
  41. * Changed title in training menu *
  42. * *
  43. * Version 2.7: *
  44. * Changed game name to "HNS Training" *
  45. * *
  46. * Version 2.6: *
  47. * Added random color for hook *
  48. * Fixed so instructions doesn't show for all players *
  49. * Added some new cl commands *
  50. * *
  51. * Version 2.4: *
  52. * Added Hook (Thanks to xPaw) *
  53. * Made On/Off Message for godmode and noclip in menu *
  54. * Added Checkpoint and Gocheck counter (Shows in a hudmessage) *
  55. * Took back fun module again *
  56. * Added angle saver to checkpoint (Thanks to xPaw & Me) *
  57. * Added cvar to enable/disable hook *
  58. * *
  59. * Version 2.1: *
  60. * Removed fun module *
  61. * *
  62. * Version 2.0: *
  63. * Added Multilingual *
  64. * *
  65. * Version 1.9: *
  66. * Added on/off pcvars for checkpoints and gochecks, Semiclip, Weapon Menu and All Weapons *
  67. * *
  68. * Version 1.8: *
  69. * Added pcvars for all cvars *
  70. * Changed 11 to TE_TELEPORT thanks to Exolent and xPaw *
  71. * Changed spawn to hamsandwich thanks to Exolent *
  72. * *
  73. * Version 1.7: *
  74. * Fixed that this plugin blocked say commands thanks to xPaw and arkshine *
  75. * *
  76. * Version 1.6: *
  77. * Removed public CheckCheckpoint(id) because it didn't do anything, thanks to Yamikaitou for telling me *
  78. * *
  79. * Version 1.5: *
  80. * Got rid of engine module *
  81. * Fixed 2 warnings *
  82. * Fixed some stuff thanks to joaquimandrade *
  83. * *
  84. * Version 1.4: *
  85. * Added on/off cvar for the plugin *
  86. * *
  87. * Version 1.3: *
  88. * Removed modules: amxmisc, colorchat and cstrike *
  89. * *
  90. * Version 1.2: *
  91. * Fixed a message bug *
  92. * *
  93. * Version 1.1: *
  94. * Added Semiclip *
  95. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  96.  
  97. #include <amxmodx>
  98. #include <hamsandwich>
  99. #include <fakemeta>
  100. #include <fun>
  101.  
  102. #define PLUGIN "Training"
  103. #define VERSION "2.8"
  104. #define AUTHOR "SkazzY"
  105.  
  106. #define PREFIX "[Pros Only]"
  107.  
  108. #define DISABLE_CS 0
  109.  
  110. // Team ids
  111. #define UNASSIGNED 0
  112. #define TS 1
  113. #define CTS 2
  114. #define AUTO_TEAM 5
  115.  
  116. #define get_user_button(%1) pev(%1, pev_button)
  117.  
  118. #pragma semicolon 1;
  119.  
  120. new g_iSemiClip[33];
  121.  
  122. new bool:g_PistolsDisabled = false;
  123.  
  124. new gChecks[33];
  125. new gGoChecks[33];
  126. new bool:gCheckpoint[33];
  127. new gCheckpointPos[33][3];
  128. new Float:gCheckpointAngle[33][3];
  129. new gLastCheckpointPos[33][3];
  130. new Float:gLastCheckpointAngle[33][3];
  131.  
  132. new HnsTrainingOn;
  133. new CheckPistols;
  134. new Respawn;
  135.  
  136. new hnstrainingmenu;
  137.  
  138. new CheckpointsAndGoChecksOn;
  139. new SemiClipOn;
  140. new WeaponMenuOn;
  141. new AllWeaponsOn;
  142.  
  143. //Hook Stuff
  144. new bool:gHooked[33];
  145. new gHook[33];
  146. new gCvarHookSpeed;
  147. new gBeam;
  148. new gCvarHookAllowed;
  149.  
  150. public plugin_init() {
  151. register_plugin(PLUGIN, VERSION, AUTHOR);
  152.  
  153. register_dictionary("hns_training.txt");
  154.  
  155. register_clcmd("checkpoint","Checkpoint");
  156. register_clcmd("cp", "Checkpoint");
  157. register_clcmd("say /checkpoint","Checkpoint");
  158. register_clcmd("say_team /checkpoint", "Checkpoint");
  159. register_clcmd("say /cp", "Checkpoint");
  160. register_clcmd("say_team /cp", "Checkpoint");
  161.  
  162. register_clcmd("gocheck","GoCheckpoint");
  163. register_clcmd("gc", "GoCheckpoint");
  164. register_clcmd("say /gocheck","GoCheckpoint");
  165. register_clcmd("say_team /gocheck", "GoCheckpoint");
  166. register_clcmd("say /gc", "GoCheckpoint");
  167. register_clcmd("say_team /gc", "GoCheckpoint");
  168.  
  169. register_clcmd("stuck", "LastCheckpoint");
  170. register_clcmd("say /stuck", "LastCheckpoint");
  171. register_clcmd("say_team /stuck", "LastCheckpoint");
  172.  
  173. register_clcmd("say /weapons", "cmdWeapons");
  174. register_clcmd("say_team /weapons", "cmdWeapons");
  175.  
  176. register_clcmd("say /allweapons", "cmdAllWeapons");
  177. register_clcmd("say_team /allweapons", "cmdAllWeapons");
  178.  
  179. register_clcmd("say /training", "cmdTrainingMenu");
  180. register_clcmd("say_team /training", "cmdTrainingMenu");
  181.  
  182. register_event("DeathMsg", "on_Death", "a");
  183. register_clcmd("say_team /respawn","spawn_func");
  184. register_clcmd("say /respawn","spawn_func");
  185.  
  186. register_clcmd("+hook", "cmdHookOn");
  187. register_clcmd("-hook", "cmdHookOff");
  188.  
  189. register_forward( FM_StartFrame, "fwStartFrame", 0 );
  190. register_forward( FM_AddToFullPack, "fwFullPack", 1 );
  191. register_forward( FM_GetGameDescription, "fwdGameDesc" );
  192.  
  193. CheckPistols = register_cvar("sv_checkpistols", "1");
  194. Respawn = register_cvar("sv_respawn", "1");
  195. CheckpointsAndGoChecksOn = register_cvar("hns_checkpoints_gochecks", "1");
  196. SemiClipOn = register_cvar("hns_semiclip_enabled", "1");
  197. WeaponMenuOn = register_cvar("hns_weapon_menu_enabled", "1");
  198. AllWeaponsOn = register_cvar("hns_all_weapons_enabled", "1");
  199.  
  200. //Hook stuff
  201. gCvarHookSpeed = register_cvar( "hns_hookspeed", "660" );
  202. gCvarHookAllowed = register_cvar("hns_hook_allowed", "1");
  203.  
  204. RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
  205.  
  206. hnstrainingmenu = register_menuid("HNS Training Menu");
  207. register_menucmd(hnstrainingmenu, 1023, "handleTrainingMenu");
  208.  
  209. HnsTrainingOn = register_cvar("hns_training_enabled", "1");
  210. }
  211.  
  212. public plugin_precache() {
  213. gBeam = precache_model("sprites/zbeam4.spr");
  214. precache_model("models/rpgrocket.mdl");
  215. engfunc(EngFunc_PrecacheSound, "weapons/xbow_fire1.wav");
  216. }
  217.  
  218. public fwdGameDesc() {
  219. forward_return(FMV_STRING, "HNS Training");
  220. return FMRES_SUPERCEDE;
  221. }
  222.  
  223. public fwFullPack(es, e, ent, host, flags, player, pSet) {
  224. if( get_pcvar_num( HnsTrainingOn ) && get_pcvar_num( SemiClipOn ) ) {
  225. if(player && g_iSemiClip[ent] && g_iSemiClip[host]) {
  226. set_es(es, ES_Solid, SOLID_NOT);
  227. set_es(es, ES_RenderMode, kRenderTransAlpha);
  228. set_es(es, ES_RenderAmt, 100);
  229. }
  230. }
  231. return FMRES_IGNORED;
  232. }
  233.  
  234. public fwStartFrame() {
  235. if( get_pcvar_num( HnsTrainingOn ) && get_pcvar_num( SemiClipOn ) ) {
  236. static iPlayers[32], iNum, iPlayer, iPlayer2;
  237. get_players(iPlayers, iNum);
  238.  
  239. arrayset(g_iSemiClip, 0, sizeof(g_iSemiClip));
  240.  
  241. new iTeams[33] = {-1, ...};
  242. for(new i=0; i < iNum; i++) {
  243. iPlayer = iPlayers[i];
  244.  
  245. if( !is_user_alive(iPlayer) )
  246. continue;
  247.  
  248. for(new j=0; j < iNum; j++) {
  249. iPlayer2 = iPlayers[j];
  250.  
  251. if(iPlayer == iPlayer2 || !is_user_alive(iPlayer2))
  252. continue;
  253.  
  254. static Float:vOrigin1[3], Float:vOrigin2[3];
  255. pev(iPlayer, pev_origin, vOrigin1);
  256. pev(iPlayer2, pev_origin, vOrigin2);
  257.  
  258. if( vector_distance( vOrigin1, vOrigin2 ) < 96) {
  259. if(iTeams[iPlayer] == -1)
  260. iTeams[iPlayer] = get_user_team(iPlayer);
  261. if(iTeams[iPlayer2] == -1)
  262. iTeams[iPlayer2] = get_user_team(iPlayer2);
  263.  
  264. g_iSemiClip[iPlayer] = true;
  265. g_iSemiClip[iPlayer2] = true;
  266. }
  267. }
  268. }
  269.  
  270. for(new i=0; i < iNum;i++) {
  271. iPlayer = iPlayers[i];
  272.  
  273. if( is_user_alive(iPlayer) )
  274. set_pev(iPlayer, pev_solid, g_iSemiClip[iPlayer] ? SOLID_NOT : SOLID_SLIDEBOX);
  275. }
  276. }
  277. return FMRES_IGNORED;
  278. }
  279.  
  280. public check_pistols()
  281. {
  282. /* Determine if we should give players a pistol or not */
  283. if ( get_pcvar_num(HnsTrainingOn) && get_pcvar_num(CheckPistols) )
  284. {
  285. set_task(1.0, "check_pistols");
  286. new mapname[32];
  287. get_mapname(mapname,31);
  288. if ( containi(mapname,"ka_")!=-1 || containi(mapname,"scoutzknivez")!=-1 )
  289. g_PistolsDisabled = true;
  290. }
  291. }
  292.  
  293. public spawn_func(id)
  294. {
  295. if ( get_pcvar_num(HnsTrainingOn) && get_pcvar_num(Respawn)) {
  296. new parm[1];
  297. parm[0]=id;
  298.  
  299. set_task(0.5,"player_spawn",72,parm,1);
  300.  
  301. /* Then give them a suit and a knife */
  302. set_task(0.9,"player_giveitems",72,parm,1);
  303. }
  304. else {
  305. client_print(id, print_chat, "%L", id, "RESPAWN_OFF", PREFIX);
  306. }
  307. return PLUGIN_HANDLED;
  308. }
  309.  
  310. public on_Death()
  311. {
  312. if ( !get_pcvar_num(HnsTrainingOn) || !get_pcvar_num(Respawn) )
  313. return PLUGIN_CONTINUE;
  314.  
  315. new victim_id = read_data(2);
  316.  
  317. spawn_func( victim_id );
  318.  
  319. return PLUGIN_CONTINUE;
  320. }
  321.  
  322. public player_giveitems(parm[1])
  323. {
  324. new id = parm[0];
  325.  
  326. give_item(id, "item_suit");
  327. give_item(id, "weapon_knife");
  328.  
  329. /* Determines if a players should be given a pistol */
  330. if ( !g_PistolsDisabled )
  331. {
  332. new wpnList[32] = 0, number = 0, bool:foundGlock = false, bool:foundUSP = false;
  333. get_user_weapons(id,wpnList,number);
  334.  
  335. /* Determine if the player already has a pistol */
  336. for (new i = 0;i < number;i++)
  337. {
  338. if (wpnList[i] == CSW_GLOCK18)
  339. foundGlock = true;
  340. if (wpnList[i] == CSW_USP)
  341. foundUSP = true;
  342. }
  343.  
  344. /* Give a T his/her pistol */
  345. if ( get_user_team(id)==TS && !foundGlock )
  346. {
  347. give_item(id,"weapon_glock18");
  348. give_item(id,"ammo_9mm");
  349. give_item(id,"ammo_9mm");
  350. }
  351. /* Give a CT his/her pistol */
  352. else if ( get_user_team(id)==CTS && !foundUSP )
  353. {
  354. give_item(id,"weapon_usp");
  355. give_item(id,"ammo_45acp");
  356. give_item(id,"ammo_45acp");
  357. }
  358. }
  359.  
  360. return PLUGIN_CONTINUE;
  361. }
  362.  
  363. public player_spawn(parm[1])
  364. {
  365. ExecuteHamB(Ham_CS_RoundRespawn, parm[0]);
  366. }
  367.  
  368. public client_putinserver(id) {
  369. set_task(5.0, "cmdHnsTrainingMessages", id);
  370. }
  371.  
  372. public cmdHnsTrainingMessages(id) {
  373. if (!get_pcvar_num(HnsTrainingOn)) return;
  374. else {
  375. client_print(id, print_chat, "%L", LANG_PLAYER, "TYPE_TRAINING", PREFIX);
  376. set_task(2.0, "cmdHnsTrainingMessages1", id);
  377. set_task(4.0, "cmdHnsTrainingMessages2", id);
  378. set_task(6.0, "cmdHnsTrainingMessages3", id);
  379. }
  380. }
  381.  
  382. public cmdHnsTrainingMessages1(id) {
  383. client_print(id, print_chat, "%L", LANG_PLAYER, "F_AROUND", PREFIX);
  384. }
  385.  
  386. public fwHamPlayerSpawnPost(id)
  387. if (get_pcvar_num(HnsTrainingOn))
  388. set_pev(id, pev_takedamage, DAMAGE_NO);
  389.  
  390. // HOOK
  391. /////////////////////////////////////////////
  392. public cmdHookOn(id) {
  393. if ( get_pcvar_num(HnsTrainingOn) && get_pcvar_num(gCvarHookAllowed)) {
  394. if ( is_user_alive(id) && !gHooked[id] )
  395. hookThrow(id);
  396. }
  397. return PLUGIN_HANDLED;
  398. }
  399.  
  400. public cmdHookOff(id) {
  401. if ( gHooked[id] )
  402. hookRemove(id);
  403.  
  404. return PLUGIN_HANDLED;
  405. }
  406.  
  407. public hookThink(param[]) {
  408. new id = param[0];
  409. new HookEnt = param[1];
  410.  
  411. if ( !is_user_alive(id) || !pev_valid(HookEnt) || !pev_valid(id) ) {
  412. remove_task(id + 856);
  413. return PLUGIN_HANDLED;
  414. }
  415.  
  416. static Float:fVelocity[3];
  417. fVelocity = Float:{0.0, 0.0, 1.0};
  418.  
  419. if ( gHooked[id] ) {
  420. static Float:fHookOrigin[3], Float:fUsrOrigin[3], Float:fDist;
  421. pev(HookEnt, pev_origin, fHookOrigin);
  422. pev(id, pev_origin, fUsrOrigin);
  423.  
  424. fDist = vector_distance(fHookOrigin, fUsrOrigin);
  425.  
  426. if (fDist >= 38.0) {
  427. new Float:fSpeed = get_pcvar_float(gCvarHookSpeed);
  428.  
  429. fSpeed *= 0.52;
  430.  
  431. fVelocity[0] = (fHookOrigin[0] - fUsrOrigin[0]) * (2.0 * fSpeed) / fDist;
  432. fVelocity[1] = (fHookOrigin[1] - fUsrOrigin[1]) * (2.0 * fSpeed) / fDist;
  433. fVelocity[2] = (fHookOrigin[2] - fUsrOrigin[2]) * (2.0 * fSpeed) / fDist;
  434. }
  435. }
  436. set_pev(id, pev_velocity, fVelocity);
  437. return PLUGIN_HANDLED;
  438. }
  439.  
  440. public hookThrow(id) {
  441. static Float:fAngle[3], iStart[3];
  442. get_user_origin( id, iStart, 3 );
  443. pev( id, pev_angles, fAngle );
  444.  
  445. gHook[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  446.  
  447. if( pev_valid( gHook[id] ) ) {
  448. set_pev( gHook[id], pev_classname, "Hook" );
  449.  
  450. new Float:fStart[ 3 ];
  451. fStart[0] = float( iStart[0] );
  452. fStart[1] = float( iStart[1] );
  453. fStart[2] = float( iStart[2] );
  454.  
  455. engfunc( EngFunc_SetModel, gHook[id], "models/rpgrocket.mdl" );
  456. engfunc( EngFunc_SetOrigin, gHook[id], fStart );
  457. engfunc( EngFunc_SetSize, gHook[id], {-2.840000, -14.180000, -2.840000}, {2.840000, 0.020000, 2.840000} );
  458.  
  459. set_pev( gHook[id], pev_angles, fAngle );
  460. set_pev( gHook[id], pev_solid, SOLID_BBOX );
  461. set_pev( gHook[id], pev_movetype, MOVETYPE_NONE );
  462. set_pev( gHook[id], pev_owner, id );
  463.  
  464. // Make the line between Hook and Player
  465. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  466. write_byte( TE_BEAMENTPOINT );
  467. write_short( id ); // Startent
  468. write_coord( iStart[0] ); // End pos
  469. write_coord( iStart[1] );
  470. write_coord( iStart[2] );
  471. write_short( gBeam ); // Sprite
  472. write_byte( 1 ); // StartFrame
  473. write_byte( 1 ); // FrameRate
  474. write_byte( 600 ); // Life
  475. write_byte( 16 ); // Width
  476. write_byte( 3 ); // Noise
  477. write_byte( random_num(1, 255) ); // R
  478. write_byte( random_num(1, 255) ); // G
  479. write_byte( random_num(1, 255) ); // B
  480. write_byte( 192 ); // Brightness
  481. write_byte( 0 ); // Scroll speed
  482. message_end();
  483.  
  484. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  485. write_byte( TE_SPARKS );
  486. write_coord( iStart[0] );
  487. write_coord( iStart[1] );
  488. write_coord( iStart[2] );
  489. message_end();
  490.  
  491. emit_sound(id, CHAN_BODY, "weapons/xbow_fire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_HIGH);
  492.  
  493. gHooked[id] = true;
  494.  
  495. static TaskData[2];
  496. TaskData[0] = id;
  497. TaskData[1] = gHook[id];
  498.  
  499. if (!task_exists(id + 856)) {
  500. TaskData[0] = id;
  501. TaskData[1] = gHook[id];
  502. hookThink(TaskData);
  503.  
  504. set_task(0.1, "hookThink", id + 856, TaskData, 2, "b");
  505. }
  506. } else {
  507. client_print(id, print_chat, "%s Failed to create hook entity", PREFIX);
  508. }
  509. }
  510.  
  511. public hookRemove(id) {
  512. if( pev_valid(gHook[id]) )
  513. engfunc(EngFunc_RemoveEntity, gHook[id]);
  514.  
  515. gHook[id] = 0;
  516.  
  517. if(is_user_connected(id)) {
  518. message_begin( MSG_BROADCAST, SVC_TEMPENTITY, _, id );
  519. write_byte( TE_KILLBEAM );
  520. write_short( id );
  521. message_end();
  522. }
  523.  
  524. gHooked[id] = false;
  525. return 1;
  526. }
  527.  
  528. public cmdAllWeapons(id) {
  529. if (!get_pcvar_num(HnsTrainingOn) || !get_pcvar_num(AllWeaponsOn))
  530. client_print(id, print_chat, "%L", LANG_PLAYER, "ALLWEAPONS_OFF", PREFIX);
  531. else {
  532. new ALL_WEAPONS[][] = {"weapon_m3","weapon_xm1014", "weapon_mp5navy", "weapon_mac10", "weapon_p90", "weapon_aug", "weapon_ump45", "weapon_elite", "weapon_ak47", "weapon_m4a1", "weapon_sg552", "weapon_sg550", "weapon_awp", "weapon_scout", "weapon_fiveseven", "weapon_g3sg1", "weapon_m249", "weapon_deagle", "weapon_glock18", "weapon_famas", "weapon_galil", "weapon_tmp", "weapon_usp"};
  533.  
  534. const sizeOfAllWeapons = sizeof ALL_WEAPONS;
  535.  
  536. for(new i=0;i<sizeOfAllWeapons;i++)
  537. give_item(id,ALL_WEAPONS[i]);
  538.  
  539. client_print(id, print_chat, "%L", LANG_PLAYER, "NOW_HAVE_ALLWEAPONS", PREFIX);
  540. }
  541. }
  542.  
  543. public cmdWeapons(id) {
  544. if (!get_pcvar_num(HnsTrainingOn) || !get_pcvar_num(WeaponMenuOn))
  545. client_print(id, print_chat, "%L", LANG_PLAYER, "WEAPONMENU_OFF", PREFIX);
  546. else {
  547. /* Weapon Menu Start */
  548. new mWeaponMenu = menu_create("Weapon Menu", "cmdMhWeaponMenu");
  549.  
  550. menu_additem(mWeaponMenu, "Handguns", "1");
  551. menu_additem(mWeaponMenu, "Shotguns", "2");
  552. menu_additem(mWeaponMenu, "Sub-Machine Guns", "3");
  553. menu_additem(mWeaponMenu, "Rifles", "4");
  554. menu_additem(mWeaponMenu, "Snipers", "5");
  555. menu_additem(mWeaponMenu, "M249", "6");
  556.  
  557. menu_setprop(mWeaponMenu, MPROP_EXIT, MEXIT_ALL);
  558. menu_display(id, mWeaponMenu, 0);
  559. }
  560. }
  561.  
  562. public cmdMhWeaponMenu(id, mWeaponMenu, item) {
  563. if (item == MENU_EXIT) {
  564. menu_destroy(mWeaponMenu);
  565. return PLUGIN_HANDLED;
  566. }
  567.  
  568. new Data[2];
  569. new Access;
  570. new Callback;
  571. menu_item_getinfo(mWeaponMenu, item, Access, Data, 1, _, _, Callback);
  572.  
  573. new Key = str_to_num(Data);
  574.  
  575. switch (Key)
  576. {
  577. case 1: cmdHandGunsMenu(id);
  578. case 2: cmdShotGunsMenu(id);
  579. case 3: cmdSubMachineGunsMenu(id);
  580. case 4: cmdRiflesMenu(id);
  581. case 5: cmdSnipersMenu(id);
  582. case 6: give_item(id, "weapon_m249");
  583. }
  584. menu_destroy(mWeaponMenu);
  585. return PLUGIN_HANDLED;
  586. }
  587.  
  588. public cmdHandGunsMenu(id) {
  589. new mHandGunsMenu = menu_create("Handguns", "cmdMhHandGunsMenu");
  590.  
  591. menu_additem(mHandGunsMenu, "Glock", "1");
  592. menu_additem(mHandGunsMenu, "USP", "2");
  593. menu_additem(mHandGunsMenu, "P228", "3");
  594. menu_additem(mHandGunsMenu, "Deagle", "4");
  595. menu_additem(mHandGunsMenu, "Five-Seven", "5");
  596. menu_additem(mHandGunsMenu, "Dual Elites", "6");
  597.  
  598. menu_setprop(mHandGunsMenu, MPROP_EXIT, MEXIT_ALL);
  599. menu_display(id, mHandGunsMenu, 0);
  600. }
  601.  
  602. public cmdMhHandGunsMenu(id, mHandGunsMenu, item) {
  603. if (item == MENU_EXIT) {
  604. menu_destroy(mHandGunsMenu);
  605. return PLUGIN_HANDLED;
  606. }
  607.  
  608. new Data[2];
  609. new Access;
  610. new Callback;
  611. menu_item_getinfo(mHandGunsMenu, item, Access, Data, 1, _, _, Callback);
  612.  
  613. new Key = str_to_num(Data);
  614.  
  615. switch (Key)
  616. {
  617. case 1: give_item(id, "weapon_glock18");
  618. case 2: give_item(id, "weapon_usp");
  619. case 3: give_item(id, "weapon_p228");
  620. case 4: give_item(id, "weapon_deagle");
  621. case 5: give_item(id, "weapon_fiveseven");
  622. case 6: give_item(id, "weapon_elite");
  623. }
  624. menu_destroy(mHandGunsMenu);
  625. return PLUGIN_HANDLED;
  626. }
  627.  
  628. public cmdShotGunsMenu(id) {
  629. /* Weapon Menu Start */
  630. new mShotGunsMenu = menu_create("Shotguns", "cmdMhShotGunsMenu");
  631.  
  632. menu_additem(mShotGunsMenu, "M3", "1");
  633. menu_additem(mShotGunsMenu, "XM1014", "2");
  634.  
  635. menu_setprop(mShotGunsMenu, MPROP_EXIT, MEXIT_ALL);
  636. menu_display(id, mShotGunsMenu, 0);
  637. }
  638.  
  639. public cmdMhShotGunsMenu(id, mShotGunsMenu, item) {
  640. if (item == MENU_EXIT) {
  641. menu_destroy(mShotGunsMenu);
  642. return PLUGIN_HANDLED;
  643. }
  644.  
  645. new Data[2];
  646. new Access;
  647. new Callback;
  648. menu_item_getinfo(mShotGunsMenu, item, Access, Data, 1, _, _, Callback);
  649.  
  650. new Key = str_to_num(Data);
  651.  
  652. switch (Key)
  653. {
  654. case 1: give_item(id, "weapon_m3");
  655. case 2: give_item(id, "weapon_xm1014");
  656. }
  657. menu_destroy(mShotGunsMenu);
  658. return PLUGIN_HANDLED;
  659. }
  660.  
  661. public cmdSubMachineGunsMenu(id) {
  662. /* Weapon Menu Start */
  663. new mSubMachineGunsMenu = menu_create("Sub-Machine Guns", "cmdMhSubMachineGunsMenu");
  664.  
  665. menu_additem(mSubMachineGunsMenu, "TMP", "1");
  666. menu_additem(mSubMachineGunsMenu, "MAC-10", "2");
  667. menu_additem(mSubMachineGunsMenu, "MP5", "3");
  668. menu_additem(mSubMachineGunsMenu, "UMP", "4");
  669. menu_additem(mSubMachineGunsMenu, "P90", "5");
  670.  
  671. menu_setprop(mSubMachineGunsMenu, MPROP_EXIT, MEXIT_ALL);
  672. menu_display(id, mSubMachineGunsMenu, 0);
  673. }
  674.  
  675. public cmdMhSubMachineGunsMenu(id, mSubMachineGunsMenu, item) {
  676. if (item == MENU_EXIT) {
  677. menu_destroy(mSubMachineGunsMenu);
  678. return PLUGIN_HANDLED;
  679. }
  680.  
  681. new Data[2];
  682. new Access;
  683. new Callback;
  684. menu_item_getinfo(mSubMachineGunsMenu, item, Access, Data, 1, _, _, Callback);
  685.  
  686. new Key = str_to_num(Data);
  687.  
  688. switch (Key)
  689. {
  690. case 1: give_item(id, "weapon_tmp");
  691. case 2: give_item(id, "weapon_mac10");
  692. case 3: give_item(id, "weapon_mp5navy");
  693. case 4: give_item(id, "weapon_ump45");
  694. case 5: give_item(id, "weapon_p90");
  695. }
  696. menu_destroy(mSubMachineGunsMenu);
  697. return PLUGIN_HANDLED;
  698. }
  699.  
  700. public cmdRiflesMenu(id) {
  701. new mRiflesMenu = menu_create("Rifles", "cmdMhRiflesMenu");
  702.  
  703. menu_additem(mRiflesMenu, "FAMAS", "1");
  704. menu_additem(mRiflesMenu, "Galil", "2");
  705. menu_additem(mRiflesMenu, "AK-47", "3");
  706. menu_additem(mRiflesMenu, "M4A1", "4");
  707. menu_additem(mRiflesMenu, "AUG", "5");
  708. menu_additem(mRiflesMenu, "SG552", "6");
  709.  
  710. menu_setprop(mRiflesMenu, MPROP_EXIT, MEXIT_ALL);
  711. menu_display(id, mRiflesMenu, 0);
  712. }
  713.  
  714. public cmdMhRiflesMenu(id, mRiflesMenu, item) {
  715. if (item == MENU_EXIT) {
  716. menu_destroy(mRiflesMenu);
  717. return PLUGIN_HANDLED;
  718. }
  719.  
  720. new Data[2];
  721. new Access;
  722. new Callback;
  723. menu_item_getinfo(mRiflesMenu, item, Access, Data, 1, _, _, Callback);
  724.  
  725. new Key = str_to_num(Data);
  726.  
  727. switch (Key)
  728. {
  729. case 1: give_item(id, "weapon_famas");
  730. case 2: give_item(id, "weapon_galil");
  731. case 3: give_item(id, "weapon_ak47");
  732. case 4: give_item(id, "weapon_m4a1");
  733. case 5: give_item(id, "weapon_aug");
  734. case 6: give_item(id, "weapon_sg552");
  735. }
  736. menu_destroy(mRiflesMenu);
  737. return PLUGIN_HANDLED;
  738. }
  739.  
  740. public cmdSnipersMenu(id) {
  741. new mSnipersMenu = menu_create("Snipers", "cmdMhSnipersMenu");
  742.  
  743. menu_additem(mSnipersMenu, "Scout", "1");
  744. menu_additem(mSnipersMenu, "AWP", "2");
  745. menu_additem(mSnipersMenu, "SG550", "3");
  746. menu_additem(mSnipersMenu, "G3SG1", "4");
  747.  
  748. menu_setprop(mSnipersMenu, MPROP_EXIT, MEXIT_ALL);
  749. menu_display(id, mSnipersMenu, 0);
  750. }
  751.  
  752. public cmdMhSnipersMenu(id, mSnipersMenu, item) {
  753. if (item == MENU_EXIT) {
  754. menu_destroy(mSnipersMenu);
  755. return PLUGIN_HANDLED;
  756. }
  757.  
  758. new Data[2];
  759. new Access;
  760. new Callback;
  761. menu_item_getinfo(mSnipersMenu, item, Access, Data, 1, _, _, Callback);
  762.  
  763. new Key = str_to_num(Data);
  764.  
  765. switch (Key)
  766. {
  767. case 1: give_item(id, "weapon_scout");
  768. case 2: give_item(id, "weapon_awp");
  769. case 3: give_item(id, "weapon_sg550");
  770. case 4: give_item(id, "weapon_g3sg1");
  771. }
  772. menu_destroy(mSnipersMenu);
  773. return PLUGIN_HANDLED;
  774. }
  775.  
  776. public cmdTrainingMenu(id) {
  777. if (!get_pcvar_num(HnsTrainingOn))
  778. client_print(id, print_chat, "%L", LANG_PLAYER, "HNSTRAINING_OFF", PREFIX);
  779. else {
  780. /* Menu Start */
  781. new szBuffer[256], iLen;
  782. new szNoclip[6];
  783. new szGodmode[6];
  784. szNoclip = (get_user_noclip(id) ? "\yOn" : "\rOff");
  785. szGodmode = (get_user_godmode(id) ? "\yOn" : "\rOff");
  786.  
  787. iLen = formatex(szBuffer, sizeof szBuffer - 1, "\rTRAINING FOR \yPROS ONLY^n^n");
  788. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wHere we go !^n");
  789. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. \wHere we go again :(^n");
  790. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. \wHow you manage to do that ?^n^n");
  791. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. \wDon't use it...: %s^n", szNoclip);
  792. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5. \wWelp we need this: %s^n^n", szGodmode);
  793. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wClose Menu");
  794.  
  795. new iKeys = (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9);
  796. show_menu(id, iKeys, szBuffer, -1, "HNS Training Menu");
  797. /* Menu End */
  798. }
  799. }
  800.  
  801. public handleTrainingMenu(id, num) {
  802. switch (num)
  803. {
  804. case 0: Checkpoint(id);
  805.  
  806. case 1: GoCheckpoint(id);
  807.  
  808. case 2: LastCheckpoint(id);
  809.  
  810. case 3:
  811. {
  812. if (get_user_noclip(id)) {
  813. set_user_noclip(id, 0);
  814. //client_print(id, print_chat, "%L", LANG_PLAYER, "NOCLIP_OFF", PREFIX);
  815. }
  816. else {
  817. set_user_noclip(id, 1);
  818. //client_print(id, print_chat, "%L", LANG_PLAYER, "NOCLIP_ON", PREFIX);
  819. }
  820. }
  821.  
  822. case 4:
  823. {
  824. if (get_user_godmode(id)) {
  825. set_user_godmode(id, 0);
  826. //client_print(id, print_chat, "%L", LANG_PLAYER, "GODMODE_OFF", PREFIX);
  827. }
  828. else {
  829. set_user_godmode(id, 1);
  830. //client_print(id, print_chat, "%L", LANG_PLAYER, "GODMODE_ON", PREFIX);
  831. }
  832. }
  833. case 9: return PLUGIN_HANDLED;
  834. }
  835. if (num != 9)
  836. cmdTrainingMenu(id);
  837.  
  838. return PLUGIN_HANDLED;
  839. }
  840.  
  841. public Checkpoint(id) {
  842. if (!get_pcvar_num(HnsTrainingOn) || !get_pcvar_num(CheckpointsAndGoChecksOn))
  843. client_print(id, print_chat, "%L", LANG_PLAYER, "CHECKPOINTS_OFF", PREFIX);
  844.  
  845. else {
  846. /*if (get_user_button(id)&IN_DUCK) {
  847. client_print(id, print_chat, "%L", LANG_PLAYER, "CANT_PLACE_CP_INDUCK", PREFIX);
  848. return PLUGIN_CONTINUE;
  849. }*/
  850.  
  851. //client_print(id, print_chat,"%L", LANG_PLAYER, "SAVING_CP", PREFIX);
  852.  
  853. if (gCheckpoint[id]) {
  854. gLastCheckpointPos[id][0]=gCheckpointPos[id][0];
  855. gLastCheckpointPos[id][1]=gCheckpointPos[id][1];
  856. gLastCheckpointPos[id][2]=gCheckpointPos[id][2];
  857.  
  858. gLastCheckpointAngle[id][0]=gCheckpointAngle[id][0];
  859. gLastCheckpointAngle[id][1]=gCheckpointAngle[id][1];
  860. gLastCheckpointAngle[id][2]=gCheckpointAngle[id][2];
  861. }
  862.  
  863. pev(id, pev_origin, gCheckpointPos[id]);
  864. pev(id, pev_v_angle, gCheckpointAngle[id]);
  865. gCheckpointPos[id][2] += 5;
  866. gCheckpoint[id]=true;
  867. gChecks[id]++;
  868.  
  869. set_hudmessage(255, 0, 0, 0.0, 0.63, 0, 6.0, 3.0);
  870. show_hudmessage(id, "%s Checkpoint #%d", PREFIX, gChecks[id]);
  871.  
  872. return PLUGIN_HANDLED;
  873. }
  874. return PLUGIN_HANDLED;
  875. }
  876.  
  877. public LastCheckpoint(id) {
  878. if (!get_pcvar_num(HnsTrainingOn) || !get_pcvar_num(CheckpointsAndGoChecksOn))
  879. client_print(id, print_chat, "%L", LANG_PLAYER, "AUTO_UNSTUCK_OFF", PREFIX);
  880.  
  881. else {
  882. if (!gCheckpoint[id]) {
  883. client_print(id, print_chat, "%L", LANG_PLAYER, "HAVE_NO_CP_TO_REVERTTO", PREFIX);
  884. return PLUGIN_CONTINUE;
  885. }
  886. client_print(id, print_chat, "%L", LANG_PLAYER, "REVERTING_TO_LAST_CP", PREFIX);
  887.  
  888. gCheckpointPos[id][0]=gLastCheckpointPos[id][0];
  889. gCheckpointPos[id][1]=gLastCheckpointPos[id][1];
  890. gCheckpointPos[id][2]=gLastCheckpointPos[id][2];
  891.  
  892. gCheckpointAngle[id][0]=gLastCheckpointAngle[id][0];
  893. gCheckpointAngle[id][1]=gLastCheckpointAngle[id][1];
  894. gCheckpointAngle[id][2]=gLastCheckpointAngle[id][2];
  895.  
  896. gCheckpoint[id]=true;
  897.  
  898. move_to_check(id);
  899.  
  900. return PLUGIN_HANDLED;
  901. }
  902. return PLUGIN_HANDLED;
  903. }
  904.  
  905. public GoCheckpoint(id) {
  906. if (!get_pcvar_num(HnsTrainingOn) || !get_pcvar_num(CheckpointsAndGoChecksOn))
  907. client_print(id, print_chat, "%L", LANG_PLAYER, "GOCHECKS_OFF", PREFIX);
  908.  
  909. else {
  910. if (!gCheckpoint[id]) {
  911. client_print(id, print_chat, "%L", LANG_PLAYER, "HAVE_NO_CHECKPOINT", PREFIX);
  912. return PLUGIN_CONTINUE;
  913. }
  914. move_to_check(id);
  915. gGoChecks[id]++;
  916.  
  917. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING);
  918. engfunc(EngFunc_SetSize, id, {-16, -16, -18}, {16, 16, 18});
  919.  
  920. set_hudmessage(255, 0, 0, 0.0, 0.63, 0, 6.0, 3.0);
  921. show_hudmessage(id, "%s GoCheck #%d", PREFIX, gGoChecks[id]);
  922.  
  923. return PLUGIN_HANDLED;
  924. }
  925. return PLUGIN_HANDLED;
  926. }
  927.  
  928. stock move_to_check(id) {
  929. new vVelocity[3];
  930. set_pev( id, pev_velocity, vVelocity );
  931.  
  932. new CurOrig[3];
  933. get_user_origin(id,CurOrig);
  934. message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
  935. write_byte(TE_TELEPORT);
  936. write_coord(CurOrig[0]);
  937. write_coord(CurOrig[1]);
  938. write_coord(CurOrig[2]);
  939. message_end();
  940. message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
  941. write_byte(TE_TELEPORT);
  942. write_coord(gCheckpointPos[id][0]);
  943. write_coord(gCheckpointPos[id][1]);
  944. write_coord(gCheckpointPos[id][2]);
  945. message_end();
  946.  
  947. //Move To Checkpoint
  948. engfunc(EngFunc_SetOrigin, id, gCheckpointPos[id]);
  949. set_pev(id, pev_angles, gCheckpointAngle[id]);
  950. set_pev(id, pev_fixangle, 1);
  951.  
  952. return PLUGIN_CONTINUE;
  953. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement