Raised This Month: $ Target: $400
 0% 

help editing hpk


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 10-08-2006 , 05:02   help editing hpk
Reply With Quote #1

hi, i modifi hpk plugin . i implement humessage, compiler works . i implement ping status but compiler doesent works. please repair code
Code:
// New hpk

#include <amxmodx>


new HIGHPING_MAX = 200 // set maximal acceptable ping
new HIGHPING_TIME = 15  // set in seconds frequency of ping checking
new HIGHPING_TESTS = 8  // minimal number of checks before doing anything

new iNumTests[33]

public plugin_init() {
    register_plugin("High Ping Kicker","1.2.0","k")
    if (HIGHPING_TIME < 15) HIGHPING_TIME = 15
    if (HIGHPING_TESTS < 4) HIGHPING_TESTS = 4
    return PLUGIN_CONTINUE
}

public client_disconnect(id) {
    remove_task(id)
    return PLUGIN_CONTINUE
}
    
public client_putinserver(id) {
    iNumTests[id] = 0
    if (!is_user_bot(id)) {
        new param[1]
        param[0] = id
        set_task(30.0, "showWarn", id, param, 1)
    }
    return PLUGIN_CONTINUE
}

kickPlayer(id) {
    new name[32]
    get_user_name(id, name, 31)
    new uID = get_user_userid(id)
    get_user_ping ( index, &ping, &loss )
    new uPING = get_user_ping(&ping)
    server_cmd("banid 1 #%d", uID)
    client_cmd(id, "echo ^"[HPK] SOrry but you have lag^"; disconnect")
    client_print(0, print_center, "[HPK] %s disconnected ! %ping over than %dms", name,&ping,HIGHPING_MAX)
    
    set_hudmessage(23, 243, 00, 0.05, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
    show_hudmessage(0, "[HPK] %s disconnected! %ping over than %dms",name, &ping, HIGHPING_MAX)

    return PLUGIN_CONTINUE
} 

public checkPing(param[]) {
    new id = param[0]
    if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION)) {
        remove_task(id)
        client_print(id, print_chat, "[HPK] Ping checking disabled due to immunity...")
        return PLUGIN_CONTINUE
    }
    new p, l
    get_user_ping(id, p, l)
    if (p > HIGHPING_MAX)
        ++iNumTests[id]
    else
        if (iNumTests[id] > 0) --iNumTests[id]
    if (iNumTests[id] > HIGHPING_TESTS)
        kickPlayer(id)
    return PLUGIN_CONTINUE
}

public showWarn(param[]) {
    client_print(param[0], print_chat, "[HPK] Players with ping higher than %dms will be kicked!", HIGHPING_MAX)
    set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
    return PLUGIN_CONTINUE
}
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 10-08-2006 , 09:38   Re: help editing hpk
Reply With Quote #2

PHP Code:
// New hpk

#include <amxmodx>


new HIGHPING_MAX 200 // set maximal acceptable ping
new HIGHPING_TIME 15  // set in seconds frequency of ping checking
new HIGHPING_TESTS 8  // minimal number of checks before doing anything

new iNumTests[33]

public 
plugin_init()
{
    
register_plugin("High Ping Kicker","1.2.0","k")
    if (
HIGHPING_TIME 15HIGHPING_TIME 15
    
if (HIGHPING_TESTS 4HIGHPING_TESTS 4
    
return PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
remove_task(id)
    return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    
iNumTests[id] = 0
    
if (!is_user_bot(id))
    {
        new 
param[1]
        
param[0] = id
        set_task
(30.0"showWarn"idparam1)
    }
    return 
PLUGIN_CONTINUE
}

kickPlayer(id)
{
    new 
name[32], pingloss;
    
get_user_name(idname31)
    new 
uID get_user_userid(id)
    new 
uPING get_user_ping (id,ping,loss)
    
server_cmd("banid 1 #%d"uID)
    
client_cmd(id"echo ^"[HPKSorry but you have lag^"; disconnect")
    
client_print(0print_center"[HPK] %s disconnected ! %ping over than %dms"name,uPING,HIGHPING_MAX)

    
set_hudmessage(23243000.050.6520.0210.00.010.12)
    
show_hudmessage(0"[HPK] %s disconnected! %ping over than %dms",nameuPINGHIGHPING_MAX)

    return 
PLUGIN_CONTINUE
}

public 
checkPing(param[])
{
    new 
id param[0]
    if ((
get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION))
    {
        
remove_task(id)
        
client_print(idprint_chat"[HPK] Ping checking disabled due to immunity...")
        return 
PLUGIN_CONTINUE
    
}
    
    new 
pl
    get_user_ping
(idpl)
    
    if (
HIGHPING_MAX)
        ++
iNumTests[id]
    else if(
iNumTests[id] > 0)
        --
iNumTests[id]
    
    if (
iNumTests[id] > HIGHPING_TESTS)
        
kickPlayer(id)
    
    return 
PLUGIN_CONTINUE
}

public 
showWarn(param[])
{
    
client_print(param[0], print_chat"[HPK] Players with ping higher than %dms will be kicked!"HIGHPING_MAX)
    
set_task(float(HIGHPING_TIME), "checkPing"param[0], param1"b")
    return 
PLUGIN_CONTINUE

SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Reply


Thread Tools
Display Modes

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 04:45.


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