Raised This Month: $ Target: $400
 0% 

No fall damage (Eliminates damage from falling!!)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VEN
Veteran Member
Join Date: Jan 2005
Old 02-02-2006 , 07:17  
Reply With Quote #1

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
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode