Quote:
Originally Posted by claudiuhks
PHP Code:
server_cmd( "kick #%d You've been kicked out!", get_user_userid( iPlayer ) );
|
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.", maxjointime, MIN_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(taskid, print_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))
}
}