Raised This Month: $ Target: $400
 0% 

Kill Distance Scripting Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-08-2013 , 13:45   Kill Distance Scripting Help
Reply With Quote #1

https://forums.alliedmods.net/showthread.php?t=14493

This Kill Distance plugin shows the Kill Distance after you kill .. I want the distance to be showed to the one who got killed in the same way ..
Can any1 help me out in that ?
devilicioux is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 07-08-2013 , 13:57   Re: Kill Distance Scripting Help
Reply With Quote #2

obtain their origins
PHP Code:
new Float:origin_vic[3], Float:origin_att[3]
pev(victimpev_originorigin_vic)
pev(attackerpev_originorigin_att)

// then get the distance between origins

new Float:distance get_distance_f(origin_vicorigin_att
baneado is offline
fl0werD
Senior Member
Join Date: May 2011
Old 07-08-2013 , 13:58   Re: Kill Distance Scripting Help
Reply With Quote #3

PHP Code:
new FloatflDistance entity_rangeiVictimiAttacker ); 

Last edited by fl0werD; 07-08-2013 at 13:58.
fl0werD is offline
Send a message via ICQ to fl0werD
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-08-2013 , 14:08   Re: Kill Distance Scripting Help
Reply With Quote #4

I tried that .. Dont know wheres the mistake ..

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGINNAME    "Kill Distance"
#define VERSION        "0.3"
#define AUTHOR        "Nightscream"

new Float:modMeter 32.00
new Float:modFeet 35.00

public plugin_init() {
    
register_pluginPLUGINNAMEVERSIONAUTHOR )
    
    
register_event"DeathMsg",  "Event_Death",  "a" 
    
    
register_cvar"distance_meter""1" )
    
register_cvar"distance_all""0" )
}

public 
Event_Death(id) {
    new 
iVictimID read_data(2)
        new 
iWeaponiAttackerID get_user_attackeriVictimIDiWeapon )

        if( !
is_user_connectediVictimID ) ) return PLUGIN_CONTINUE

        
if( !is_user_connectediAttackerID ) || iVictimID == iAttackerID ) return PLUGIN_CONTINUE
        
    
new name[33]
    new 
name2[33]
    
get_user_nameiAttackerIDname32 )
    
get_user_nameiVictimIDname232 )
    
    new 
origin1[3]
    new 
origin2[3]
    
get_user_originiAttackerIDorigin1 )
    
get_user_originiVictimIDorigin2 )

    new 
distance get_distance(origin1,origin2)
    new 
distance1 get_distance(origin2,origin1)
    if ( 
get_cvar_num"distance_meter" ) == ) {
        if ( 
get_cvar_num"distance_all" ) == ) {
            
set_hudmessage010000.060.806.012.00.50.5162 );
            
show_hudmessageid"%s have killed %s^nfrom a distance of %d feet",namename2,floatrounddistance/modFeet ) )
        }
        if ( 
get_cvar_num"distance_all" ) == ) {
            
set_hudmessage010000.060.806.012.00.50.5162 );
            
show_hudmessageiAttackerID"You have killed %s^nfrom a distance of %d feet"name2,floatrounddistance/modFeet ) )
        }
    }
    if ( 
get_cvar_num("distance_meter") == ) {
        if ( 
get_cvar_num"distance_all" ) == ) {
            
set_hudmessage(010000.060.806.012.00.50.5162);
            
show_hudmessageid"%s have killed %s^nfrom a distance of %d meter",namename2,floatrounddistance/modMeter ) )
        }
        if ( 
get_cvar_num"distance_all" ) == ) {
            
set_hudmessage(010000.010.2306.012.00.50.5162);
            
show_hudmessageiAttackerID"You have killed %s^nfrom a distance of %d meter"name2,floatrounddistance/modMeter ) )
            
set_hudmessage(010000.010.2306.012.00.50.5162);
            
show_hudmessageiVictimID"Killed by %s^nfrom a distance of %d meter"name,floatrounddistance1/modMeter ) )
        }
    }
    
    return 
PLUGIN_CONTINUE


Quote:
Originally Posted by baneado View Post
obtain their origins
PHP Code:
new Float:origin_vic[3], Float:origin_att[3]
pev(victimpev_originorigin_vic)
pev(attackerpev_originorigin_att)

// then get the distance between origins

new Float:distance get_distance_f(origin_vicorigin_att
devilicioux is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-10-2013 , 07:07   Re: Kill Distance Scripting Help
Reply With Quote #5

SOLVED ..
I Dunno Why Wasnt the HUD message working ..
I just changed it to coloured messages in Chat..

Thanks to MeRcyLeZZ for his coloured chat Code
devilicioux is offline
Reply


Thread Tools
Display Modes

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 06:28.


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