HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #define VERSION "0.1"
  5. #define LEET 1337
  6. //#define DEBUG 1
  7.  
  8. const g_iProg = (0xFF);
  9. const g_iWeaps = (0x1E);
  10. const g_iMaxSpeed = (0x2EE);
  11. const g_iMaxCzas = (0xA);
  12.  
  13. new g_iMaxPlayers;
  14.  
  15. new Float:g_fTempMaxSpeed[0x21];
  16. new Float:g_fSprintLeft[0x21];
  17.  
  18. new const Float:g_fWeaponsSpeed[g_iWeaps + 1]={ //THX 4 DARKGL ZA TABLICE ;)
  19. 000.0,
  20. 250.0, 000.0, 260.0, 250.0, 240.0,
  21. 250.0, 250.0, 240.0, 250.0, 250.0,
  22. 250.0, 250.0, 210.0, 240.0, 240.0,
  23. 250.0, 250.0, 210.0, 250.0, 220.0,
  24. 230.0, 230.0, 250.0, 210.0, 250.0,
  25. 250.0, 235.0, 221.0, 250.0, 245.0
  26. };
  27.  
  28. public plugin_init() {
  29. register_plugin("Szybki bieg", VERSION, "diablix")
  30.  
  31. g_iMaxPlayers = get_maxplayers();
  32.  
  33. register_forward(FM_CmdStart, "fwCmdStart", 0);
  34. register_event("CurWeapon", "eventCurWeapon", "be", "1=1");
  35.  
  36. set_task(0.4, "taskPrintAmmount", _, _, _, "b");
  37. }
  38.  
  39. public plugin_cfg() set_cvar_num("sv_maxspeed", g_iMaxSpeed);
  40.  
  41. public eventCurWeapon(id){
  42. if(g_fTempMaxSpeed[id] >= float(g_iProg)){
  43. set_pev(id, pev_maxspeed, g_fTempMaxSpeed[id]);
  44. client_cmd(id, "cl_forwardspeed ^"%d^"", floatround(g_fTempMaxSpeed[id]));
  45.  
  46. #if defined DEBUG
  47. client_print(id, 3, "%.1f", g_fTempMaxSpeed[id]);
  48. #endif
  49. }
  50. else{
  51. set_pev(id, pev_maxspeed, g_fWeaponsSpeed[get_user_weapon(id)]);
  52.  
  53. #if defined DEBUG
  54. client_print(id, 3, "%.1f", g_fWeaponsSpeed[get_user_weapon(id)]);
  55. #endif
  56. }
  57. }
  58.  
  59. public fwCmdStart(id, iHandle, iSeed){
  60. if(!is_user_alive(id)) return FMRES_IGNORED;
  61.  
  62. new Float:fmove, Float:smove;
  63. get_uc(iHandle, UC_ForwardMove, fmove);
  64. get_uc(iHandle, UC_SideMove, smove);
  65.  
  66. new Float:maxspeed;
  67. pev(id, pev_maxspeed, maxspeed);
  68. new Float:walkspeed = (maxspeed * 0.52);
  69. fmove = floatabs(fmove);
  70. smove = floatabs(smove);
  71.  
  72. if(fmove <= walkspeed && smove <= walkspeed && !(fmove == 0.0 && smove == 0.0)){
  73. if(g_fSprintLeft[id] >= 0.5){
  74. if(task_exists(id + LEET)) remove_task(id + LEET);
  75. g_fTempMaxSpeed[id] = g_fTempMaxSpeed[id] < 400.0 ? 400.0 : g_fTempMaxSpeed[id];
  76. g_fTempMaxSpeed[id] = g_fTempMaxSpeed[id] < float(g_iMaxSpeed) ? g_fTempMaxSpeed[id] + 10.0 : g_fTempMaxSpeed[id];
  77. set_pev(id, pev_maxspeed, g_fTempMaxSpeed[id]);
  78. client_cmd(id, "cl_forwardspeed ^"%d^"", floatround(g_fTempMaxSpeed[id]));
  79. engclient_cmd(id, "weapon_knife");
  80.  
  81. g_fSprintLeft[id] -= 0.05;
  82.  
  83. for(new i = 0 ; i < 0x10 ; i++){
  84. new bitButtons = get_uc(iHandle, UC_Buttons);
  85. new bitOldbuttons = pev(id, pev_oldbuttons);
  86. if(!(((1<<3)|(1<<4)|(1<<12)) & (1<<i))){
  87. if((bitButtons & (1<<i))){
  88. if((1<<2) & (1<<i))
  89. set_pev(id, pev_oldbuttons, bitOldbuttons | (1<<i));
  90.  
  91. else
  92. set_uc(iHandle, UC_Buttons, bitButtons & (~(1<<i)));
  93.  
  94. return FMRES_SUPERCEDE;
  95. }
  96. }
  97. }
  98. }
  99. else{
  100. g_fTempMaxSpeed[id] = 0.0;
  101. eventCurWeapon(id);
  102. client_print(id, print_center, "Elfaradtal!");
  103. }
  104. return FMRES_IGNORED;
  105. }
  106. else{
  107. if(!task_exists(id + LEET)) set_task(1.0, "taskRecoverSprint", id + LEET);
  108. g_fTempMaxSpeed[id] = 0.0;
  109. eventCurWeapon(id);
  110. }
  111. return FMRES_IGNORED;
  112. }
  113.  
  114. public taskRecoverSprint(task_id){
  115. new id = task_id - LEET;
  116.  
  117. g_fSprintLeft[id]++;
  118.  
  119. if(floatround(g_fSprintLeft[id]) < g_iMaxCzas || floatround(g_fSprintLeft[id]) > g_iMaxCzas){
  120. if(floatround(g_fSprintLeft[id]) < g_iMaxCzas) set_task(1.0, "taskRecoverSprint", id + LEET);
  121. if(floatround(g_fSprintLeft[id]) > g_iMaxCzas) g_fSprintLeft[id] = float(g_iMaxCzas);
  122. }
  123. }
  124.  
  125. public taskPrintAmmount(){
  126. static id; //statyczna
  127. for(id = 1 ; id <= g_iMaxPlayers ; id++){
  128. if(is_user_alive(id)){
  129. new iSprint = floatround(g_fSprintLeft[id]);
  130. new sSprint[g_iMaxCzas];
  131.  
  132. while(iSprint >= 1){
  133. iSprint--;
  134. add(sSprint, sizeof sSprint - 1, "*");
  135. }
  136. iSprint = floatround(g_fSprintLeft[id]);
  137. set_hudmessage(iSprint ? 0x64 : 0xFF, iSprint ? 0x48 : 0x0, iSprint ? 0xC : 0x0, 0.01, 0.77, 0, 0.000001, 0.405, 0.000001, 0.000001, -1);
  138. show_hudmessage(id, "SPRINT : [%s]", sSprint);
  139. }
  140. }
  141. }
  142.