If I want to add more time instead of "6" I should change it here right?
PHP Code:
DeadCount[id] += 1
client_print(id, print_center, "You will respawn after [%i] seconds", floatround(DeadCount[id]*6.0))
set_task(DeadCount[id]*6.0, "Respawn", id+TASK_SPAWN)
And how can I add a hud with a counter regressive respawn. (Sorry if I ask too much)
OK so I made a small modification
1. You can change the respawn time multiply by changing SPAWN DELAY
Code:
#define SPAWN_DELAY 6 //Change this
2. Adding the Hud Message
3. Fix the bug where player still in respawn state (the timer still counting down and will respawn after that) event after starting a new round
Full Code
Spoiler
PHP Code:
//* Sublime AMXX Editor v2.2 */
#include <amxmodx>
#include <hamsandwich>
#define PLUGIN "Respawn"
#define VERSION "1.0"
#define AUTHOR "Celena Luna"
public Respawn(taskid)
{
new id = taskid - TASK_SPAWN
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
public Task_RespawnHUD(taskid)
{
new id = taskid - TASK_SPAWN
if(g_DeadTimer[id] <= 0)
{
remove_task(taskid)
return
}
set_hudmessage(255, 0, 0, -1.0, 0.33, 0, 1.0, 1.0) //Parameter: Red, Green, Blue, X, Y, Effect Style, Effect Time, Hold Time
show_hudmessage(id, "You will respawn in %i second(s)", g_DeadTimer[id])
g_DeadTimer[id]--
}