View Single Post
VEN
Veteran Member
Join Date: Jan 2005
Old 02-02-2006 , 07:17  
Reply With Quote #7

Code:
// max fall height implementation and reconnect runtime error fix #include <amxmodx> #include <engine> #define FALL_VELOCITY 350.0 #define MAX_FALL_HEIGHT 250 // player would get hurt if he falled over greater height new g_start_falling_height[33] new bool:g_height_reached[33]; public plugin_init() {   register_plugin("No fall damage", "0.1", "v3x");   if(!cvar_exists("mp_falldamage")) {     register_cvar("mp_falldamage", "0");   } } new bool:falling[33]; public client_PreThink(id) {   if(get_cvar_num("mp_falldamage") == 0 && is_user_alive(id)) {     if(entity_get_float(id, EV_FL_flFallVelocity) >= FALL_VELOCITY) {       if(g_height_reached[id])         return       new origin[3]       get_user_origin(id, origin)       if(!falling[id]) {         //server_print("DEBUG: [%d] Start falling at height [%d]", id, origin[2])         falling[id] = true         g_start_falling_height[id] = origin[2]       }       else if(g_start_falling_height[id] - origin[2] > MAX_FALL_HEIGHT) {         /*     server_print("DEBUG: [%d] MAX FALL HEIGHT is reached at height [%d]. Height difference [%d]",     id, origin[2], g_start_falling_height[id] - origin[2])         */     falling[id] = false;         g_height_reached[id] = true       }     } else {       falling[id] = false;       g_height_reached[id] = false     }   } } public client_PostThink(id) {   if(get_cvar_num("mp_falldamage") == 0) {     if(falling[id]) {       entity_set_int(id, EV_INT_watertype, -3);     }   } }
VEN is offline