This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Knife Distance Meter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
administratora
Member
Join Date: Mar 2015
Old 04-20-2017 , 08:56   Knife Distance Meter
Reply With Quote #1

Can someone share that plugin? When somebody stab you or slash you, you get a message in chat Player killed you from 1.58m. and he gets a message You killed Player1 from 1.58m. There is a plugin similar to that one but it shows the kill in units and in a hud

Last edited by administratora; 04-20-2017 at 08:59.
administratora is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 04-20-2017 , 10:42   Re: Knife Distance Meter
Reply With Quote #2

Test
Code:
#include < amxmodx > #include < fakemeta > #include < hamsandwich > public plugin_init( ) {     register_plugin( "Knife Kill Distance", "1.0", "DoNii" ) ;     RegisterHam( Ham_Killed, "player", "fw_HamKilledPost", 1 ) ; } public fw_HamKilledPost( victim, attacker, shouldgib ) {     if( ! is_user_connected( attacker ) || ! is_user_connected( victim ) )     return HAM_IGNORED ;     if( get_user_weapon( attacker ) != CSW_KNIFE )     return HAM_IGNORED ;     new szName[ 32 ], Float:fVictimOrigin[ 3 ], Float:fAttackerOrigin[ 3 ], Float:fDistance ;     get_user_name( attacker, szName, charsmax( szName ) ) ;     pev( victim, pev_origin, fVictimOrigin ) ;     pev( attacker, pev_origin, fAttackerOrigin ) ;         fDistance = get_distance_f( fAttackerOrigin, fVictimOrigin ) ;     fDistance *= 0.0254 ;         client_print( victim, print_chat, "Player %s Knifed You From a Distance of %d Meter%s", fDistance, fDistance != 1 ? "s" : "" ) ;     client_print( attacker, print_chat, "You Killed %s From a Distance of %d Meter%s", fDistance, fDistance != 1 ? "s" : "" ) ;         return HAM_IGNORED ; }
__________________

Last edited by edon1337; 04-20-2017 at 10:42.
edon1337 is offline
administratora
Member
Join Date: Mar 2015
Old 04-20-2017 , 11:29   Re: Knife Distance Meter
Reply With Quote #3

You Killed lololo From a Distance of 1066842124 Meters
administratora is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 04-20-2017 , 13:23   Re: Knife Distance Meter
Reply With Quote #4

Code:
#include < amxmodx > #include < fakemeta > #include < hamsandwich > public plugin_init( ) {     register_plugin( "Knife Kill Distance", "1.0", "DoNii" ) ;     RegisterHam( Ham_Killed, "player", "fw_HamKilledPost", 1 ) ; } public fw_HamKilledPost( victim, attacker, shouldgib ) {     if( ! is_user_connected( attacker ) || ! is_user_connected( victim ) )     return HAM_IGNORED ;     if( get_user_weapon( attacker ) != CSW_KNIFE )     return HAM_IGNORED ;     new szNameAttacker[ 32 ], szNameVictim[ 32 ], Float:fVictimOrigin[ 3 ], Float:fAttackerOrigin[ 3 ], Float:fDistance ;     get_user_name( attacker, szNameAttacker, charsmax( szNameAttacker ) ) ;     get_user_name( victim, szNameVictim, charsmax( szNameVictim ) ) ;     pev( victim, pev_origin, fVictimOrigin ) ;     pev( attacker, pev_origin, fAttackerOrigin ) ;         fDistance = get_distance_f( fAttackerOrigin, fVictimOrigin ) ;     fDistance *= 0.0254 ;         client_print( victim, print_chat, "Player %s Knifed You From a Distance of %d Meter%s", szNameAttacker, floatround( fDistance ), floatround( fDistance ) != 1 ? "s" : "" ) ;     client_print( attacker, print_chat, "You Knifed %s From a Distance of %d Meter%s", szNameVictim, floatround( fDistance ), floatround( fDistance ) != 1 ? "s" : "" ) ;         return HAM_IGNORED ; }
__________________

Last edited by edon1337; 04-21-2017 at 07:32.
edon1337 is offline
administratora
Member
Join Date: Mar 2015
Old 04-21-2017 , 02:54   Re: Knife Distance Meter
Reply With Quote #5

Works but
PHP Code:
    client_printvictimprint_chat"Player %s Knifed You From a Distance of %d Meter%s"floatroundfDistance ),  floatroundfDistance ) != "s" "" ) ;
    
client_printattackerprint_chat"You Killed %s From a Distance of %d Meter%s"floatroundfDistance ),  floatroundfDistance ) != "s" "" ) ; 
for the victim I add , szName, but for the attacker is an empty space for %s, and I have seen other plugins that detects to the second number after , (for example 1.53 meters or 2.13 meters)
administratora is offline
administratora
Member
Join Date: Mar 2015
Old 04-21-2017 , 03:19   Re: Knife Distance Meter
Reply With Quote #6

look like this http://imgur.com/Vqi5F1c
administratora is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 04-21-2017 , 07:32   Re: Knife Distance Meter
Reply With Quote #7

Edited, the names are fixed, about the decimals I don't know sorry.
__________________
edon1337 is offline
administratora
Member
Join Date: Mar 2015
Old 04-21-2017 , 08:32   Re: Knife Distance Meter
Reply With Quote #8

Thank you ! Idk but when I do it %.2f instead of %d it shows 0.00 only but with .00 maybe that will help u ?

Last edited by administratora; 04-21-2017 at 09:19.
administratora is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 04-21-2017 , 09:34   Re: Knife Distance Meter
Reply With Quote #9

You're right. Try this.
Code:
#include < amxmodx > #include < fakemeta > #include < hamsandwich > public plugin_init( ) {     register_plugin( "Knife Kill Distance", "1.0", "DoNii" ) ;     RegisterHam( Ham_Killed, "player", "fw_HamKilledPost", 1 ) ; } public fw_HamKilledPost( victim, attacker, shouldgib ) {     if( ! is_user_connected( attacker ) || ! is_user_connected( victim ) )     return HAM_IGNORED ;     if( get_user_weapon( attacker ) != CSW_KNIFE )     return HAM_IGNORED ;     new szNameAttacker[ 32 ], szNameVictim[ 32 ], Float:fVictimOrigin[ 3 ], Float:fAttackerOrigin[ 3 ], Float:fDistance, Float:iDistance ;     get_user_name( attacker, szNameAttacker, charsmax( szNameAttacker ) ) ;     get_user_name( victim, szNameVictim, charsmax( szNameVictim ) ) ;     pev( victim, pev_origin, fVictimOrigin ) ;     pev( attacker, pev_origin, fAttackerOrigin ) ;         fDistance = get_distance_f( fAttackerOrigin, fVictimOrigin ) ;         iDistance = fDistance * 0.0254 ;         client_print( victim, print_chat, "Player %s Knifed You From a Distance of %.2f Meter%s", szNameAttacker, iDistance, iDistance != 1 ? "s" : "" ) ;     client_print( attacker, print_chat, "You Knifed %s From a Distance of %.2f Meter%s", szNameVictim, iDistance, iDistance != 1 ? "s" : "" ) ;         return HAM_IGNORED ; }
__________________

Last edited by edon1337; 04-21-2017 at 09:38.
edon1337 is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-21-2017 , 10:10   Re: Knife Distance Meter
Reply With Quote #10

Quote:
Originally Posted by administratora View Post
That picture is from Global Knife, no?
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
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 07:18.


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