Removing task waiting to call dispInfo if client disconnects before the task is executed. This fixes run time errors.

This commit is contained in:
Johnny Bergström 2005-02-21 00:31:52 +00:00
parent 3774575160
commit 7b8165fe6f
2 changed files with 16 additions and 8 deletions

View File

@ -45,8 +45,14 @@ public plugin_init() {
#if defined DISPLAY_MSG
public client_putinserver(id) {
if (is_user_bot(id))
return
set_task(15.0,"dispInfo",id)
}
public client_disconnect(id) {
remove_task(id)
}
#endif
public cmdHelp(id,level,cid) {
@ -88,8 +94,6 @@ public cmdHelp(id,level,cid) {
#if defined DISPLAY_MSG
public dispInfo(id) {
if (!is_user_connected(id))
return
client_print(id,print_chat,"%L",id,"TYPE_HELP")
new nextmap[32]
get_cvar_string("amx_nextmap",nextmap,31)

View File

@ -71,10 +71,14 @@ public plugin_init()
#if defined DISPLAY_MSG
public client_putinserver(id) {
if (get_cvar_num("amx_client_languages"))
if (get_cvar_num("amx_client_languages") && !is_user_bot(id))
set_task(10.0,"dispInfo",id)
}
public client_disconnect(id) {
remove_task(id)
}
public dispInfo(id)
{
if (get_cvar_num("amx_client_languages"))
@ -85,7 +89,7 @@ public dispInfo(id)
public cmdLang(id,level,cid) {
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new arg[3]
read_argv(1,arg,2)
@ -104,13 +108,13 @@ public cmdLang(id,level,cid) {
public cmdLangMenu(id,level,cid)
{
new buffer[3]
if (!get_cvar_num("amx_client_languages"))
{
client_print(id, print_console, "[AMXX] %L", LANG_SERVER, "LANG_MENU_DISABLED")
return PLUGIN_HANDLED
}
get_user_info(id,"lang",buffer,2)
g_menuLang[id][0] = get_lang_id(buffer)
@ -144,7 +148,7 @@ showMenu(id)
format( menuBody[len],511-len,"^n^n0. %L",id,"EXIT" )
show_menu(id,MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3,menuBody,-1,"Language Menu")
return 1
}
@ -189,7 +193,7 @@ public actionMenu(id,key) {
format(lName,63,"%L",pLang,"LANG_NAME")
client_print(id,print_chat,"%L",pLang,"SET_LANG_USER",lName)
}
return 0
}