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( 1 ), iVictim = read_data( 2 );
g_bAlive[ iVictim ] = false;
if( cs_get_user_team( iVictim ) == CS_TEAM_T )
{
if( get_pcvar_num( g_pDeathmatch ) )
{
if( iKiller != iVictim )
{
cs_set_user_team( iVictim, CS_TEAM_CT );
if( iKiller > 0 )
{
MakeHiderDm( iKiller );
}
else
{
new iPlayers[ 32 ], iNum, iCT;
get_players( iPlayers, iNum, "ae", "CT" );
iCT = iNum > 0 ? iPlayers[ random( iNum - 1 ) ] : 0;
new iTs, iCTs;
GetPlayers( iTs, iCTs );
if( iCT > 0 && iTs < iCTs )
{
MakeHiderDm( iCT );
GreenPrint( iCT, "You got transfered to terrorist!" );
}
}
}
// No proper event for checking timelimit, doing here.
if( get_pcvar_num( g_pHalfWayVote ) && get_pcvar_num( g_pVoteGameType ) )
{
if( g_iMapMiddleTime < get_gametime() && !g_bSecondVote )
{
g_bSecondVote = true;
taskTypeVote();
}
}
set_task( 2.5, "taskRespawn", iVictim + TASK_RESPAWN );
}
else if( get_pcvar_num( g_pNewNades ) && g_bStarted )
{
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum, "ae", "TERRORIST" );
if( iNum == 1 )
{
show_menu( iPlayers[ 0 ], MENU_KEYS, g_szNadeMenu, 5, "NadesMenu" );
}
}
}
else if( cs_get_user_team( iVictim ) == CS_TEAM_CT && g_iTimer > 0 )
{
entity_set_int( iVictim, EV_INT_flags, entity_get_int( iVictim, EV_INT_flags ) & ~FL_FROZEN );
MakeScreenFade( iVictim, 0 );
}
}
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.
__________________