Raised This Month: $ Target: $400
 0% 

Help please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJ Fox
BANNED
Join Date: Jun 2010
Old 04-25-2012 , 09:11   Help please
Reply With Quote #1

eai all good people?
I was testing a new method of making colored letters in plugins and actually found it but did not really work. the plugin is anti-ping, Give a look

Code:
/* AMX Mod script. 
* 
* (c) 2002-2003, OLO 
* modified by shadow
* This file is provided as is (no warranties). 
* 
* Players with immunity won't be checked 
*/ 

#include <amxmodx> 
#include <amxmisc>

new g_Ping[33]
new g_Samples[33]
new g_iMsgSayText 

public plugin_init()
{
  register_plugin("High Ping Kicker (Steam)","0.16.2","OLO/shadow")
  register_concmd("amx_hpk","cmdHpk",ADMIN_KICK,"- configures high_ping_kicker plugin")
  register_cvar("amx_hpk_ping","150")
  register_cvar("amx_hpk_check","12")
  register_cvar("amx_hpk_tests","5")
  register_cvar("amx_hpk_delay","60")
  g_iMsgSayText = get_user_msgid("SayText") 
  
  if ( get_cvar_num( "amx_hpk_check" ) < 5 ) set_cvar_num( "amx_hpk_check" , 5 )
  if ( get_cvar_num( "amx_hpk_tests" ) < 3 ) set_cvar_num( "amx_hpk_tests" , 3 )
}

public client_disconnect(id) 
  remove_task( id )

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

  if ( !is_user_bot(id) ) 
  {
    new param[1]
    param[0] = id 
    set_task( 10.0 , "showWarn" , id , param , 1 )
    
    if (get_cvar_num("amx_hpk_tests") != 0) {
	    set_task( float(get_cvar_num("amx_hpk_delay")), "taskSetting", id, param , 1)
    }
    else {	    
    	set_task( float(get_cvar_num( "amx_hpk_tests" )) , "checkPing" , id , param , 1 , "b" )
	}
	
  }
} 

public showWarn(param[])
  ChatColor( param[0] ,print_chat,"!yPessoas com ping acima de !g%d !ySerao Kikados.", get_cvar_num( "amx_hpk_ping" ) )

public taskSetting(param[]) {
	new name[32]
	get_user_name(param[0],name,31)
	set_task( float(get_cvar_num( "amx_hpk_tests" )) , "checkPing" , param[0] , param , 1 , "b" )
}

kickPlayer( id ) 
{ 
  new name[32],authid[32]
  get_user_name(id,name,31)
  get_user_authid(id,authid,31)
  ChatColor(0,print_chat,"!yO Jogador !g%s !yfoi desconectado por que seu ping estava alto!",name)
  server_cmd("kick #%d ^"[Gp'Ex] Voce foi desconectado por que seu ping passou de 150 !^"",get_user_userid(id))
  log_amx("Highpingkick: ^"%s<%d><%s>^" was kicked due highping (Average Ping ^"%d^")", name,get_user_userid(id),authid,(g_Ping[id] / g_Samples[id]))
}

public checkPing(param[]) 
{ 
  new id = param[ 0 ] 

  if ( get_user_flags(id) & ADMIN_IMMUNITY ) return

  new p, l 

  get_user_ping( id , p , l ) 

  g_Ping[ id ] += p
  ++g_Samples[ id ]

  if ( (g_Samples[ id ] > get_cvar_num( "amx_hpk_tests" )) && (g_Ping[id] / g_Samples[id] > get_cvar_num( "amx_hpk_ping" ))  )    
    kickPlayer(id) 
}

  
public cmdHpk(id,level,cid){
  if (!cmd_access(id,level,cid,1))
    return PLUGIN_HANDLED
    
  new ping[5]
  new check_arr[5]
  new tests_arr[5]
  new delay_arr[5]
  read_argv(1,ping,4)
  read_argv(2,check_arr,4)
  read_argv(3,tests_arr,4)
  read_argv(4,delay_arr,4)
  
  new check = str_to_num(check_arr)
  new tests = str_to_num(tests_arr)
  new delay = str_to_num(delay_arr)
  
  
  if ( check < 5 ) check = 5
  if ( tests < 3 ) tests = 3
  

  if (read_argc() > 1){
    set_cvar_string("amx_hpk_ping",ping)
  }
  if (read_argc() > 2) {
	set_cvar_num("amx_hpk_check",check)
  }
  if (read_argc() > 3) {
	set_cvar_num("amx_hpk_tests",tests)
  }
  if (read_argc() > 4) {
	  set_cvar_num("amx_hpk_delay",delay)
 }

  console_print(id,"Syntax: amx_hpk <ping to get kicked> <checks before kicks> <time between checks> <delay before first check in sec.>")
  console_print(id,"Current High_Ping_Kicker Settings:")
  console_print(id,"Maxping: %d  Time between checks: %d Checkcount: %d Delay: %d",get_cvar_num("amx_hpk_ping"),get_cvar_num("amx_hpk_check"),get_cvar_num("amx_hpk_tests"),get_cvar_num("amx_hpk_delay"))
  return PLUGIN_HANDLED    
}

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!g", "^4") // Green Color
    replace_all(msg, 190, "!y", "^1") // Default Color
    replace_all(msg, 190, "!team", "^3") // Team Color
    replace_all(msg, 190, "!team2", "^0") // Team2 Color
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
		message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, players[i])  
		write_byte(players[i]);
		write_string(msg);
		message_end();
            }  
        }
    }
}
The error is this

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/tmp/text29E0FU.sma(56) : error 035: argument type mismatch (argument 2)
/tmp/text29E0FU.sma(69) : error 035: argument type mismatch (argument 2)

2 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/text29E0FU.amx (compile failed).
DJ Fox is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-25-2012 , 10:19   Re: Help please
Reply With Quote #2

ChatColor( param[0] ,print_chat,"!yPessoas com ping acima de !g%d !ySerao Kikados.", get_cvar_num( "amx_hpk_ping" ) )

??

Just get the <colorchat> include...
ColorChat(index, color, const message[], any).. way easier
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 07:44.


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