|
Author
|
Message
|
|
AMX Mod X Moderator
|

06-26-2006
, 08:57
Re: Can you detect mouse click time..
|
#1
|
Quote:
|
Originally Posted by v3x
Well if you want to calculate it in seconds I would do something like this:
Code:
Code:
#include <amxmodx> #include <engine> new g_iSecs[33];
public client_putinserver(id) { g_iSecs[id] = 0;
if(!task_exists(id)) set_task(1.0 , "count" , id , _ , _ , "b");
} public count(id) { if(!is_user_alive(id)) { g_iSecs[id] = 0;
return;
} if(get_user_button(id) & IN_ATTACK) g_iSecs[id]++;
else if(!(get_user_button(id) & IN_ATTACK) && g_iSecs[id]) { client_print(id , print_chat , "* You held the attack button for %d second%s" , g_iSecs[id] , (g_iSecs[id] == 1) ? "" : "s");
g_iSecs[id] = 0;
} }
|
It are being memory leakish, add client_disconnect and remove_task(id)
__________________
|
|
|
|