Raised This Month: $ Target: $400
 0% 

Respawn bug


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 10-27-2009 , 07:32   Respawn bug
Reply With Quote #1

It happens when u switch to spectator.Spec player its respawned,i want to know how to fix that.
So i asked for ur help.

Here is the code

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <colorchat>
#include <hamsandwich>

#define PLUGIN    "Respawn"
#define VERSION    "1.0"
#define AUTHOR    "#8 SickneSS"

/* pCvars */
new enable
new delay
new prefix

/* String */
new szPrefix[32]

/* Boolean */
new bool:respawn[33]

//====================[*REGISTRATIONS*]===========================//
public plugin_init() 
{
    
    
/* Plugin Registration */
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* Ham Registrations */
    
RegisterHam(Ham_Spawn"player""Ham_Spawn_player"1)
    
RegisterHam(Ham_Killed"player""Ham_Killed_player"1)
    
    
/* pCvar */
    
enable register_cvar("amx_respawn","1")
    
delay register_cvar("amx_respawn_delay","3")
    
prefix register_cvar("amx_prefix","[AMXX]")
    
    
/* String */
    
get_pcvar_string(prefix,szPrefix,31)
    
    
/* Commands */
    
register_clcmd("say /respawn","cmdRespawn")
    
register_clcmd("say_team /respawn","cmdRespawn")    

}

//====================[*RESPAWN*]===========================//
public client_putinserver(id
{
    
respawn[id] = false
}
//----------------------------------------------------------//
public cleint_disconnect(id
{    
    
respawn[id] = false
}
//----------------------------------------------------------//
public cmdRespawn(id
{
        
    if(
get_pcvar_num(enable) == 1)
    {
        if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR
        {
            
ColorChat(id,GREEN,"%s^x01 This command is disabled for spectators.",szPrefix)
        }
            
        if(
cs_get_user_team(id) == CS_TEAM_T || cs_get_user_team(id) == CS_TEAM_CT
        {
            
respawn[id] = !respawn[id]
            
ColorChat(idGREEN,"%s^x01 You have been %sable your respawn.",szPrefix,respawn[id] ? "en" "dis")
            
            if(!
is_user_alive(id) || respawn[id]) 
            {
                
set_task(get_pcvar_float(delay),"cmdRespawns",id)
            }
        }
    }    
    return 
PLUGIN_HANDLED
}
//----------------------------------------------------------//
public Ham_Killed_player(id
{
        
    if(
get_pcvar_num(enable) == 1)
    {
        if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR
        {
            
respawn[id] = false
        
}
        
        if(
respawn[id])
        {
            
ColorChat(idGREEN,"%s^x01 You have respawn in^x03 %d^x01 seconds.",szPrefix,get_pcvar_num(delay))
            
ColorChat(idGREEN,"%s^x01 To disable your respawn,type^x03 /respawn^x01.",szPrefix)
            
set_task(get_pcvar_float(delay),"cmdRespawns",id)
        }
        else
        {
            
ColorChat(idGREEN,"%s^x01 To enable your respawn,type^x03 /respawn^x01.",szPrefix)
            return 
HAM_IGNORED
        
}
    }
    return 
HAM_IGNORED
}
//----------------------------------------------------------//
public Ham_Spawn_player(id
{
    if(
is_user_alive(id))    
    
remove_task(id)
}
//----------------------------------------------------------//
public cmdRespawns(id
{
    if(!
is_user_alive(id)) 
    
ExecuteHamB(Ham_CS_RoundRespawn,id)

I leave u a demo with ilustration of the bug.

Sorry for my bad english,im from Argentina.
Attached Files
File Type: zip demo.zip (249.1 KB, 73 views)

Last edited by #8 SickneSS; 10-27-2009 at 09:15.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
 



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 17:38.


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