AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawn a player + switch (https://forums.alliedmods.net/showthread.php?t=307470)

SomewhereLost 05-11-2018 13:26

Spawn a player + switch
 
Hello there,

What Im trying to do here is to make CT's who died to respawn back as CT's

PHP Code:

public eventDeathMsg()
{
    new 
iKiller read_data), iVictim read_data);
    
    
g_bAliveiVictim ] = false;
    
    if( 
cs_get_user_teamiVictim ) == CS_TEAM_T )
    {
        if( 
get_pcvar_numg_pDeathmatch ) )
        {
            if( 
iKiller != iVictim )
            {
                
cs_set_user_teamiVictimCS_TEAM_CT );
                
                if( 
iKiller )
                {
                    
MakeHiderDmiKiller );
                }
                
                else
                {
                    new 
iPlayers32 ], iNumiCT;
                    
get_playersiPlayersiNum"ae""CT" );
                    
                    
iCT iNum iPlayersrandomiNum ) ] : 0;
                    
                    new 
iTsiCTs;
                    
GetPlayersiTsiCTs );
                    
                    if( 
iCT && iTs iCTs )
                    {
                        
MakeHiderDmiCT );
                        
                        
GreenPrintiCT"You got transfered to terrorist!" );
                    }
                }
            }
            
            
// No proper event for checking timelimit, doing here.
            
if( get_pcvar_numg_pHalfWayVote ) && get_pcvar_numg_pVoteGameType ) )
            {
                if( 
g_iMapMiddleTime get_gametime() && !g_bSecondVote )
                {
                    
g_bSecondVote true;
        
                    
taskTypeVote();
                }
            }
        
            
            
set_task2.5"taskRespawn"iVictim TASK_RESPAWN );
        }
        
        else if( 
get_pcvar_numg_pNewNades ) && g_bStarted )
        {
            new 
iPlayers32 ], iNum;
            
get_playersiPlayersiNum"ae""TERRORIST" );
            
            if( 
iNum == )
            {
                
show_menuiPlayers], MENU_KEYSg_szNadeMenu5"NadesMenu" );
            }
        }
    }
    
    else if( 
cs_get_user_teamiVictim ) == CS_TEAM_CT && g_iTimer )
    {
        
entity_set_intiVictimEV_INT_flagsentity_get_intiVictimEV_INT_flags ) & ~FL_FROZEN );
                
        
MakeScreenFadeiVictim);
    }


Apparently I managed to fix that part but the plugin needs to be in a debug mode which causes loads of logs.

Also the switching method is kinda not working too, basically if any T dies, a random CT is switched to terrorists, thats how it is supposed to work.

If anyone could help, appreciated.


All times are GMT -4. The time now is 04:35.

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