Hallo my fellow scripters, today i just whanted to convert biohazard cs_set_user_team with claudiu's module CS Team Changer
https://forums.alliedmods.net/showthread.php?t=163555 but i just whent in some little trouble , i will give the code for a better understand
here is before i modified
HTML Code:
/* static players[CsTeams:3][32], count[CsTeams:3], i, id, CsTeams:team
get_players(players[CS_TEAM_UNASSIGNED], count[CS_TEAM_UNASSIGNED])
count[CS_TEAM_T] = 0, count[CS_TEAM_CT] = 0
for(i = 0; i < count[CS_TEAM_UNASSIGNED]; i++)
{
id = players[CS_TEAM_UNASSIGNED][i], team = cs_get_user_team(id)
if(team == CS_TEAM_T || team == CS_TEAM_CT)
players[team][count[team]++] = id
}
if(abs(count[CS_TEAM_T] - count[CS_TEAM_CT]) <= 1) return
static maxplayers; maxplayers = (count[CS_TEAM_T] + count[CS_TEAM_CT]) / 2
if(count[CS_TEAM_T] > maxplayers)
{
for(i = 0; i < (count[CS_TEAM_T] - maxplayers); i++)
cs_set_user_team(players[CS_TEAM_T][i], CS_TEAM_CT)
}
else
{
for(i = 0; i < (count[CS_TEAM_CT] - maxplayers); i++)
cs_set_user_team(players[CS_TEAM_CT][i], CS_TEAM_T)
} */
and here are the modifications
HTML Code:
static players [ teams:3 ] [ 32 ], count [ teams: 3 ], i, id, team;
get_players ( players [ CSTEAM_UNASSIGNED ], count [ CSTEAM_UNASSIGNED ] )
count [ CSTEAM_TERRORIST ] = 0, count [ CSTEAM_CT ] = 0
for ( i = 0; i < count [ CSTEAM_UNASSIGNED ]; i++ )
{
id = players [ CSTEAM_UNASSIGNED ] [ i ], team = get_user_team ( id )
if ( team == CSTEAM_TERRORIST || CSTEAM_CT )
players [ team ] [ count [ team ] ++ ] = id
}
if ( abs ( count [ CSTEAM_TERRORIST ] - count [ CSTEAM_CT ] ) <= 1 ) return
static maxplayers; maxplayers = ( count [ CSTEAM_TERRORIST ] + count [ CSTEAM_CT ] ) / 2
if ( count [ CSTEAM_TERRORIST ] > maxplayers )
{
for ( i = 0; i < ( count [ CSTEAM_TERRORIST ] - maxplayers ); i++ )
cs_set_team ( players [ CSTEAM_TERRORIST ] [ i ], CSTEAM_CT )
}
else
{
for ( i = 0; i < ( count [ CSTEAM_CT ] - maxplayers ); i++ )
cs_set_team ( players [ CSTEAM_CT ] [ i ], CSTEAM_TERRORIST )
}
on every line i have tag mismatch, form the first one to the last one
Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// biohazard.sma
// D:\Programe\HLDS\bhscripting\biohazard.sma(1267) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1267) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1268) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1268) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1270) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1272) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1274) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1274) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1277) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1277) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1279) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1279) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1280) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1282) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1283) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1287) : warning 213: tag mismatch
// D:\Programe\HLDS\bhscripting\biohazard.sma(1288) : warning 213: tag mismatch
// Header size: 4880 bytes
// Code size: 62988 bytes
// Data size: 29160 bytes
// Stack/heap size: 32768 bytes; estimated max. usage=785 cells (3140 bytes
)
// Total requirements: 129796 bytes
//
// 17 Warnings.
// Done.
//
// Compilation Time: 1,7 sec
// ----------------------------------------
Press enter to exit ...
Some help ? thanks, i need to use this module CSTRIKE module crashes on full server!
__________________