Mam plugin który po X rundach powinien zamieniać graczy drużynami i zmieniać wyniki. Działa właściwie dobrze, ale tylko w przypadku, jeśli gra się z botami. Gdy sprawdzałem go na serwerze, działał tylko gdy było 1vs1. Gdy gracze dochodzili, wyświetlała się wiadomość o zmianie drużyn, zmieniał się wynik, ale gracze dalej pozostawali w swoich teamach. W logach nic nie wyrzuca.
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <orpheu>
#include <orpheu_memory>
#include <ColorChat>
#define set_mp_pdata(%1,%2) ( OrpheuMemorySetAtAddress( g_pGameRules, %1, 1, %2 ) )
#define get_mp_pdata(%1) ( OrpheuMemoryGetAtAddress( g_pGameRules, %1 ) )
new g_pGameRules;
new pCvarResult;
new lic = 0;
new ttscore = 0;
new ctscore = 0;
public plugin_precache()
{
OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "OnInstallGameRules", OrpheuHookPost );
}
public OnInstallGameRules()
{
g_pGameRules = OrpheuGetReturn();
}
public plugin_init() {
register_plugin("mr12", "1.0", "author")
register_event("TeamScore", "teamScore", "a")
pCvarResult = register_cvar("change_team_result","12");
}
public teamScore(){
new sTeam[2];
read_data(1, sTeam, 1);
if( sTeam[0] == 'T' )
ttscore = read_data(2);
else
ctscore = read_data(2);
if(ttscore+ctscore >= get_pcvar_num(pCvarResult)) changeTeams();
}
public changeTeams(){
lic++;
if(lic > 1)
return PLUGIN_HANDLED;
set_mp_pdata( "m_iNumCTWins", ttscore );
set_mp_pdata( "m_iNumTerroristWins", ctscore );
ColorChat(0, RED, "--------------!!!ZMIANA DRUZYN!!!--------------");
for(new i = 1 ; i < 33; i++ ){
if(!is_user_connected(i) || cs_get_user_team(i) == CS_TEAM_SPECTATOR || cs_get_user_team(i) == CS_TEAM_UNASSIGNED ) return PLUGIN_HANDLED;
cs_set_user_team (i, cs_get_user_team(i) == CS_TEAM_CT?CS_TEAM_T:CS_TEAM_CT, CS_DONTCHANGE)
}
UpdateTeamScores( .notifyAllPlugins = true );
return PLUGIN_HANDLED;
}
}
UpdateTeamScores ( const bool:notifyAllPlugins = false )
{
static OrpheuFunction:handleFuncUpdateTeamScores;
if ( !handleFuncUpdateTeamScores )
{
handleFuncUpdateTeamScores = OrpheuGetFunction( "UpdateTeamScores", "CHalfLifeMultiplay" )
}
( notifyAllPlugins ) ?
OrpheuCallSuper( handleFuncUpdateTeamScores, g_pGameRules ) :
OrpheuCall( handleFuncUpdateTeamScores, g_pGameRules );
}
Użytkownik M@lpa edytował ten post 15.05.2012 23:38


Dodatki SourceMod












