Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Asking Plugin and the idea of: LordShot
- Built By: CheezPuff
- - Public Release v1.0 (12/5/2019)
- Requirements: Amx Mod X v1.8.2
- */
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx>
- #include < cstrike>
- #include < hamsandwich >
- #include < ColorChat >
- #define PLUGIN "Round Cash"
- #define VERSION "1.0"
- #define AUTHOR "CheezPuff"
- enum Teams
- {
- Team_T ,
- Team_CT
- }
- enum WinInfo
- {
- Teams:wiTeam,
- wiMoney
- }
- new const TeamNames[ Teams ][] =
- {
- "Terrorist",
- "CT"
- };
- new pcvar_CT_Cash , pcvar_T_Cash;
- new g_LastWinner[ WinInfo ];
- new const Prefix[] = "^x04[Round Cash]^x01"
- //native get_user_cash( Index ) // get the amount of cash a player have
- //native set_user_cash( Index, amount ) // set the amount of cash for a player
- #define get_user_cash(%1) cs_get_user_money(%1)
- #define set_user_cash(%1,%2) cs_set_user_money(%1,%2)
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- pcvar_T_Cash = register_cvar( "amx_cash_tero" , "5000" );
- pcvar_CT_Cash = register_cvar( "amx_cash_counter" , "5000" );
- register_logevent( "CT_Win_Event" , 6 , "3=CTs_Win" , "3=All_Hostages_Rescued" );
- register_logevent( "TE_Win_Event" , 6 , "3=Terrorists_Win" , "3=Target_Bombed" );
- register_clcmd( "say /last" , "ShowLastWinner" );
- register_clcmd( "say_team /last" , "ShowLastWinner" );
- }
- public TE_Win_Event()
- {
- MessageWon( Team_T );
- }
- public CT_Win_Event()
- {
- MessageWon( Team_CT );
- }
- public MessageWon( Teams:tTeam )
- {
- new iPlayers[ 32 ], iNumPlayers , iNumEnemies , Index , iTotalMoney;
- get_players( iPlayers , iNumEnemies , "e" , tTeam == Team_T ? "CT" : "TERRORIST" );
- iTotalMoney = iNumEnemies * ( get_pcvar_num( tTeam == Team_T ? pcvar_T_Cash : pcvar_CT_Cash ) );
- g_LastWinner[ wiTeam ] = tTeam;
- g_LastWinner[ wiMoney ] = iTotalMoney;
- get_players( iPlayers , iNumPlayers , "e" , tTeam == Team_T ? "TERRORIST" : "CT" );
- ColorChat( 0 , NORMAL , "%s - %s's Won the round, Awarded $%d (%d x %d)", Prefix, TeamNames[ tTeam ] , iTotalMoney , iNumEnemies , get_pcvar_num( tTeam == Team_T ? pcvar_T_Cash : pcvar_CT_Cash ) );
- for ( new i = 0 ; i < iNumPlayers ; i++ )
- {
- Index = iPlayers[ i ];
- set_user_cash( Index , get_user_cash( Index ) + iTotalMoney );
- }
- }
- public ShowLastWinner( Index )
- {
- if ( !g_LastWinner[ wiTeam ] && !g_LastWinner[ wiMoney ] )
- {
- ColorChat( Index , NORMAL , "* No team has won yet." );
- }
- else
- {
- ColorChat( Index , NORMAL , "* The last winner was %s's, winning $%d!" , TeamNames[ g_LastWinner[ wiTeam ] ] , g_LastWinner[ wiMoney ] );
- }
- return PLUGIN_HANDLED;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement