skitls
Пользователь
- Регистрация
- 21 Июн 2017
- Сообщения
- 216
- Симпатии
- 62
- Пол
- Мужской
Как то можно сделать что бы кроме выдачи при спавне был еще показ урона?
По сути сделал так, но чувствую что я рукажоп)))
Оба исходника в наличии.
По сути сделал так, но чувствую что я рукажоп)))
C++:
#pragma semicolon 0
#include <amxmodx>
#include <reapi>
#include <fun>
#include <fakemeta>
#define DAMAGE_RECIEVED
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif
#define CheckBit(%1,%2) (%1 & (1 << (%2 & 31)))
#define SetBit(%1,%2) (%1 |= (1 << (%2 & 31)))
#define ClearBit(%1,%2) (%1 &= ~(1 << (%2 & 31)))
new g_HudSync, g_HudSync2
new g_IsSteam;
new g_Round
new pCvarFl, pCvarHe, pCvarSm, pCvarArmor, pCvarDgl, pCvarMsg, pCvarRoundMin
new g_ExludeFlag;
public plugin_init()
{
register_plugin("Steam Bonus", "1.1", "ill+F@nToM")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("TextMsg", "event_restart_game", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn", 1)
pCvarFl = register_cvar("st_grenade_fl", "1")
pCvarHe = register_cvar("st_grenade_he", "1")
pCvarSm = register_cvar("st_grenade_sm", "1")
pCvarArmor = register_cvar("st_armor", "100")
pCvarDgl = register_cvar("st_deagle", "1")
pCvarMsg = register_cvar("st_msg", "1")
pCvarRoundMin = register_cvar("st_round_min", "2")
register_cvar("st_exlude_flag", "t")
register_event( "Damage", "eventDamage", "b", "2!0", "3=0", "4!0" );
g_HudSync2 = CreateHudSyncObj()
g_HudSync = CreateHudSyncObj()
new iDir[64]
get_localinfo("amxx_configsdir", iDir, charsmax(iDir));
server_cmd("exec %s/steam_bonus_a2.cfg", iDir)
}
public plugin_cfg()
{
new tmp[32];
get_cvar_string("st_exlude_flag", tmp, charsmax(tmp));
g_ExludeFlag = read_flags(tmp);
}
public event_round_start()
{
g_Round++
}
public event_restart_game()
{
g_Round = 0
}
public client_putinserver(id)
{
is_user_steam(id) ? SetBit(g_IsSteam, id) : ClearBit(g_IsSteam, id)
}
public eventDamage(id)
{
new attacker = get_user_attacker(id)
new damage = read_data(2)
if (is_user_connected(attacker) && get_user_flags(attacker) & g_ExludeFlag)
{
set_hudmessage(0, 128, 0, -1.0, 0.55, 2, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(attacker, g_HudSync, "%i", damage)
}
else if (is_user_connected(attacker) && get_user_flags(id) & g_ExludeFlag)
{
set_hudmessage(139, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(id, g_HudSync2, "%i", damage)
}
}
public CBasePlayer_Spawn(id)
{
static tmp, ArmorType:armortype;
if (!is_user_alive(id)) {
return HC_CONTINUE;
}
if (!CheckBit(g_IsSteam, id) ||(get_user_flags(id) & g_ExludeFlag) || g_Round < get_pcvar_num(pCvarRoundMin)) {
return HC_CONTINUE;
}
if ((tmp = get_pcvar_num(pCvarFl)) > 0) {
rg_give_item(id, "weapon_flashbang")
rg_set_user_bpammo(id, WEAPON_FLASHBANG, tmp)
}
if (get_pcvar_num(pCvarHe) == 1) {
rg_give_item(id, "weapon_hegrenade")
}
if (get_pcvar_num(pCvarSm) == 1) {
rg_give_item(id, "weapon_smokegrenade")
}
if ((tmp = get_pcvar_num(pCvarArmor)) > 0) {
if(rg_get_user_armor(id, armortype) < tmp) {
rg_set_user_armor(id, tmp, ARMOR_VESTHELM)
}
}
if (get_pcvar_num(pCvarDgl)) {
rg_give_item(id, "weapon_deagle", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_DEAGLE, 35)
}
if (get_pcvar_num(pCvarMsg)) {
client_print_color(id, print_team_default, "^4[STEAM] ^1Вы получили бонус за STEAM!")
}
return HC_CONTINUE;
}
//stock is_user_steam(id)
//{
// static dp_pointer
//
// if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
// {
// server_cmd("dp_clientinfo %d", id)
// server_exec()
// return (get_pcvar_num(dp_pointer) == 2) ? 1 : 0
// }
// return false;
//}
Вложения
-
2,9 KB Просмотры: 11
-
1.004 байт Просмотры: 6
Последнее редактирование: