register_event and swap players
Hello to all.
i'm need to make plugin for b.rush game.
If u dont know what is it:
Code:
b.rush needs 8 players, 5T and 3 CT.
Normally it would be 4on4 and a knife round would be played to decide the teams.
The Ts need to rush bomb site B and CTs need to defend it.
If Ts win the round, the 3 who got kills go CT and the CTs go T(if CT loose the round)- then restartround. if Terrorist-player make 2 frags(kill two CT's) , he goes to CT and he choose else 1 player from T.
If CTs win the round, the teams stay the same and the game continues.
If CTs win 8 or 10 rounds in a row, a new map is chosen.
There are a few rules:
NO flashbangs
NO sheilds
NO nade spamming from spawn (only an issue on certain maps, E.g. the 1 i made)
Ts must NOT run mid or any other route to get to B (They must use the shortest route) (E.g. de_inferno - rush banana, de_dust2 - rush tunnels)
Server side settings need to be:
mp_friendlyfire 0
mp_startmoney 800
mp_roundtime 1
mp_freezetime 0
sv_gravity 800
so here is my simple code but dont know whats wrong:
PHP Code:
#include <amxmodx> #include <cstrike> public plugin_init() { register_event( "SendAudio", "e_terrorist_win", "a", "2&%!MRAD_terwin" ); } //If terrorist win all cts will be transfered to terrorist. And those terrorist whom killed someone will be transfered to ct. public e_terrorist_win( ) { transfer() new players[ 32 ], num, player, iFrags; get_players( players, num, "ea", "TERRORIST" ); for( new i = 0; i < num; i++ ) { player = players[ i ]; iFrags = get_user_frags( player ); if( iFrags >= 1 ) { cs_set_user_team( player, CS_TEAM_CT ); } } } public transfer() { new CsTeams:team, players[ 32 ], num, player, iFrags; get_players( players, num, "ea", "CT" ); for( new i = 0; i < num; i++ ) { player = players[ i ]; cs_set_user_team( player, CS_TEAM_T ); } }
i know, is better will using register_logevent( "Event_RoundEnd", 2, "1=Round_End" );
and check, Terrorist have frag or not from Deathmsg_event but i dont know how.
Please help me with it.
|