I'm using PTB...
And when spectator joins team via M menu every player kill him and he can kill anyone ( Including Teammate )...
Its using cs_set_user_team which is my other plugin using and everything works just fine,.,.
Here is transfer player code:
Code:
transferPlayer(id){
if (!is_user_connected(id)) return
if (isBeingTransfered[id]) return
isBeingTransfered[id] = false
new name[32], player_steamid[50], team_pre_transfer[12]
get_user_name(id,name,31)
get_user_authid(id, player_steamid, 49)
get_user_team(id, team_pre_transfer, 11)
if(cs_get_user_defuse(id))
cs_set_user_defuse(id, 0);
cs_set_user_team(id, (playerTeam[id]==TS) ? 2 : 1)
cs_reset_user_model(id)
// This must be done here or lastroundswithed will not be registered
lastRoundSwitched[id] = roundCounter
// This logs to hlds logs so Psychostats knows that the player has changed team (PS 3.X)
//"LAntz69<9><STEAM_0:1:1895474><TERRORIST>" joined team "CT" //This is how it will be outputted in hlds logs
log_message("^"%s<%d><%s><%s>^" joined team ^"%s^"",
name, get_user_userid(id), player_steamid, team_pre_transfer, (playerTeam[id]==TS) ? "CT" : "TERRORIST" )
if(get_pcvar_num(show_in_hlsw) == 1)
{
// This makes you able to see transfers with HLSW in the chat
log_message("^"<><><>^" triggered ^"amx_chat^" (text ^"[PTB] Transfered %s to %s^")",
name, (playerTeam[id]==TS) ? "CT" : "TERRORIST" )
}
#if defined PTB_DEBUG
log_amx("Transfer player: %s lastRoundSwitched[id]: %i roundCounter:%i", name, lastRoundSwitched[id], roundCounter)
client_print(0,print_chat,"Transfer player: %s lastRoundSwitched[id]: %i roundCounter:%i", name, lastRoundSwitched[id], roundCounter)
#endif
}
Acutally i found this:
Code:
// He is choosing the AUTO-SELECT but he was already in game (He wants to play fair!)
if (iNewTeam==AUTO_TEAM&&(iOldTeam==CTS||iOldTeam==TS)) {
//say("Changing team automatically.")
new opposingTeam = (iOldTeam==CTS) ? TS : CTS
if (teamCounts[opposingTeam] && ( (teamCounts[opposingTeam]>=PTB_MAXSIZE)
|| (iOldTeam==loserTeam) || (!loserTeam&&teamCounts[iOldTeam]<=teamCounts[opposingTeam])
|| (teamCounts[opposingTeam]+1-teamCounts[iOldTeam]>=PTB_MAXDIFF)) ) {
client_print(id,print_chat,"PTB: You have better stay in your current team...")
return PLUGIN_HANDLED
}
client_print(id,print_chat,"PTB: You have been auto-assigned...")
engclient_cmd(id,"jointeam",(opposingTeam==CTS)?"2":"1")
return PLUGIN_HANDLED
}