Hello everyone, I was on my way making plugin which approach was to inform players about someone's death caused by fall damage. I've already found correct event to hook it up and the information shows just fine. However the problem appears when I want to include the distance of the lethal fall. I've made inital code however regardless of the height I'm droping off it shows just
"(1)". Without further ado, let me present my code.
PHP Code:
#include <amxmodx>
#include <colorchat>
#include <vector>
#include <fakemeta>
#define PLUGIN "Fall Info"
#define VERSION "1.6"
#define AUTHOR "Mixtaz"
new origin1[3];
new origin2[3];
new Float:modMeter = 32.00
new const Prefix[] = "GM"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event( "DeathMsg", "eDeathMsg", "a" );
register_forward(FM_CmdStart, "CmdStartPre");
}
public CmdStartPre(id, uc_handle){
new flags = pev(id, pev_flags);
if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP)) {
get_user_origin( id, origin1 );
}
if(flags & FL_ONGROUND){
get_user_origin( id, origin2 );
}
}
public eDeathMsg()
{
new iKiller = read_data(1);
new iVictim = read_data(2);
new vName[33];
get_user_name(iVictim, vName, sizeof vName - 1);
new Dystans = get_distance(origin1, origin2);
static sWeapon[16];
read_data( 4, sWeapon, sizeof( sWeapon ) - 1 );
if( !iKiller && equal( sWeapon, "world", 5 ) )
switch(random(4)){
case 0: ColorChat(0, GREEN, "[%s]^x03 %s^x01 nie zaliczyl bezpiecznego ladowania (%d).", Prefix, vName, floatround(Dystans / modMeter));
case 1: ColorChat(0, GREEN, "[%s]^x03 %s^x01 nie mial dodatkowego spadochronu (%d).", Prefix, vName, floatround(Dystans / modMeter));
case 2: ColorChat(0, GREEN, "[%s]^x03 %s^x01 zakonczyl zywot poprzez skok (%d).", Prefix, vName, floatround(Dystans / modMeter));
case 3: ColorChat(0, GREEN, "[%s]^x03 %s^x01 spadl z wysokosci (%d).", Prefix, vName, floatround(Dystans / modMeter));
}
}