/* * CSB Hostage Bonus * Copyright (C) 2026 counter-strike-boost.com * * Rewards a CT who rescues a hostage with bonus money and HP, hooking the * Rescued_A_Hostage log event and mapping it back to the player. When the whole * batch of hostages is rescued the CT team gets a one-off cash bonus. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. It is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See for details. */ #include #include #include new const PLUGIN[] = "CSB Hostage Bonus" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pMoney, g_pHp, g_pAllCount, g_pAllBonus new g_iRescued public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_hb_enabled", "1") g_pMoney = register_cvar("csb_hb_money", "1200") g_pHp = register_cvar("csb_hb_hp", "15") g_pAllCount = register_cvar("csb_hb_allcount", "4") g_pAllBonus = register_cvar("csb_hb_allbonus", "2000") register_logevent("evRescued", 3, "3=Rescued_A_Hostage") register_logevent("evRoundStart", 2, "1=Round_Start") } public evRoundStart() { g_iRescued = 0 } public evRescued() { if (!get_pcvar_num(g_pEnabled)) return new logUser[80] read_logargv(1, logUser, charsmax(logUser)) new id = getLogUserId(logUser) if (!id || !is_user_connected(id)) return new money = get_pcvar_num(g_pMoney) new give = cs_get_user_money(id) + money if (give > 16000) give = 16000 cs_set_user_money(id, give) new addhp = get_pcvar_num(g_pHp) if (addhp > 0 && is_user_alive(id)) set_user_health(id, get_user_health(id) + addhp) client_print(id, print_chat, "[CSB] Hostage rescued! Bonus: $%d and +%d HP.", money, addhp) g_iRescued++ if (g_iRescued == get_pcvar_num(g_pAllCount)) payTeamBonus() } payTeamBonus() { new bonus = get_pcvar_num(g_pAllBonus) new players[32], num get_players(players, num, "ae") for (new i = 0; i < num; i++) { new p = players[i] if (get_user_team(p) == 2) { new m = cs_get_user_money(p) + bonus if (m > 16000) m = 16000 cs_set_user_money(p, m) } } client_print(0, print_chat, "[CSB] All hostages rescued! CT team bonus: $%d each.", bonus) } getLogUserId(const s[]) { new lt = -1, gt = -1, i for (i = 0; s[i]; i++) { if (s[i] == '<') { lt = i break } } if (lt == -1) return 0 for (i = lt + 1; s[i]; i++) { if (s[i] == '>') { gt = i break } } if (gt == -1) return 0 new num[12], k = 0 for (i = lt + 1; i < gt && k < charsmax(num); i++) num[k++] = s[i] num[k] = 0 return find_player("k", str_to_num(num)) }