Raised This Month: $ Target: $400
 0% 

JCTF spectator bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yagami
Senior Member
Join Date: Jan 2021
Old 07-18-2023 , 20:13   JCTF spectator bug
Reply With Quote #1

I have been dealing with this problem since 2018 I have never been able to solve the JCTF Capture Flag respawn problem everyone knows problem neh ? when the player dies and goes to respawn, when 1 second is missing he changes or autoteambalance changes he is as if he were a spectator but he remains alive killing everyone someone please someone help me








PHP Code:
public player_spawn(id)
{
    if(!
is_user_alive(id) || (!g_bRestarted[id] && g_bAlive[id]))
        return

    
/* make sure we have team right */

    
switch(cs_get_user_team(id))
    {
        case 
CS_TEAM_Tg_iTeam[id] = TEAM_RED
        
case CS_TEAM_CTg_iTeam[id] = TEAM_BLUE
        
default: return
    }

    
g_bAlive[id] = true
    g_bDefuse
[id] = false
    g_bBuyZone
[id] = true
    g_bFreeLook
[id] = false
    g_fLastBuy
[id] = Float:{0.00.00.00.0}

    
task_remove(id TASK_PROTECTION)
    
task_remove(id TASK_EQUIPAMENT)
    
task_remove(id TASK_DAMAGEPROTECTION)
    
task_remove(id TASK_TEAMBALANCE)
    
task_remove(id TASK_ADRENALINE)
    
task_remove(id TASK_DEFUSE)

#if FEATURE_BUY == true
    
if(!Map_Check_Cam)
    
task_set(0.1"player_spawnEquipament"id TASK_EQUIPAMENT)

#endif // FEATURE_BUY

    
task_set(0.2"player_checkVitals"id TASK_CHECKHP)

#if FEATURE_ADRENALINE == true

    
player_hudAdrenaline(id)

#endif // FEATURE_ADRENALINE

    
new iProtection get_pcvar_num(pCvar_ctf_protection)

    if(
iProtection 0)
        
player_protection(id TASK_PROTECTIONiProtection)

    
message_begin(MSG_BROADCASTgMsg_ScoreAttrib)
    
write_byte(id)
    
write_byte(0)
    
message_end()

    if(
g_bFirstSpawn[id] || g_bRestarted[id])
    {
        
g_bRestarted[id] = false
        g_bFirstSpawn
[id] = false


        
new iStartMoney = (is_user_admin(id) ? get_pcvar_num(pCvar_adm_startmoney) : get_pcvar_num(pCvar_mp_startmoney));
        if (
cs_get_user_money(id) < iStartMoney)
                
cs_set_user_money(idclamp(iStartMoneyget_pcvar_num(pCvar_mp_startmoney), 16000));
    
    }
    else if(
g_bSuicide[id])
    {
        
g_bSuicide[id] = false

        player_print
(idid"%L"id"SPAWN_NOMONEY")
    }
    else
    {
        new 
iMoney cs_get_user_money(id), iStartMoney = (is_user_admin(id) ? get_pcvar_num(pCvar_adm_startmoney) : get_pcvar_num(pCvar_mp_startmoney));
        if (
iMoney iStartMoney)
        {
            
cs_set_user_money(idmin(iStartMoney16000));
        }
        else
        {
            
cs_set_user_money(idmin(iMoney get_pcvar_num(pCvar_ctf_spawnmoney), 16000));
        }
        
// Oneliner
        // cs_set_user_money(id, min((iMoney < iStartMoney ? iStartMoney : iMoney + get_pcvar_num(pCvar_ctf_spawnmoney)), 16000));
      
}        
}

public 
player_joinTeam()
{
    new 
id read_data(1)

    if(
g_bAlive[id])
        return 

    new 
szTeam[2];
    
read_data(2szTeamcharsmax(szTeam))

    switch(
szTeam[0])
    {
        case 
'T':
        { 
            if(
g_iTeam[id] == TEAM_RED && g_bFirstSpawn[id])
            {
                new 
iRespawn get_pcvar_num(pCvar_ctf_respawntime)

                if(
iRespawn 0)
                    
player_respawn(id TASK_RESPAWNiRespawn 1)

                
task_remove(id TASK_TEAMBALANCE)
                
task_set(1.0"player_checkTeam"id TASK_TEAMBALANCE)

            }

            
g_iTeam[id] = TEAM_RED
        
}

        case 
'C':
        {
            if(
g_iTeam[id] == TEAM_BLUE && g_bFirstSpawn[id])
            {
                new 
iRespawn get_pcvar_num(pCvar_ctf_respawntime)

                if(
iRespawn 0)
                    
player_respawn(id TASK_RESPAWNiRespawn 1)

                
task_remove(id TASK_TEAMBALANCE)
                
task_set(1.0"player_checkTeam"id TASK_TEAMBALANCE)
            }

            
g_iTeam[id] = TEAM_BLUE
        
}

        case 
'U':
        {
            
g_iTeam[id] = TEAM_NONE
            g_bFirstSpawn
[id] = true
        
}

        default:
        {
            
player_screenFade(id, {0,0,0,0}, 0.00.0FADE_OUTfalse)
            
player_allowChangeTeam(id)

            
g_iTeam[id] = TEAM_SPEC
            g_bFirstSpawn
[id] = true
        
}
    }

yagami is offline
yagami
Senior Member
Join Date: Jan 2021
Old 07-20-2023 , 13:20   Re: JCTF spectator bug
Reply With Quote #3

Quote:
Originally Posted by mlibre View Post
implement this
Just put this task_think and exclude player_respawn ?
yagami is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 07-20-2023 , 14:41   Re: JCTF spectator bug
Reply With Quote #4

you have to adapt it to yours, this function has to be registered in plugin_init follow how they are called
__________________
mlibre is offline
yagami
Senior Member
Join Date: Jan 2021
Old 07-20-2023 , 15:46   Re: JCTF spectator bug
Reply With Quote #5

Quote:
Originally Posted by mlibre View Post
you have to adapt it to yours, this function has to be registered in plugin_init follow how they are called
This is going to be almost impossible for me at the moment the codes are still a bit of a mess for me, I have just learned how to do .ini.
yagami is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 07-21-2023 , 09:46   Re: JCTF spectator bug
Reply With Quote #6

in practice the teacher is born, explore the code so you understand how it works
__________________
mlibre 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:11.


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