Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <hamsandwich>
- #include <cstrike>
- #define PLUGIN "skating"
- #define VERSION "0.3"
- #define AUTHOR "Jim Richardson"
- new Float:g_iLastend[33]
- public plugin_init() {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_forward(FM_PlayerPreThink, "PreThink")
- RegisterHam(Ham_TakeDamage, "player", "fw_takedamage") //remove fall damage
- RegisterHam(Ham_AddPlayerItem, "player", "CBasePlayer_AddPlayerItem") //remove all weapons except knife
- }
- public PreThink(id) {
- new Float:start[3], Float:dest[3], Float:end[3]
- pev(id, pev_origin, start)
- dest[0] = start[0]
- dest[1] = start[1]
- dest[2] = -8191.0
- engfunc(EngFunc_TraceLine, start, dest, 1, id, 0)
- get_tr2(0, TR_vecEndPos, end)
- pev(id, pev_absmin, start)
- new Float:ret = start[2] - end[2]
- new duck = (pev(id, pev_flags) & FL_DUCKING)
- if ((ret < 5.0 || (duck && ret < 23.0))) {
- new Float:origin[3]
- pev(id, pev_origin, origin)
- origin[2] += (((duck) ? 23.0 : 5.0) - ret)
- set_pev(id, pev_origin, origin)
- new Float:velocity[3]
- pev(id,pev_velocity, velocity)
- if (velocity[2] < 0) {
- velocity[2] = 0.0
- }
- if (end[2] > g_iLastend[id]) {
- new Float:amt
- if (end[2] < 0.0 && g_iLastend[id] < 0.0) amt = floatabs(g_iLastend[id]) - floatabs(end[2])
- if (end[2] > 0.0 && g_iLastend[id] > 0.0) amt = end[2] - g_iLastend[id]
- if (amt < 55.0) {
- velocity[2] += ((floatabs(velocity[0]) + floatabs(velocity[1])) /100.0 * amt)
- /* X, Y slowdown if going up ramps
- if (velocity[0] < 0.0) velocity[0] += amt
- else velocity[0] -= amt
- if (velocity[1] < 0.0) velocity[1] += amt
- else velocity[1] -= amt */
- }
- }
- set_pev(id, pev_velocity, velocity)
- }
- g_iLastend[id] = end[2]
- }
- public fw_takedamage(victim, inflictor, attacker, Float:dmg, dmgbits) {
- if (dmgbits & DMG_FALL) return HAM_SUPERCEDE
- return HAM_IGNORED
- }
- public CBasePlayer_AddPlayerItem( id , iWeapon ) {
- if( ExecuteHam(Ham_Item_GetWeaponPtr, iWeapon) != iWeapon || cs_get_weapon_id(iWeapon) == CSW_KNIFE )
- {
- return HAM_IGNORED
- }
- set_pev(iWeapon, pev_flags, pev(iWeapon, pev_flags) | FL_KILLME)
- SetHamReturnInteger(0)
- return HAM_SUPERCEDE
- }
- public client_putinserver(id) {
- if (!task_exists(id)) set_task(0.1, "speedfunc", id, _, _, "b") //show speed
- }
- public speedfunc(id) {
- if (is_user_connected(id)) {
- if (is_user_alive(id)) {
- new Float:speed, Float:velocity[3]
- pev(id,pev_velocity, velocity)
- speed = floatsqroot( velocity[0] * velocity[0] + velocity[1] * velocity[1] + velocity[2] * velocity[2] )
- set_hudmessage(255, 255, 255, -1.0, -1.0)
- show_hudmessage(id, "Speed: %f", speed)
- }
- }
- else {
- remove_task(id)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement