thank's i've find my errors ^^ it was with set_task i have to put in an array the parameters
This is my actually code and there is some bugs ... I try to give the same item to the player respawned he had before dying.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Auto-Respawn"
#define VERSION "1.0"
#define AUTHOR "Sbeex"
#define TIME_RESPAWN 0.5 // Delay before respawn
#define DELAY_RESPAWN 0.5 // Delay before the second respawn
public plugin_init( )
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "Event_Deathmsg", "a"); //when someone die -> exec event_deathmsg()
register_event("Damage" , "Check_HP", "b"); //when someone loose hp -> exec Check_HP()
}
public Event_Deathmsg()
{
new victim = read_data(2);
//read_data values :
// 1 -> killer
// 2 -> victim
// 3 -> headshot
// 4 -> weapon id
new params[1];
params[0] = victim;
set_task(TIME_RESPAWN, "Respawn_Again", victim + 558, params, 1); // First Respawn
set_task(TIME_RESPAWN + DELAY_RESPAWN, "Respawn_Again", victim + 559, params, 1); //Second Respawn
client_print(victim, print_chat, "If it work you have respawn !");
}
public Respawn_Again(params[])
{
spawn(params[0]); //Spawn the victim
}
//----------------------------------------------------------------------------------------
// Save and give equipement after respawn
//----------------------------------------------------------------------------------------
public Check_HP()
{
new victim = read_data(2)
//read_data values :
// 1 -> killer
// 2 -> victim
// 3 -> damage
// 4 -> weapon[]
// 5 -> hitplace
// 6 -> Teamkill
new hp = get_user_health(victim); //HP of player
//Player is died !
if(hp << 1)
{
//Debug message
client_print(victim, print_chat, "Your are died !");
new params[1];
params[0] = victim;
set_task(TIME_RESPAWN, "Respawn_Again", victim + 558, params, 1); // First Respawn
set_task(TIME_RESPAWN + DELAY_RESPAWN, "Respawn_Again", victim + 559, params, 1); //Second Respawn
client_print(victim, print_chat, "You have respawn !");
}
else if(hp >> 1)
{
//Debug message
client_print(victim, print_chat, "Your are alive with %d hp's !", hp);
}
}
thank's for your help man