AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Kill distance (https://forums.alliedmods.net/showthread.php?t=277580)

akefis 01-11-2016 16:21

Kill distance
 
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 ...


Perrytutoriales 01-11-2016 16:34

Re: Kill distance
 
use Client_print_color not print color

akefis 01-11-2016 17:16

Re: Kill distance
 
Quote:

Originally Posted by Perrytutoriales (Post 2382328)
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

Perrytutoriales 01-11-2016 19:13

Re: Kill distance
 
Update your amxx mod x of version

akefis 01-12-2016 12:09

Re: Kill distance
 
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 ...


addons_zz 01-12-2016 12:49

Re: Kill distance
 
1 Attachment(s)
Quote:

Originally Posted by akefis (Post 2382549)
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


akefis 01-12-2016 13:33

Re: Kill distance
 
Thx guy !

akefis 01-12-2016 14:38

Re: Kill distance
 
Thx guy.
How can put color in the sentence when I kill anyone ?

Baws 01-12-2016 14:41

Re: Kill distance
 
Update to the latest AMXX 1.8.3 and then use client_print_color.

addons_zz 01-12-2016 14:52

Re: Kill distance
 
Quote:

Originally Posted by Baws (Post 2382625)
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 (Post 2382622)
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.


All times are GMT -4. The time now is 09:27.

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