Raised This Month: $ Target: $400
 0% 

Kill Distance Plugin Error Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-15-2013 , 10:21   Kill Distance Plugin Error Help
Reply With Quote #1

PHP Code:
L 07/15/2013 10:18:32Invalid player id 0
L 07
/15/2013 10:18:32: [AMXXDisplaying debug trace (plugin "kill-distance.amxx")
L 07/15/2013 10:18:32: [AMXXRun time error 10native error (native "get_user_origin")
L 07/15/2013 10:18:32: [AMXX]    [0kill-distance.sma::Event_Death (line 70)
L 07/15/2013 10:42:55Invalid player id 142
L 07
/15/2013 10:42:55: [AMXXDisplaying debug trace (plugin "kill-distance.amxx")
L 07/15/2013 10:42:55: [AMXXRun time error 10native error (native "get_user_origin")
L 07/15/2013 10:42:55: [AMXX]    [0kill-distance.sma::Event_Death (line 70
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
new g_maxplayers

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

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 )           //<--- Error Shown Here
    
get_user_originiVictimIDorigin2 )

    new 
distance get_distance(origin1,origin2)
    new 
distance1 =(distance/modMeter)

    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" ) == ) {
            
//client_print(iAttackerID,print_chat, "You have killed %s from a distance of %d meter", name2,distance1)
                
colored_print(iAttackerID"^x03 You have killed ^x04 %s ^x03 from a distance of ^x04 %d meter"name2,floatround(distance1))
            
//client_print(iVictimID,print_chat, "Killed by %s from a distance of %d meter", name,distance1)
                
colored_print(iVictimID"^x03 Killed by ^x04 %s ^x03 from a distance of ^x04 %d meter"name,floatround(distance1))
        }
    }
    
    return 
PLUGIN_CONTINUE
}

// Colored print by MeRcyLeZZ
colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscountg_msgSayText
    argscount 
numargs()
    
g_msgSayText get_user_msgid("SayText")
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

devilicioux is offline
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 07-15-2013 , 10:28   Re: Kill Distance Plugin Error Help
Reply With Quote #2

Try now...
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
new g_maxplayers

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

public 
Event_Death(id) {
    new 
iAttackerID read_data(1);
    new 
iVictimID read_data(2)

    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 )           //<--- Error Shown Here
    
get_user_originiVictimIDorigin2 )

    new 
distance get_distance(origin1,origin2)
    new 
distance1 =(distance/modMeter)

    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" ) == ) {
            
//client_print(iAttackerID,print_chat, "You have killed %s from a distance of %d meter", name2,distance1)
                
colored_print(iAttackerID"^x03 You have killed ^x04 %s ^x03 from a distance of ^x04 %d meter"name2floatround(distance1))
            
//client_print(iVictimID,print_chat, "Killed by %s from a distance of %d meter", name,distance1)
                
colored_print(iVictimID"^x03 Killed by ^x04 %s ^x03 from a distance of ^x04 %d meter"name,floatround(distance1))
        }
    }
    
    return 
PLUGIN_CONTINUE
}

// Colored print by MeRcyLeZZ
colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscountg_msgSayText
    argscount 
numargs()
    
g_msgSayText get_user_msgid("SayText")
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

__________________
I Hate people who can hate me !

Last edited by K1d0x; 07-15-2013 at 10:32.
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-15-2013 , 11:06   Re: Kill Distance Plugin Error Help
Reply With Quote #3

TYSM
devilicioux 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 06:31.


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