Raised This Month: $ Target: $400
 0% 

fix plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Niceone
Junior Member
Join Date: Apr 2015
Old 05-17-2015 , 17:47   fix plugin
Reply With Quote #1

hi guys

I found this plugin

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() 
{
    
register_plugin("cfg""1.0""x")

    
RegisterHam(Ham_Killed"player""killed_player")
}
 
 
public 
killed_player(victimattacker)
{
    new 
Float:vorigin[3], Float:aorigin[3];
 
    
pev(victimpev_originvorigin)
    
pev(attackerpev_originaorigin)
 
    if(
fm_get_distance(voriginaorigin) > 2)
    {
        new 
name[32];
        
get_user_name(attackername31)
        
server_cmd("kick #%d ^"You killed from more than 2 meters distance.^""get_user_userid(attacker)) 
        
client_print(0print_chat"%s have knife cfg."name)
    }
}
 
 
Float:fm_get_distance(Float:origin1[3], Float:origin2[3])
{
    new 
Float:rdistance get_distance_f(origin1origin2)
    return(
rdistance*0.0254)

good plugin but has 2 errors
1- kicked the detected players not working
2- the plugin send name of the server in chat Instead of detected player name

can someone fix it ? not hard i think
Niceone is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 05-18-2015 , 02:00   Re: fix plugin
Reply With Quote #2

Because the attacker can be the world

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() {
    
register_plugin("cfg""1.0""x");

    
RegisterHam(Ham_Killed"player""killed_player");
}
 
public 
killed_player(victimattacker) {
    if (!
is_user_connected(attacker))
        return 
HAM_IGNORED;

    static 
Float:vorigin[3], Float:aorigin[3];
 
    
pev(victimpev_originvorigin);
    
pev(attackerpev_originaorigin);
 
    if(
fm_get_distance(voriginaorigin) > 2)
    {
        new 
name[32];
        
get_user_name(attackername31);
        
server_cmd("kick #%d ^"You killed from more than 2 meters distance.^""get_user_userid(attacker));
        
client_print(0print_chat"%s have knife cfg."name);
    }

    return 
HAM_IGNORED;
}
 
 
Float:fm_get_distance(Float:origin1[3], Float:origin2[3]) {
    new 
Float:rdistance get_distance_f(origin1origin2);
    return(
rdistance*0.0254);

__________________
simanovich is offline
Niceone
Junior Member
Join Date: Apr 2015
Old 05-18-2015 , 11:21   Re: fix plugin
Reply With Quote #3

Quote:
Originally Posted by simanovich View Post
Because the attacker can be the world

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init() {
    
register_plugin("cfg""1.0""x");

    
RegisterHam(Ham_Killed"player""killed_player");
}
 
public 
killed_player(victimattacker) {
    if (!
is_user_connected(attacker))
        return 
HAM_IGNORED;

    static 
Float:vorigin[3], Float:aorigin[3];
 
    
pev(victimpev_originvorigin);
    
pev(attackerpev_originaorigin);
 
    if(
fm_get_distance(voriginaorigin) > 2)
    {
        new 
name[32];
        
get_user_name(attackername31);
        
server_cmd("kick #%d ^"You killed from more than 2 meters distance.^""get_user_userid(attacker));
        
client_print(0print_chat"%s have knife cfg."name);
    }

    return 
HAM_IGNORED;
}
 
 
Float:fm_get_distance(Float:origin1[3], Float:origin2[3]) {
    new 
Float:rdistance get_distance_f(origin1origin2);
    return(
rdistance*0.0254);

thank you errors fixed !
Niceone 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 20:01.


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