Raised This Month: $ Target: $400
 0% 

[AYUDA]Colorchat , Chatcolor native,stock


  
 
 
Thread Tools Display Modes
Author Message
Guille
Member
Join Date: Oct 2009
Location: Argentina, Bera
Old 02-27-2012 , 17:33   [AYUDA]Colorchat , Chatcolor native,stock
#1

hola tengo un problema con agregarle el chatcolor al high ping kiker. Osea lei todo el Foro de como poder Agregarlo y mi Ingles no es Tan bueno que digamos.




les dejo el php que agregue al final del plugin.

PHP Code:
stock ColorChat(const id, const input[], any:...) 

    new 
count 1players[32
    static 
msg191 
    
vformat(msg190input3
     
    
replace_all(msg190"^x01" "^1"
    
replace_all(msg190"^x03" "^3"
    
replace_all(msg190"^x04" "^4")  
     
    if (
idplayers[0] = id; else get_players(players count "ch"
    { 
    for (new 
0counti++) 
    { 
            if (
is_user_connected(players[i])) 
            { 
                
message_begin(MSG_ONE_UNRELIABLE get_user_msgid("SayText"), _players[i]) 
                
write_byte(players[i]); 
                
write_string(msg); 
                
message_end(); 
            } 
        } 
    } 

Desde ya muchas gracias por su ayuda
__________________
Sorry for my english

_________________________________


Quote:
I m noob
Guille is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 02-27-2012 , 18:15   Re: [AYUDA]Colorchat , Chatcolor native,stock
#2

Una vez que agregas el stock debes cambiar los client_print por ChatColor.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Guille
Member
Join Date: Oct 2009
Location: Argentina, Bera
Old 02-27-2012 , 18:20   Re: [AYUDA]Colorchat , Chatcolor native,stock
#3

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
Una vez que agregas el stock debes cambiar los client_print por ChatColor.
Lo puse asi y me aparece error. Intente de todas formas y como que soy cabeza hueca

PHP Code:
public showWarn(param[])
    
ColorChat,"*Players con ping alto a ^4%d sera kikeado del servidor**"get_cvar_num"amx_hpk_ping" 
__________________
Sorry for my english

_________________________________


Quote:
I m noob
Guille is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 02-27-2012 , 18:22   Re: [AYUDA]Colorchat , Chatcolor native,stock
#4

Mostrame la función completa.
__________________

Last edited by Neeeeeeeeeel.-; 02-27-2012 at 18:22.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Guille
Member
Join Date: Oct 2009
Location: Argentina, Bera
Old 02-27-2012 , 18:28   Re: [AYUDA]Colorchat , Chatcolor native,stock
#5

PHP Code:
#include <amxmodx> 
#include <amxmisc>
#include <colorchat> 

new const PLUGIN[]  = "High Ping Kicker"
new const VERSION[] = "1.0"
new const AUTHOR[]  = "Shadow/Bo0m!"

// Feel free to change this flag
#define HPK_IMMUNE ADMIN_IMMUNITY

// PCvars
new hpk_pinghpk_checkhpk_testshpk_delayhpk_immunity

new g_Ping[33]
new 
g_Samples[33]

public 
plugin_init() {

    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_concmd("amx_hpk","cmdHpk",ADMIN_CVAR,"- configures high ping kicker")

    
hpk_ping register_cvar("amx_hpk_ping","200")
    
hpk_check register_cvar("amx_hpk_check","12")
    
hpk_tests register_cvar("amx_hpk_tests","5")
    
hpk_delay register_cvar("amx_hpk_delay","60")
    
hpk_immunity register_cvar("amx_hpk_immunity","1")

    if (
get_pcvar_num(hpk_check) < 5set_pcvar_num(hpk_check,5)
    if (
get_pcvar_num(hpk_tests) < 3set_pcvar_num(hpk_tests,3)
}

public 
client_disconnect(id
    
remove_task(id)

public 
client_putinserver(id) {    
    
g_Ping[id] = 
    g_Samples
[id] = 0

    
if ( !is_user_bot(id) ) 
    {
        new 
param[1]
        
param[0] = id 
        set_task
15.0 "showWarn" id param )
    
        if (
get_pcvar_num(hpk_delay) != 0) {
            
set_taskfloat(get_pcvar_num(hpk_delay)), "taskSetting"idparam 1)
        }
        else {        
            
set_taskfloat(get_pcvar_num(hpk_check)) , "checkPing" id param "b" )
        }
    }
}

public 
showWarn(param[])
    
ColorChat,"*Players con ping alto a ^4%d sera kikeado del servidor**"get_cvar_num"amx_hpk_ping" 

public 
taskSetting(param[]) {
    new 
name[32]
    
get_user_name(param[0],name,31)
    
set_taskfloat(get_pcvar_num(hpk_check)) , "checkPing" param[0] , param "b" )
}

kickPlayer(id) { 
    new 
name[32],authid[36]
    
get_user_name(id,name,31)
    
get_user_authid(id,authid,35)
    
ColorChat("Player ^4%s fue descoenctado por ping alto",name)
    
server_cmd("kick #%d ^"Tiene demasiado Ping...^"",get_user_userid(id))
    
log_amx("HPK: ^"%s<%d><%s>^" was kicked due high ping (Average Ping ^"%d^")"name,get_user_userid(id),authid,(g_Ping[id] / g_Samples[id]))
}

public 
checkPing(param[]) { 

    if (
get_pcvar_num(hpk_tests) < 3)
        
set_pcvar_num(hpk_tests,3)

    new 
id param

    if ( 
get_user_flags(id) & HPK_IMMUNE && get_pcvar_num(hpk_immunity) == ) {
        
remove_task(id)
        
client_print(idprint_chat"[HPK] Ping checking disabled due to immunity...")
        return 
PLUGIN_CONTINUE
    
}

    new 
pingloss

    get_user_ping
(id,ping,loss

    
g_Pingid ] += ping
    
++g_Samplesid ]

    if ( (
g_Samplesid ] > get_pcvar_num(hpk_tests)) && (g_Ping[id] / g_Samples[id] > get_pcvar_num(hpk_ping))  )    
        
kickPlayer(id)

    return 
PLUGIN_CONTINUE
}

  
public 
cmdHpk(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED

    
if (read_argc() < 6) {
        
console_print(id,"Usage: amx_hpk <max ping> <total ping checks> <time between checks> <delay before starting checks> <1 to allow immunity|0 to disallow")
        
console_print(id,"Current High Ping Kicker Settings:")
        
console_print(id,"Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d",get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))
        return 
PLUGIN_HANDLED
    
}

    new 
name[32], authid[36]
    
get_user_name(id,name,31)
    
get_user_authid(id,authid,35)

    new 
ping_arg[5], check_arg[5], tests_arg[5], delay_arg[5], immune_arg[5]
    
read_argv(1,ping_arg,4)
    
read_argv(2,tests_arg,4)
    
read_argv(3,check_arg,4)
    
read_argv(4,delay_arg,4)
    
read_argv(5,immune_arg,4)
  
    new 
ping str_to_num(ping_arg)
    new 
tests str_to_num(tests_arg)
    new 
check str_to_num(check_arg)
    new 
delay str_to_num(delay_arg)
    new 
immune str_to_num(immune_arg)

    if ( 
check check 5
    
if ( tests tests 3

    set_pcvar_num
(hpk_ping,ping)
    
set_pcvar_num(hpk_tests,tests)
    
set_pcvar_num(hpk_check,check)
    
set_pcvar_num(hpk_delay,delay)
    
set_pcvar_num(hpk_immunity,immune)

    
console_print(id,"The following HPK Settings have been set:")
    
console_print(id,"Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d",get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))
    
log_amx("HPK: ^"%s<%d><%s>^" has configured the HPK - Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d"name,get_user_userid(id),authid,get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))

    return 
PLUGIN_HANDLED    
}

stock ColorChat(const id, const input[], any:...) 

    new 
count 1players[32
    static 
msg191 
    
vformat(msg190input3
     
    
replace_all(msg190"^x01" "^1"
    
replace_all(msg190"^x03" "^3"
    
replace_all(msg190"^x04" "^4")  
     
    if (
idplayers[0] = id; else get_players(players count "ch"
    { 
    for (new 
0counti++) 
    { 
            if (
is_user_connected(players[i])) 
            { 
                
message_begin(MSG_ONE_UNRELIABLE get_user_msgid("SayText"), _players[i]) 
                
write_byte(players[i]); 
                
write_string(msg); 
                
message_end(); 
            } 
        } 
    } 

lo compilo desde el Amxx - studio ya que mucho no entiendo. pero algo se. hay te puse el plugin como lo tengo yo hecho. y gracias portu ayuda
__________________
Sorry for my english

_________________________________


Quote:
I m noob
Guille is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 02-27-2012 , 18:34   Re: [AYUDA]Colorchat , Chatcolor native,stock
#6

Ahí te deje algunos ejemplos de colores.

PHP Code:
#include <amxmodx> 
#include <amxmisc> 

new const PLUGIN[]  = "High Ping Kicker"
new const VERSION[] = "1.0"
new const AUTHOR[]  = "Shadow/Bo0m!"

// Feel free to change this flag
#define HPK_IMMUNE ADMIN_IMMUNITY

// PCvars
new hpk_pinghpk_checkhpk_testshpk_delayhpk_immunity

new g_Ping[33]
new 
g_Samples[33]

public 
plugin_init() {

    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_concmd("amx_hpk","cmdHpk",ADMIN_CVAR,"- configures high ping kicker")

    
hpk_ping register_cvar("amx_hpk_ping","200")
    
hpk_check register_cvar("amx_hpk_check","12")
    
hpk_tests register_cvar("amx_hpk_tests","5")
    
hpk_delay register_cvar("amx_hpk_delay","60")
    
hpk_immunity register_cvar("amx_hpk_immunity","1")

    if (
get_pcvar_num(hpk_check) < 5set_pcvar_num(hpk_check,5)
    if (
get_pcvar_num(hpk_tests) < 3set_pcvar_num(hpk_tests,3)
}

public 
client_disconnect(id
    
remove_task(id)

public 
client_putinserver(id) {    
    
g_Ping[id] = 
    g_Samples
[id] = 0

    
if ( !is_user_bot(id) ) 
    {
        new 
param[1]
        
param[0] = id 
        set_task
15.0 "showWarn" id param )
    
        if (
get_pcvar_num(hpk_delay) != 0) {
            
set_taskfloat(get_pcvar_num(hpk_delay)), "taskSetting"idparam 1)
        }
        else {        
            
set_taskfloat(get_pcvar_num(hpk_check)) , "checkPing" id param "b" )
        }
    }
}

public 
showWarn(param[])
{
    
ColorChatparam[0],"*Players con ping alto a !g%d !ysera kikeado del servidor**"get_cvar_num"amx_hpk_ping" ) )
    
// ejemplos de colores
    
ColorChatparam[0], "!gVERDE")
    
ColorChatparam[0], "!yBLANCO" )
    
ColorChatparam[0], "!teamTEAM COLOR" )
}

public 
taskSetting(param[]) {
    new 
name[32]
    
get_user_name(param[0],name,31)
    
set_taskfloat(get_pcvar_num(hpk_check)) , "checkPing" param[0] , param "b" )
}

kickPlayer(id) { 
    new 
name[32],authid[36]
    
get_user_name(id,name,31)
    
get_user_authid(id,authid,35)
    
ColorChat("Player ^4%s fue descoenctado por ping alto",name)
    
server_cmd("kick #%d ^"Tiene demasiado Ping...^"",get_user_userid(id))
    
log_amx("HPK: ^"%s<%d><%s>^" was kicked due high ping (Average Ping ^"%d^")"name,get_user_userid(id),authid,(g_Ping[id] / g_Samples[id]))
}

public 
checkPing(param[]) { 

    if (
get_pcvar_num(hpk_tests) < 3)
        
set_pcvar_num(hpk_tests,3)

    new 
id param

    if ( 
get_user_flags(id) & HPK_IMMUNE && get_pcvar_num(hpk_immunity) == ) {
        
remove_task(id)
        
client_print(idprint_chat"[HPK] Ping checking disabled due to immunity...")
        return 
PLUGIN_CONTINUE
    
}

    new 
pingloss

    get_user_ping
(id,ping,loss

    
g_Pingid ] += ping
    
++g_Samplesid ]

    if ( (
g_Samplesid ] > get_pcvar_num(hpk_tests)) && (g_Ping[id] / g_Samples[id] > get_pcvar_num(hpk_ping))  )    
        
kickPlayer(id)

    return 
PLUGIN_CONTINUE
}

  
public 
cmdHpk(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED

    
if (read_argc() < 6) {
        
console_print(id,"Usage: amx_hpk <max ping> <total ping checks> <time between checks> <delay before starting checks> <1 to allow immunity|0 to disallow")
        
console_print(id,"Current High Ping Kicker Settings:")
        
console_print(id,"Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d",get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))
        return 
PLUGIN_HANDLED
    
}

    new 
name[32], authid[36]
    
get_user_name(id,name,31)
    
get_user_authid(id,authid,35)

    new 
ping_arg[5], check_arg[5], tests_arg[5], delay_arg[5], immune_arg[5]
    
read_argv(1,ping_arg,4)
    
read_argv(2,tests_arg,4)
    
read_argv(3,check_arg,4)
    
read_argv(4,delay_arg,4)
    
read_argv(5,immune_arg,4)
  
    new 
ping str_to_num(ping_arg)
    new 
tests str_to_num(tests_arg)
    new 
check str_to_num(check_arg)
    new 
delay str_to_num(delay_arg)
    new 
immune str_to_num(immune_arg)

    if ( 
check check 5
    
if ( tests tests 3

    set_pcvar_num
(hpk_ping,ping)
    
set_pcvar_num(hpk_tests,tests)
    
set_pcvar_num(hpk_check,check)
    
set_pcvar_num(hpk_delay,delay)
    
set_pcvar_num(hpk_immunity,immune)

    
console_print(id,"The following HPK Settings have been set:")
    
console_print(id,"Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d",get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))
    
log_amx("HPK: ^"%s<%d><%s>^" has configured the HPK - Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d"name,get_user_userid(id),authid,get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))

    return 
PLUGIN_HANDLED    
}

stock ColorChat(const id, const input[], any:...) 

    new 
count 1players[32
    static 
msg191 
    
vformat(msg190input3
     
    
replace_all(msg190"^x01" "^1"
    
replace_all(msg190"^x03" "^3"
    
replace_all(msg190"^x04" "^4")  
     
    if (
idplayers[0] = id; else get_players(players count "ch"
    { 
    for (new 
0counti++) 
    { 
            if (
is_user_connected(players[i])) 
            { 
                
message_begin(MSG_ONE_UNRELIABLE get_user_msgid("SayText"), _players[i]) 
                
write_byte(players[i]); 
                
write_string(msg); 
                
message_end(); 
            } 
        } 
    } 

__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Guille
Member
Join Date: Oct 2009
Location: Argentina, Bera
Old 02-27-2012 , 18:39   Re: [AYUDA]Colorchat , Chatcolor native,stock
#7

Esoo lo intente y solo me aparece un error. tengo otro igual al que isiste. el error es que dice :

Error : Argument type mismatch (argument 1) on line 74

No pido que hagas el plugin, Solo que me Ayude a entender que seria el argumento. asi lo ago con otros plugins que me aparece lo mismo
__________________
Sorry for my english

_________________________________


Quote:
I m noob
Guille is offline
leonard19941
Veteran Member
Join Date: Jun 2011
Old 02-27-2012 , 18:43   Re: [AYUDA]Colorchat , Chatcolor native,stock
#8

Prueba con este haber si asi te funciona.

PHP Code:
Tienes que cambiar:

client_print id print_chat "Lo que sea." )   --->   ChatColor(id"!gLo !yque !teamsea." 
PHP Code:
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

__________________
leonard19941 is offline
Guille
Member
Join Date: Oct 2009
Location: Argentina, Bera
Old 02-27-2012 , 18:53   Re: [AYUDA]Colorchat , Chatcolor native,stock
#9

Error: Undefined symbol "id" on line 57
Warning: Expression has no effect on line 57
Error: Expected token: ";", but found ")" on line 57
Error: Invalid expression, assumed zero on line 57
Error: Too many error messages on one line on line 57

con ese stock, esos errores aparece. con el otro que dijo nell me aparece solo 1 error de argumento._. igual de apoco entiendo :B
__________________
Sorry for my english

_________________________________


Quote:
I m noob
Guille is offline
Ritual
New Member
Join Date: Sep 2011
Location: Argentina
Old 02-27-2012 , 20:59   Re: [AYUDA]Colorchat , Chatcolor native,stock
#10

PHP Code:
public showWarn(param[]) 
{
    
ChatColor(id"!g*Players con ping alto a !team%d !gsera kikeado del servidor**"get_cvar_num"amx_hpk_ping" )  
}

stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }


Last edited by Ritual; 02-27-2012 at 21:00.
Ritual is offline
Send a message via MSN to Ritual Send a message via Skype™ to Ritual
 



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:36.


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