Raised This Month: $ Target: $400
 0% 

Kill distance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
akefis
Junior Member
Join Date: Nov 2013
Location: France
Old 01-11-2016 , 16:21   Kill distance
Reply With Quote #1

I have try to modify this plugin for write distance in chat, and not in HUD. But I got some errors.

Code:
/*
AMXX Kill Distance

Author: Nightscream
Help: Kleenex
Version: 0.3
===============================================
Description:
If Someone kills an enemy/teammate
it will give a hud message to see from
how far you killed him in meters

made on request
http://www.amxmodx.org/forums/viewtopic.php?t=15208
===============================================
Cvars:
distance_meter		0 = Feet
			1 = Meter
			
ditance_all		0 = shows text only to killer
			1= shows text to everyone
===============================================
Tested on:
Listen server | condition-zero | Windows XP Home | amxx 1.55
===============================================
Changelog:
0.1 - Release for amxx
0.2 - Added Distance in Feet
0.3 - Added distance_all cvar so text can be showed to everyone/killer
===============================================
suggestions are always welcome
*/

#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_plugin( PLUGINNAME, VERSION, AUTHOR )
	
	register_event( "DeathMsg",  "Event_Death",  "a" ) 
	
	register_cvar( "distance_meter", "1" )
	register_cvar( "distance_all", "1" )
}

public Event_Death(id) {
	new iVictimID = read_data(2)
    	new iWeapon, iAttackerID = get_user_attacker( iVictimID, iWeapon )

    	if( !is_user_connected( iVictimID ) ) return PLUGIN_CONTINUE

    	if( !is_user_connected( iAttackerID ) || iVictimID == iAttackerID ) return PLUGIN_CONTINUE
        
	new name[33]
	new name2[33]
	get_user_name( iAttackerID, name, 32 )
	get_user_name( iVictimID, name2, 32 )
	
	new origin1[3]
	new origin2[3]
	get_user_origin( iAttackerID, origin1 )
	get_user_origin( iVictimID, origin2 )

	new distance = get_distance(origin1,origin2)
	if ( get_cvar_num( "distance_meter" ) == 0 ) {
		if ( get_cvar_num( "distance_all" ) == 1 ) {
			
			print_color(id, "%s a tué %s^na une distance de %d feet",name, name2,floatround(distance/modFeet))
		}
		if ( get_cvar_num( "distance_all" ) == 0 ) {
			
			print_color(iAttackerID, "Tu as tué %s^na une distance de %d feet", name2,floatround(distance/modFeet))
		}
	}
	if ( get_cvar_num("distance_meter") == 1 ) {
		if ( get_cvar_num( "distance_all" ) == 1 ) {
			
			print_color(id, "%s a tué %s^na une distance de %d meter",name, name2,floatround(distance/modMeter))
		}
		if ( get_cvar_num( "distance_all" ) == 0 ) {
			
			print_color(iAttackerID, "Tu as tué %s^na une distance de %d meter", name2,floatround(distance/modMeter))
		}
	}
	
	return PLUGIN_CONTINUE
}
Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// kill-distance1.sma
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(75) : er
ror 017: undefined symbol "print_color"
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(79) : er
ror 017: undefined symbol "print_color"
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(85) : er
ror 017: undefined symbol "print_color"
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(89) : er
ror 017: undefined symbol "print_color"
//
// 4 Errors.
// Could not locate output file compiled\kill-distance1.amx (compile failed).
//
// Compilation Time: 0,23 sec
// ----------------------------------------

Press enter to exit ...
akefis is offline
Perrytutoriales
Member
Join Date: Mar 2014
Old 01-11-2016 , 16:34   Re: Kill distance
Reply With Quote #2

use Client_print_color not print color
Perrytutoriales is offline
akefis
Junior Member
Join Date: Nov 2013
Location: France
Old 01-11-2016 , 17:16   Re: Kill distance
Reply With Quote #3

Quote:
Originally Posted by Perrytutoriales View Post
use Client_print_color not print color
Code:
/*
AMXX Kill Distance

Author: Nightscream
Help: Kleenex
Version: 0.3
===============================================
Description:
If Someone kills an enemy/teammate
it will give a hud message to see from
how far you killed him in meters

made on request
http://www.amxmodx.org/forums/viewtopic.php?t=15208
===============================================
Cvars:
distance_meter		0 = Feet
			1 = Meter
			
ditance_all		0 = shows text only to killer
			1= shows text to everyone
===============================================
Tested on:
Listen server | condition-zero | Windows XP Home | amxx 1.55
===============================================
Changelog:
0.1 - Release for amxx
0.2 - Added Distance in Feet
0.3 - Added distance_all cvar so text can be showed to everyone/killer
===============================================
suggestions are always welcome
*/

#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_plugin( PLUGINNAME, VERSION, AUTHOR )
	
	register_event( "DeathMsg",  "Event_Death",  "a" ) 
	
	register_cvar( "distance_meter", "1" )
	register_cvar( "distance_all", "1" )
}

public Event_Death(id) {
	new iVictimID = read_data(2)
    	new iWeapon, iAttackerID = get_user_attacker( iVictimID, iWeapon )

    	if( !is_user_connected( iVictimID ) ) return PLUGIN_CONTINUE

    	if( !is_user_connected( iAttackerID ) || iVictimID == iAttackerID ) return PLUGIN_CONTINUE
        
	new name[33]
	new name2[33]
	get_user_name( iAttackerID, name, 32 )
	get_user_name( iVictimID, name2, 32 )
	
	new origin1[3]
	new origin2[3]
	get_user_origin( iAttackerID, origin1 )
	get_user_origin( iVictimID, origin2 )

	new distance = get_distance(origin1,origin2)
	if ( get_cvar_num( "distance_meter" ) == 0 ) {
		if ( get_cvar_num( "distance_all" ) == 1 ) {
			
			Client_print_color(id, "%s a tué %s^na une distance de %d feet",name, name2,floatround(distance/modFeet))
		}
		if ( get_cvar_num( "distance_all" ) == 0 ) {
			
			Client_print_color(iAttackerID, "Tu as tué %s^na une distance de %d feet", name2,floatround(distance/modFeet))
		}
	}
	if ( get_cvar_num("distance_meter") == 1 ) {
		if ( get_cvar_num( "distance_all" ) == 1 ) {
			
			Client_print_color(id, "%s a tué %s^na une distance de %d meter",name, name2,floatround(distance/modMeter))
		}
		if ( get_cvar_num( "distance_all" ) == 0 ) {
			
			Client_print_color(iAttackerID, "Tu as tué %s^na une distance de %d meter", name2,floatround(distance/modMeter))
		}
	}
	
	return PLUGIN_CONTINUE
}
Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// kill-distance1.sma
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(75) : er
ror 017: undefined symbol "Client_print_color"
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(79) : er
ror 017: undefined symbol "Client_print_color"
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(85) : er
ror 017: undefined symbol "Client_print_color"
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance1.sma(89) : er
ror 017: undefined symbol "Client_print_color"
//
// 4 Errors.
// Could not locate output file compiled\kill-distance1.amx (compile failed).
//
// Compilation Time: 0,14 sec
// ----------------------------------------

Press enter to exit ...
It's same
akefis is offline
Perrytutoriales
Member
Join Date: Mar 2014
Old 01-11-2016 , 19:13   Re: Kill distance
Reply With Quote #4

Update your amxx mod x of version
Perrytutoriales is offline
akefis
Junior Member
Join Date: Nov 2013
Location: France
Old 01-12-2016 , 12:09   Re: Kill distance
Reply With Quote #5

I have try an another soluce

PHP Code:
/*
AMXX Kill Distance

Author: Nightscream
Help: Kleenex
Version: 0.3
===============================================
Description:
If Someone kills an enemy/teammate
it will give a hud message to see from
how far you killed him in meters

made on request
http://www.amxmodx.org/forums/viewtopic.php?t=15208
===============================================
Cvars:
distance_meter        0 = Feet
            1 = Meter
            
ditance_all        0 = shows text only to killer
            1= shows text to everyone
===============================================
Tested on:
Listen server | condition-zero | Windows XP Home | amxx 1.55
===============================================
Changelog:
0.1 - Release for amxx
0.2 - Added Distance in Feet
0.3 - Added distance_all cvar so text can be showed to everyone/killer
===============================================
suggestions are always welcome
*/

#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)
    if ( 
get_cvar_num"distance_meter" ) == ) {
        if ( 
get_cvar_num"distance_all" ) == ) {
            
client_printid"%s have killed %sfrom a distance of %d feet",namename2,floatrounddistance/modFeet ) )
        }
        if ( 
get_cvar_num"distance_all" ) == ) {
            
client_printiAttackerID"You have killed %sfrom a distance of %d feet"name2,floatrounddistance/modFeet ) )
        }
    }
    if ( 
get_cvar_num("distance_meter") == ) {
        if ( 
get_cvar_num"distance_all" ) == ) {
            
client_printid"%s have killed %sfrom a distance of %d meter",namename2,floatrounddistance/modMeter ) )
        }
        if ( 
get_cvar_num"distance_all" ) == ) {
            
client_printiAttackerID"You have killed %sfrom a distance of %d meter"name2,floatrounddistance/modMeter ) )
        }
    }
    
    return 
PLUGIN_CONTINUE

Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// kill-distance.sma
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance.sma(74) : err
or 035: argument type mismatch (argument 2)
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance.sma(77) : err
or 035: argument type mismatch (argument 2)
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance.sma(82) : err
or 035: argument type mismatch (argument 2)
// C:\Users\Enfants\Desktop\addons\amxmodx\scripting\kill-distance.sma(85) : err
or 035: argument type mismatch (argument 2)
//
// 4 Errors.
// Could not locate output file compiled\kill-distance.amx (compile failed).
//
// Compilation Time: 0,25 sec
// ----------------------------------------

Press enter to exit ...

Last edited by akefis; 01-12-2016 at 12:28.
akefis is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-12-2016 , 12:49   Re: Kill distance
Reply With Quote #6

Quote:
Originally Posted by akefis View Post
I have try an another soluce
Fixed
PHP Code:
/*
AMXX Kill Distance

Author: Nightscream
Help: Kleenex
Version: 0.3
===============================================
Description:
If Someone kills an enemy/teammate
it will give a hud message to see from
how far you killed him in meters

made on request
<a href="http://www.amxmodx.org/forums/viewtopic.php?t=15208" target="_blank">http://www.amxmodx.org/forums/viewtopic.php?t=15208</a>
===============================================
Cvars:
distance_meter        0 = Feet
            1 = Meter

ditance_all        0 = shows text only to killer
            1= shows text to everyone
===============================================
Tested on:
Listen server | condition-zero | Windows XP Home | amxx 1.55
===============================================
Changelog:
0.1 - Release for amxx
0.2 - Added Distance in Feet
0.3 - Added distance_all cvar so text can be showed to everyone/killer
===============================================
suggestions are always welcome
*/

#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_Deathid )
{
    new 
iVictimID            read_data)
    new 
iWeaponiAttackerID get_user_attackeriVictimIDiWeapon )
    
    if( !
is_user_connectediVictimID ) )
    {
        return 
PLUGIN_CONTINUE
    
}
    
    if( !
is_user_connectediAttackerID )
        || 
iVictimID == iAttackerID )
    {
        return 
PLUGIN_CONTINUE
    
}
    
    new 
name33 ]
    new 
name233 ]
    
get_user_nameiAttackerIDname32 )
    
get_user_nameiVictimIDname232 )
    
    new 
origin1]
    new 
origin2]
    
get_user_originiAttackerIDorigin1 )
    
get_user_originiVictimIDorigin2 )
    
    new 
distance get_distanceorigin1origin2 )
    
    if( 
get_cvar_num"distance_meter" ) == )
    {
        if( 
get_cvar_num"distance_all" ) == )
        {
            
client_printidprint_chat"%s have killed %sfrom a distance of %d feet"namename2floatrounddistance modFeet ) )
        }
        
        if( 
get_cvar_num"distance_all" ) == )
        {
            
client_printiAttackerIDprint_chat"You have killed %sfrom a distance of %d feet"name2floatrounddistance modFeet ) )
        }
    }
    
    if( 
get_cvar_num"distance_meter" ) == )
    {
        if( 
get_cvar_num"distance_all" ) == )
        {
            
client_printidprint_chat"%s have killed %sfrom a distance of %d meter"namename2floatrounddistance modMeter ) )
        }
        
        if( 
get_cvar_num"distance_all" ) == )
        {
            
client_printiAttackerIDprint_chat"You have killed %sfrom a distance of %d meter"name2floatrounddistance modMeter ) )
        }
    }
    
    return 
PLUGIN_CONTINUE

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size:            412 bytes
Code size:             2016 bytes
Data size:             1400 bytes
Stack/heap size:      16384 bytes; estimated max. usage=779 cells (3116 bytes)
Total requirements:   20212 bytes
Attached Files
File Type: sma Get Plugin or Get Source (kill_distance.sma - 715 views - 3.0 KB)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-24-2016 at 16:43.
addons_zz is offline
akefis
Junior Member
Join Date: Nov 2013
Location: France
Old 01-12-2016 , 13:33   Re: Kill distance
Reply With Quote #7

Thx guy !
akefis is offline
akefis
Junior Member
Join Date: Nov 2013
Location: France
Old 01-12-2016 , 14:38   Re: Kill distance
Reply With Quote #8

Thx guy.
How can put color in the sentence when I kill anyone ?
akefis is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 01-12-2016 , 14:41   Re: Kill distance
Reply With Quote #9

Update to the latest AMXX 1.8.3 and then use client_print_color.
__________________
Like my clean plugins and work?
Baws is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-12-2016 , 14:52   Re: Kill distance
Reply With Quote #10

Quote:
Originally Posted by Baws View Post
Update to the latest AMXX 1.8.3 and then use client_print_color.
That works also, but for Amx Mod 1.8.2, there is a tutorial here:
Using print color function with 'LANG_PLAYER' on Amx Mod X '1.8.2' or superior

Quote:
Originally Posted by akefis View Post
Thx guy.
How can put color in the sentence when I kill anyone ?
If you have some problem following that post there. It is compatible with Amx Mod X '1.8.2' or superior using the same source code file.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-24-2016 at 13:31. Reason: spelling fix
addons_zz 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 02:58.


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