Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2012
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.71 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5. #include <cstrike>
  6.  
  7. #define PLUGIN "skating"
  8. #define VERSION "0.3"
  9. #define AUTHOR "Jim Richardson"
  10.  
  11. new Float:g_iLastend[33]
  12. public plugin_init() {
  13.     register_plugin(PLUGIN, VERSION, AUTHOR)
  14.     register_forward(FM_PlayerPreThink, "PreThink")
  15.     RegisterHam(Ham_TakeDamage, "player", "fw_takedamage") //remove fall damage
  16.     RegisterHam(Ham_AddPlayerItem, "player", "CBasePlayer_AddPlayerItem")  //remove all weapons except knife
  17. }
  18. public PreThink(id) {
  19.     new Float:start[3], Float:dest[3], Float:end[3]
  20.     pev(id, pev_origin, start)
  21.     dest[0] = start[0]
  22.     dest[1] = start[1]
  23.     dest[2] = -8191.0
  24.     engfunc(EngFunc_TraceLine, start, dest, 1, id, 0)
  25.     get_tr2(0, TR_vecEndPos, end)  
  26.     pev(id, pev_absmin, start)
  27.     new Float:ret = start[2] - end[2]
  28.     new duck = (pev(id, pev_flags) & FL_DUCKING)
  29.     if ((ret < 5.0 || (duck  && ret < 23.0))) {
  30.         new Float:origin[3]
  31.         pev(id, pev_origin, origin)
  32.         origin[2] += (((duck) ? 23.0 : 5.0) - ret)
  33.         set_pev(id, pev_origin, origin)
  34.         new Float:velocity[3]
  35.         pev(id,pev_velocity, velocity)
  36.         if (velocity[2] < 0) {
  37.             velocity[2] = 0.0
  38.         }
  39.         if (end[2] > g_iLastend[id]) {
  40.             new Float:amt
  41.             if (end[2] < 0.0 && g_iLastend[id] < 0.0) amt =  floatabs(g_iLastend[id]) - floatabs(end[2])
  42.             if (end[2] > 0.0 && g_iLastend[id] > 0.0) amt = end[2] - g_iLastend[id]
  43.             if (amt < 55.0) {
  44.                 velocity[2] +=  ((floatabs(velocity[0]) + floatabs(velocity[1])) /100.0 * amt)
  45.                 /* X, Y slowdown if going up ramps
  46.                 if (velocity[0] < 0.0) velocity[0] += amt
  47.                 else velocity[0] -= amt
  48.                 if (velocity[1] < 0.0) velocity[1] += amt
  49.                 else velocity[1] -= amt */
  50.             }
  51.         }
  52.         set_pev(id, pev_velocity, velocity)
  53.     }
  54.     g_iLastend[id] = end[2]
  55. }
  56. public fw_takedamage(victim, inflictor, attacker, Float:dmg, dmgbits) {
  57.     if (dmgbits & DMG_FALL) return HAM_SUPERCEDE
  58.     return HAM_IGNORED
  59. }
  60.  
  61. public CBasePlayer_AddPlayerItem( id , iWeapon ) {
  62.     if(    ExecuteHam(Ham_Item_GetWeaponPtr, iWeapon) != iWeapon ||    cs_get_weapon_id(iWeapon) == CSW_KNIFE    )
  63.     {
  64.         return HAM_IGNORED
  65.     }
  66.  
  67.     set_pev(iWeapon, pev_flags, pev(iWeapon, pev_flags) | FL_KILLME)
  68.     SetHamReturnInteger(0)
  69.     return HAM_SUPERCEDE
  70. }
  71.  
  72. public client_putinserver(id) {
  73.     if (!task_exists(id)) set_task(0.1, "speedfunc", id, _, _, "b") //show speed
  74. }
  75.  
  76. public speedfunc(id) {
  77.     if (is_user_connected(id)) {
  78.         if (is_user_alive(id)) {
  79.             new Float:speed, Float:velocity[3]
  80.             pev(id,pev_velocity, velocity)
  81.             speed = floatsqroot( velocity[0] * velocity[0] + velocity[1] * velocity[1] + velocity[2] * velocity[2] )
  82.             set_hudmessage(255, 255, 255, -1.0, -1.0)
  83.             show_hudmessage(id, "Speed: %f", speed)
  84.            
  85.         }
  86.     }
  87.     else {
  88.         remove_task(id)
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement