Код за потвърждение: Избери целия код
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#define PREFIX "!y[!tHERO!y]"
#define NEADED_FRAGS 20
#define HERO_ROUNDS 3
#define HERO_HEALTH 130
#define HERO_SPEED 1500
new const g_szHeroFlag[] = "b";
new g_NextRoundHero[33]
new g_Frags[33]
public plugin_init() {
register_plugin("Hero mode", "1.0", "Ds")
register_clcmd("say /hero", "hero_command")
register_clcmd("say_team /hero", "hero_command")
register_clcmd("say /rs", "reset_frags")
register_clcmd("say_team /rs", "reset_frags")
RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled_Post", 1)
}
public client_putinserver(iPlayer) {
g_NextRoundHero[iPlayer] = 0
g_Frags[iPlayer] = 0
}
public reset_frags(iPlayer) {
g_Frags[iPlayer] = 0
}
public hero_command(iPlayer) {
if (g_Frags[iPlayer] >= NEADED_FRAGS) {
client_cmd(iPlayer,"spk buttons/blip2")
ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)
g_Frags[iPlayer] -= NEADED_FRAGS
g_NextRoundHero[iPlayer] = HERO_ROUNDS
}
else {
client_cmd(iPlayer,"spk buttons/blip1")
ChatColor(iPlayer, "%s !yYou have %d frags, you need 20 frags to activate!", PREFIX, NEADED_FRAGS - g_Frags[iPlayer])
}
}
public Ham_PlayerKilled_Post(iVictim, iAttacker)
{
if (is_user_connected(iVictim) && is_user_connected(iAttacker)) {
g_Frags[iAttacker] += 1
}
}
public Ham_Spawn_Post(iPlayer) {
if (g_NextRoundHero[iPlayer] > 0) {
set_user_flags(iPlayer, read_flags(g_szHeroFlag));
set_pev(iPlayer, pev_health, float(HERO_HEALTH))
switch (cs_get_user_team(iPlayer))
{
case CS_TEAM_CT:fm_set_rendering(iPlayer, kRenderFxGlowShell, random_num(0, 100), random_num(50, 180), 255, kRenderNormal, 15)
case CS_TEAM_T: fm_set_rendering(iPlayer, kRenderFxGlowShell, 255, random_num(0, 150), random_num(0, 200), kRenderNormal, 15)
}
g_NextRoundHero[iPlayer] -= 1
if(g_NextRoundHero[iPlayer] == 0)
{
client_cmd(iPlayer,"spk buttons/blip1")
ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)
}
}
else {
// Remove glow
remove_user_flags(iPlayer, read_flags(g_szHeroFlag));
fm_set_rendering(iPlayer)
}
}
public plugin_precache()
{
precache_sound( "buttons/blip1.wav" );
precache_sound( "buttons/blip2.wav" );
}
stock ChatColor(const id, const input[], any:...) {
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
}
Код за потвърждение: Избери целия код
if(g_NextRoundHero[iPlayer] == 0)
{
client_cmd(iPlayer,"spk buttons/blip1")
ChatColor(iPlayer, "%s !yYou will become a Hero at the next spawn, for 3 rounds", PREFIX)
}