well my problem is that I want to use the timer, but instead of setting it correctly, I feel that the "set_task(3.0, "powerCharged", id)" makes it work badly and does not count the time correctly
PHP Code:
new HeroTimer[SH_MAXSLOTS+1]
public plugin_init()
{
// LOOP
set_task(1.0,"ssjgohan_loop",0,"",0,"b")
}
// RESPOND TO KEYDOWN
public ssjgohan_kd()
{
HeroTimer[id] = get_cvar_num("ssjgohan_cooldown")
if ( gPlayerUltimateUsed[id] ) {
playSoundDenySelect(id)
ssjgohan_loop()
return PLUGIN_HANDLED
}
// Set some variables
g_usingPower[id] = true
g_powerKeyUsed[id] = true
g_chargeOver[id] = false
emit_sound(id, CHAN_STATIC, "shmod/ssjgohan_kamehame.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// Show a progress bar for time til charge is full
progressBar(id, 3)
// Must wait for full bar time/sound til power can be used, this task will set it ok
set_task(3.0, "powerCharged", id)
return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public ssjgohan_loop()
{
if (!shModActive()) return
for ( new id = 1; id <= SH_MAXSLOTS; id++ ) {
if ( g_hasSSJGohan[id] && is_user_alive(id) ) {
if (HeroTimer[id] > 0 ) {
HeroTimer[id]--
if (gPlayerUltimateUsed[id] && HeroTimer[id] < 4){
set_hudmessage(0, 100, 200, 0.05, 0.70, 1, 0.1, 2.0, 0.1, 0.1, 89)
show_hudmessage(id, "La Habilidad de [%s] estara lista en: %d segundos.", g_heroName, HeroTimer[id])
}
}
}
}
}
public powerCharged(id)
{
g_chargeOver[id] = true
}