Raised This Month: $51 Target: $400
 12% 

respawn mod?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 05-04-2010 , 15:43   respawn mod?
Reply With Quote #1

i all im trying to make a simple respawn the thing is that sometimes when the player respawn the crossair gone with the hp, shield and round timer.

you just can't see it?

this is my code maybe u will say that's a ugly code etc etc but well i do my best if you could fix it or post a more simple code that do what im trying be welcome

PHP Code:
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
//RegisterHam( Ham_Killed , "player", "HAM_Killed" )
    
    //gmsgStatusIcon = get_user_msgid("StatusIcon");
    
    
g_pEnabled register_cvar("dm_enabled","0")
    
g_pProtection register_cvar("dm_protection","1")
    
g_pProtectionTime register_cvar("dm_protection_time","3")
    
    
g_msgid_ClCorpse get_user_msgid("ClCorpse")
    
    
register_event"TeamInfo""join_team""a");
    
register_event("DeathMsg""death_mes""a");
    
register_event("StatusIcon","GotBomb","be","1=1","1=2","2=c4");
}

public 
client_connect(id)
{
    
g_connected[id] = false
}

public 
spawnagain(id)
{
    
//Make sure he didn't disconnect in the 0.5 seconds that have passed.
    
if(is_user_connected(id))
    {
        
//Spawn player
    
spawn(id)
    
set_msg_block(g_msgid_ClCorpseBLOCK_ONCE)
    
    if ( 
get_pcvar_numg_pProtection ) == )
     {
        
set_user_godmode(id,1)
        new 
Float:protect get_pcvar_floatg_pProtectionTime )
        
set_task(protect,"stopprotect",id)
        
set_task(1.1,"giveweapon",id)
    }

        
//After 1.0 the player will be spawned fully and you can mess with the ent (give weapons etc)
        //set_task(1.0,"player_fully_spawned",id)
    
}
}

public 
giveweapon(id)
{
    if ( 
get_user_teamid ) == 
    { 
        
give_item(id,"weapon_knife"
        
give_item(id,"weapon_glock18"
        
give_item(id,"ammo_9mm"
        
give_item(id,"ammo_9mm"
        
cs_set_user_money(id,16000)
    } 
    else 
    { 
        
give_item(id,"weapon_knife"
        
give_item(id,"weapon_usp"
        
give_item(id,"ammo_45acp"
        
give_item(id,"ammo_45acp"
        
cs_set_user_money(id,16000)
    } 
}

public 
stopprotect(id)
{
    if(
is_user_alive(id))
    
set_user_godmode(id)
}

public 
check_alive(id)
{
    if(!
get_pcvar_num(g_pEnabled) || !is_user_connected(id) || is_user_alive(id)){
        return;
    }
    else
    {
        if(!
is_user_alive(id))
        {
            
set_task(1.0,"spawnagain",id)
        }
    }
}

public 
death_mes()
{
    new 
victim read_data(2);
    
    if(
get_pcvar_num(g_pEnabled))
    {
        
set_task(1.0,"check_alive",victim)
    }
    return 
PLUGIN_HANDLED;
}

public 
join_team()
{    
    new 
id read_data(1)
    static 
user_team[32]

    
read_data(2user_team31)    
    
    if(!
is_user_connected(id))
        return 
PLUGIN_CONTINUE    
    
    
switch(user_team[0])
    {
        case 
'C':  
        {        
        if(
g_connected[id] == false && get_pcvar_num(g_pEnabled)){
            
            
set_task(6.0,"check_alive",id)
            
g_connected[id] = true
        
}     
        }
            
        case 
'T'
        {
                if(
g_connected[id] == false && get_pcvar_num(g_pEnabled)){
            
            
set_task(6.0,"check_alive",id)
            
g_connected[id] = true
        
}    
        }        
    }
    return 
PLUGIN_CONTINUE
    

liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-04-2010 , 15:46   Re: respawn mod?
Reply With Quote #2

Use
Code:
ExecuteHamB( Ham_CS_RoundRespawn, 1 )

The current function you're using (spawn()) is not guarunteed to work, unless you correctly use the "fix".

If you're really bent on using spawn(), you can follow Avalanche's instructions from the AMXX Doc;
Quote:
Originally Posted by Avalanche @ AMXX Doc
People have had trouble getting this to work, the below seems to be the "correct" way to do it without any bugs:
Code:
public soandso(id) {    spawn(id);    set_task(0.5,"spawnagain",id); } public spawnagain(id) {    spawn(id); }
You can play around with the 0.5 time.
In your version, you're setting a task for spawnagain, but you're not calling the actual spawn function beforehand.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-04-2010 , 16:22   Re: respawn mod?
Reply With Quote #3

I suggest to use ham to hook the killed event and to respawn him. much better and easyer
__________________
I am out of order!
grimvh2 is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 05-04-2010 , 18:54   Re: respawn mod?
Reply With Quote #4

PHP Code:
register_event("DeathMsg""death_mes""a")

public 
death_mes(id)
{
    
ExecuteHamBHam_CS_RoundRespawn)

Something like that?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-04-2010 , 20:05   Re: respawn mod?
Reply With Quote #5

Quote:
Originally Posted by Jelle View Post
PHP Code:
register_event("DeathMsg""death_mes""a")

public 
death_mes(id)
{
    
ExecuteHamBHam_CS_RoundRespawn)

Something like that?
PHP Code:
register_event("DeathMsg""death_mes""a")

public 
death_mes()
{
    new 
victim read_data(2)

    
ExecuteHamB(Ham_CS_RoundRespawnvictim)

I think it should be something like this
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-04-2010 at 20:35.
drekes is offline
Send a message via MSN to drekes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-04-2010 , 20:36   Re: respawn mod?
Reply With Quote #6

Yep, what drekes said.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-04-2010 , 20:43   Re: respawn mod?
Reply With Quote #7

Quote:
Originally Posted by wrecked_ View Post
Yep, what drekes said.
w00t, i'm getting smarter
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-05-2010 , 07:25   Re: respawn mod?
Reply With Quote #8

Quote:
Originally Posted by drekes View Post
PHP Code:
register_event("DeathMsg""death_mes""a")

public 
death_mes()
{
    new 
victim read_data(2)
    
    if(
is_user_connected(victim))
        
ExecuteHamB(Ham_CS_RoundRespawnvictim)

I think it should be something like this
__________________
I am out of order!
grimvh2 is offline
Reply



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 11:09.


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