Raised This Month: $ Target: $400
 0% 

[Respawn] Crash my server ...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
sbeex
Member
Join Date: Sep 2005
Location: switzerland
Old 04-16-2007 , 03:32   Re: [Respawn] Crash my server ...
Reply With Quote #3

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(PLUGINVERSIONAUTHOR)
    
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 558params1);    // First Respawn
    
set_task(TIME_RESPAWN DELAY_RESPAWN"Respawn_Again"victim 559params1);    //Second Respawn
    
    
client_print(victimprint_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(victimprint_chat"Your are died !"); 
        
        new 
params[1];
        
params[0] = victim;
        
        
set_task(TIME_RESPAWN"Respawn_Again"victim 558params1);    // First Respawn
        
set_task(TIME_RESPAWN DELAY_RESPAWN"Respawn_Again"victim 559params1);    //Second Respawn        
        
client_print(victimprint_chat"You have respawn !");     
        
    }
    else if(
hp >> 1)
    {
        
//Debug message
        
client_print(victimprint_chat"Your are alive with %d hp's !"hp);             
    }    

thank's for your help man
sbeex is offline
Send a message via MSN to sbeex Send a message via Skype™ to sbeex
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode