Raised This Month: $ Target: $400
 0% 

falldamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sn3amtz
Senior Member
Join Date: Jan 2015
Location: France
Old 01-08-2016 , 07:38   falldamage
Reply With Quote #1

After player falls I want to get player falldamage + respawn is possible?

Code:
#include <amxmodx>
#include <engine>

#define FALL_VELOCITY 350.0

public plugin_init() {
  register_plugin("No fall damage", "0.2", "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) 
  && is_user_connected(id)) {
    if(entity_get_float(id, EV_FL_flFallVelocity) >= FALL_VELOCITY) {
      falling[id] = true;
    } else {
      falling[id] = false;
    }
  }
}

public client_PostThink(id) {
  if(get_cvar_num("mp_falldamage") == 0 
  && is_user_alive(id) 
  && is_user_connected(id)) {
    if(falling[id]) {
      entity_set_int(id, EV_INT_watertype, -3);
    }
  }
}
Sn3amtz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-08-2016 , 08:29   Re: falldamage
Reply With Quote #2

Explain with more detail exactly what you want. This can probably be handled more efficiently than what you posted.
__________________
Bugsy is offline
Sn3amtz
Senior Member
Join Date: Jan 2015
Location: France
Old 01-08-2016 , 08:42   Re: falldamage
Reply With Quote #3

I do not want to die after falls , I want to get respawn when falls... sorry for my bad english

Last edited by Sn3amtz; 01-08-2016 at 08:42.
Sn3amtz is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 01-08-2016 , 09:21   Re: falldamage
Reply With Quote #4

Respawn after falling without dying?
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
Sn3amtz
Senior Member
Join Date: Jan 2015
Location: France
Old 01-08-2016 , 09:25   Re: falldamage
Reply With Quote #5

Yes .. Can u make?
Sn3amtz is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-08-2016 , 09:55   Re: falldamage
Reply With Quote #6

I guess he wants a player to just spawn again instead of dying. I've seen that on a surf speed-run server before.

This should do it.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#pragma semicolon true


public plugin_init() {
    
register_plugin("Plugin""v1.0.0""Author");
    
    
RegisterHam(Ham_TakeDamage"player""Player_TakeDamage"false);
}


public 
Player_TakeDamage(thisiInflictoriAttackerFloatfDamagebitsDamageType) {
    if(!
is_user_connected(this)) { // Sanity check
        
return HAM_IGNORED;
    }
    
    if(
bitsDamageType DMG_FALL && fDamage >= pev(thispev_health)) {
        
ExecuteHamB(Ham_CS_RoundRespawnthis);
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

klippy is offline
Sn3amtz
Senior Member
Join Date: Jan 2015
Location: France
Old 01-08-2016 , 10:02   Re: falldamage
Reply With Quote #7

Thank you very much!
Sn3amtz 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 09:32.


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