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)
- Thanks for - http://www.amxmodx.org/api/amxmisc/get_playersnum_ex
- Requirements: Amx Mod X v1.8.3+
- */
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx >
- #include < amxmisc >
- #include < cstrike >
- #include < hamsandwich >
- #define PLUGIN "Round Cash"
- #define VERSION "1.0"
- #define AUTHOR "CheezPuff"
- new PlayerValue
- new const Prefix[] = "^x04[Round Cash]^x01"
- new szMessage[60]
- native get_user_cash( client ) // get the amount of cash a player have
- native set_user_cash( client, amount ) // set the amount of cash for a player
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_event("SendAudio", "EventTRWin","a", "2&%!MRAD_terwin")
- register_event("SendAudio", "EventCTWin","a", "2&%!MRAD_ctwin")
- register_clcmd("say /last", "lastTeamWinner")
- new pCvar
- pCvar = register_cvar("test_cvar","5000", .description = "The value of every player.")
- bind_pcvar_num(pCvar, PlayerValue)
- }
- public EventTRWin()
- {
- SendCash(true)
- }
- public EventCTWin()
- {
- SendCash(false)
- }
- SendCash(bool:TeamTvictory)
- {
- if(TeamTvictory)
- {
- new iNumTeamCT = get_playersnum_ex(GetPlayers_ExcludeAlive | GetPlayers_MatchTeam, "CT")
- new iNumTeamT = get_playersnum_ex(GetPlayers_MatchTeam, "TERRORIST")
- new iReward = (PlayerValue * iNumTeamCT / iNumTeamT)
- new iPlayers[MAX_PLAYERS], iNum
- get_players_ex(iPlayers, iNum, GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV | GetPlayers_MatchTeam, "TERRORIST")
- for(new i = 0; i < iNum; i++)
- {
- if(!is_user_connected(iPlayers[i]))
- continue
- set_user_cash(iPlayers[i], get_user_cash(iPlayers[i]) + iReward)
- }
- formatex(szMessage, charsmax(szMessage), "%s The last Team winner was Terrorists, winning^x04 %i^x01 cash.", Prefix, iReward)
- }
- else
- {
- new iNumTeamT = get_playersnum_ex(GetPlayers_ExcludeAlive | GetPlayers_MatchTeam, "TERRORIST")
- new iNumTeamCT = get_playersnum_ex(GetPlayers_MatchTeam, "CT")
- new iReward = (PlayerValue * iNumTeamT / iNumTeamCT)
- new iPlayers[MAX_PLAYERS], iNum
- get_players_ex(iPlayers, iNum, GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV| GetPlayers_MatchTeam, "CT")
- for(new i = 0; i < iNum; i++)
- {
- if(!is_user_connected(iPlayers[i]))
- continue
- set_user_cash(iPlayers[i], get_user_cash(iPlayers[i]) + iReward)
- }
- formatex(szMessage, charsmax(szMessage), "%s The last Team winner was CT, winning^x04 %i^x01 cash.", Prefix, iReward)
- }
- }
- public lastTeamWinner(Index)
- {
- if(szMessage[0])
- {
- client_print_color(Index, print_team_default, "%s", szMessage)
- return PLUGIN_HANDLED
- }
- else
- {
- client_print_color(Index, print_team_default, "%s No team victory yet.", Prefix)
- return PLUGIN_HANDLED
- }
- }
Add Comment
Please, Sign In to add comment