View Single Post
tcPane
Senior Member
Join Date: Sep 2010
Old 04-28-2012 , 04:53   Re: server_cmd message without "
Reply With Quote #5

Quote:
Originally Posted by claudiuhks View Post
PHP Code:
server_cmd"kick #%d  You've been kicked out!"get_user_useridiPlayer ) ); 
Works, Thanks.
I want to make some changes. There is some bugs in this code. Can someone fix this code?

PHP Code:
#include <amxmodx>

const TASK_CHECK 2707

#define WARNING_TIME 30
#define MIN_AFK_TIME 35
#define CHECK_MESSAGE 5

new g_jointime[33]

public 
plugin_init() 
{
    
register_clcmd("joinclass""cmdJoinClass")
    
register_cvar("mp_jointime""120")
    
    
set_task(float(CHECK_MESSAGE),"Task_Check",_,_,_,"b")
}

public 
client_putinserver(id)
{
    new 
start get_cvar_num("mp_jointime")
    
set_task(start"Task_Check"id+TASK_CHECK)
}

public 
cmdJoinClass(id)
    
remove_task(id+TASK_CHECK)
    
public 
Task_Check(taskid)
{
    new 
maxjointime get_cvar_num("mp_jointime")
    
    if(
maxjointime MIN_AFK_TIME
    {
        
log_amx("cvar mp_jointime %i is too low. Minimum value is %i."maxjointimeMIN_AFK_TIME)
        
maxjointime MIN_AFK_TIME
        set_cvar_num
("mp_jointime"MIN_AFK_TIME)
    }
        
    if(
maxjointime-WARNING_TIME <= g_jointime[taskid] < maxjointime
    {
        new 
timeleft maxjointime g_jointime[taskid]
        
client_print(taskidprint_chat"You have %i seconds to join a team or you will be kicked."timeleft)
    } 
    else if (
g_jointime[taskid] > maxjointime
    {
        
//new name[32]
        //get_user_name(id, name, 31)
        //client_print(0, print_chat, "%s was kicked for failure to join a team within 2 minutes.", name)
        //log_amx("%s was kicked for failure to join a team within 2 minutes.", name)
        
server_cmd("kick #%d  Failure to join a team within 2 minutes."get_user_userid(taskid-TASK_CHECK))
    } 


Last edited by tcPane; 04-28-2012 at 04:53.
tcPane is offline