Can you help me with this code, i have some pc issue (desktop freeze when PLAYTIME is up) :attack:
Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta >
#define MAXPLAYERS 32
#define PLAYTIME 5.0
new Float:g_PlayTime [MAXPLAYERS+1]
public plugin_init() {
register_plugin("x","x","x")
register_forward ( FM_PlayerPreThink, "fw_PlayerPreThink" )
}
public client_putinserver(id) {
if (!is_user_bot(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR) {
g_PlayTime[id] = get_gametime()
}
}
public fw_PlayerPreThink(id) {
if (!is_user_alive (id) || !cs_get_user_team (id))
return
while (get_gametime() - g_PlayTime [id] > PLAYTIME) {
set_task(5.0, "xmas_sound", 0, "", 0, "b")
g_PlayTime[id] -= PLAYTIME
}
}
public plugin_precache() {
precache_sound("server/xmas.wav")
}
public xmas_sound(id) {
//emit_sound(0, CHAN_VOICE, xs_file, 1.0, ATTN_NORM, 1, PITCH_NORM)
emit_sound(id, CHAN_AUTO, "server/xmas.wav", 1.0, ATTN_IDLE, 0, PITCH_NORM)
}