Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

M@lpa - zdjęcie

M@lpa

Rejestracja: 11.02.2010
Aktualnie: Nieaktywny
Poza forum Ostatnio: 27.05.2012 17:59
-----

#410232 [ROZWIĄZANE] Orpheu. Zamiana wyników drużyn

Napisane przez Misiaczek ;c w 13.05.2012 22:01


#include <amxmodx>
#include <amxmisc>
#include <orpheu>
#include <orpheu_memory>

new g_pGameRules;

#define set_mp_pdata(%1,%2) ( OrpheuMemorySetAtAddress( g_pGameRules, %1, 1, %2 ) )
#define get_mp_pdata(%1) ( OrpheuMemoryGetAtAddress( g_pGameRules, %1 ) )

public plugin_precache()
{
OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "OnInstallGameRules", OrpheuHookPost );
}

public OnInstallGameRules()
{
g_pGameRules = OrpheuGetReturn();
}

public plugin_init ()
{
register_plugin( "Set Team Score", "1.0.0", "Arkshine" );
register_concmd( "amx_tscore", "ClientCommand_SetTeamScore", ADMIN_RCON, "- <Team> <Score>" );
}

public ClientCommand_SetTeamScore ( const player, const level, const cid )
{
if ( !cmd_access( player, level, cid, 3 ) )
{
return PLUGIN_HANDLED;
}

new team [ 2 ];
new score[ 6 ];

read_argv( 1, team , charsmax( team ) );
read_argv( 2, score, charsmax( score ) );

new signedShort = 32768;
new scoreToGive = clamp( str_to_num( score ), -signedShort, signedShort );

switch ( team[ 0 ] )
{
case 'C', 'c' :
{
set_mp_pdata( "m_iNumCTWins", scoreToGive );
}
case 'T', 't' :
{
set_mp_pdata( "m_iNumTerroristWins", scoreToGive );
}
case '@' :
{
set_mp_pdata( "m_iNumCTWins", scoreToGive );
set_mp_pdata( "m_iNumTerroristWins", scoreToGive );
}
default :
{
return PLUGIN_HANDLED;
}
}

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 );
}


Sygnatury w załączniku

amx_tscore <T|CT|@ALL> <score> ( jeśli chcesz możesz wpisać tylko pierwsze literki czyli: c, t, lub @ )

Załączone pliki


  • +
  • -
  • 2