#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <zp50_class_human>
#include <zp50_class_nemesis>
#include <zp50_items>
#include <zombieplague>
#include <zp_level_system>
#define LVL_COUNT 20
//ID Tasks
#define TASKID_WAIT_HUD 7721
// Screen Fade
#define FADE_TIME 2048 // 1 sec. = 4096
#define HOLD_TIME 40960 // 2 sec. = 4096*2
#define FADE_IN 0x0000
#define R 255
#define G 160
#define B 0
#define FADE_ALPHA 100
// Invulnurable Attributes
new const humanclass1_name[] = "Invulnurable Human"
new const humanclass1_info[] = "[Invulnurability on ALT]"
new const humanclass1_models[][] = { "leet" }
const humanclass1_health = 150
const Float:humanclass1_speed = 1.0
const Float:humanclass1_gravity = 1.0
new g_human_invul
new Float:g_flGodmode_cooldown[33], Float:g_flGodmode_spelltime[33];
new Float:alt_cooldown = 30.0
new Float:godmode_time = 10.0
new MsgSayText
new g_MsgScreenFade
new g_maxplayers
public plugin_precache()
{
register_plugin("[ZP] Class: Human: Invulnurable", ZP_VERSION_STRING, "_RedGamer_")
RegisterHam(Ham_ObjectCaps, "player", "fw_PlayerPressUse");
register_logevent("roundStart", 2, "1=Round_Start")
g_human_invul = zp_class_human_register(humanclass1_name, humanclass1_info, humanclass1_health, humanclass1_speed, humanclass1_gravity)
new index
for (index = 0; index < sizeof humanclass1_models; index++)
zp_class_human_register_model(g_human_invul, humanclass1_models[index])
MsgSayText = get_user_msgid("SayText")
g_MsgScreenFade = get_user_msgid("ScreenFade")
g_maxplayers = get_maxplayers()
}
public fw_PlayerPressUse(id)
{
log_to_file("test_god.log", "called press use");
if (zp_class_human_get_current(id) == g_human_invul)
{
log_to_file("test_god.log", " test vars: %d %d %d %d %d", is_user_alive(id), zp_class_human_get_current(id) == g_human_invul, !zp_get_user_zombie(id), !zp_get_user_survivor(id), pev(id, pev_button) & IN_RELOAD);
if (is_user_alive(id) && (zp_class_human_get_current(id) == g_human_invul) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id))
{
if (pev(id, pev_button) & IN_RELOAD) {
use_ability(id);
}
}
}
}
public roundStart()
{
for (new i = 1; i <= g_maxplayers; i++)
{
reset_values(i);
}
}
public ShowHUD(id)
{
new id = TASKID_WAIT_HUD;
if (is_user_alive(id))
{
new Float:flGameTime = get_gametime();
new szText[64];
// Cooldown
if (g_flGodmode_cooldown[id] > flGameTime) {
formatex(szText, charsmax(szText), "[Перезарядка: %.0f]", g_flGodmode_cooldown[id] - flGameTime);
}
else {
remove_task(id + TASKID_WAIT_HUD);
g_flGodmode_cooldown[id] = 0.0;
}
// время действия спелла неуязв.
if (g_flGodmode_spelltime[id]) {
if (g_flGodmode_spelltime[id] < flGameTime) {
set_user_rendering(id);
set_user_godmode(id, 0);
g_flGodmode_spelltime[id] = 0.0;
}
else {
formatex(szText, charsmax(szText), "[Неуязвимость: %.0f]", g_flGodmode_spelltime[id] - flGameTime);
}
}
if (szText[0] != EOS) {
set_hudmessage(200, 100, 0, 0.80, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(id, szText);
}
}
else
{
remove_task(id + TASKID_WAIT_HUD);
if (is_user_connected(id)) {
// по идее в спавне должно ресетаться , но я в этом не уверен
set_user_godmode(id, 0);
}
}
}
public use_ability(id)
{
log_to_file("test_god.log", "Ability Use Called");
new Float:flGameTime = get_gametime();
// if (!g_flGodmode_cooldown[id] && g_flGodmode_cooldown[id] > flGameTime)
if (!g_flGodmode_cooldown[id])
{
orange_screen(id)
set_user_rendering(id, kRenderFxGlowShell, 255, 165, 0, kRenderNormal, 0)
g_flGodmode_cooldown[id] = flGameTime + alt_cooldown + godmode_time; // Время перезарядки начинается после окончания спела неуязв.
g_flGodmode_spelltime[id] = flGameTime + godmode_time;
set_user_godmode(id, 1)
client_print(id, print_chat, "[TEST] - Ability used")
set_task(1.0, "ShowHUD", id + TASKID_WAIT_HUD, _, _, .flags = "b");
}
else {
client_print(id, print_center, "[ Перезарядка: %.0f ]", g_flGodmode_cooldown[id] - flGameTime);
}
}
public orange_screen(id)
{
message_begin(MSG_ONE, g_MsgScreenFade, _, id)
write_short(FADE_TIME)
write_short(HOLD_TIME)
write_short(FADE_IN)
write_byte(R)
write_byte(G)
write_byte(B)
write_byte(FADE_ALPHA)
message_end()
}
public reset_values(id)
{
remove_task(id + TASKID_WAIT_HUD);
g_flGodmode_cooldown[id] = 0.0;
g_flGodmode_spelltime[id] = 0.0;
}
public zp_fw_core_cure_pre(id)
{
if (zp_class_human_get_next(id) == g_human_invul)
{
if (zp_level(id) < LVL_COUNT)
{
zp_colored_print(id, "^x01[^x04ZP^x01] Вы не достигли ^x04%d ^x01уровня!", LVL_COUNT)
zp_class_human_set_next(id, 0)
}
else
{
zp_class_human_set_next(id, g_human_invul)
}
}
}
public zp_fw_core_cure_post(id)
{
if ((zp_class_human_get_current(id) == g_human_invul) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id))
{
reset_values(id);
}
}
public zp_fw_core_infect_post(id)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id))
{
set_user_rendering(id);
reset_values(id);
}
}
stock zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
if (!is_user_connected(player))
continue;
static changed[5], changedcount
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, MsgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <zp50_class_human>
#include <zp50_class_nemesis>
#include <zp50_items>
#include <zombieplague>
#include <zp_level_system>
#define LVL_COUNT 20
//ID Tasks
#define TASKID_WAIT_HUD 7721
// Screen Fade
#define FADE_TIME 2048 // 1 sec. = 4096
#define HOLD_TIME 40960 // 2 sec. = 4096*2
#define FADE_IN 0x0000
#define R 255
#define G 160
#define B 0
#define FADE_ALPHA 100
// Invulnurable Attributes
new const humanclass1_name[] = "Invulnurable Human"
new const humanclass1_info[] = "[Invulnurability on ALT]"
new const humanclass1_models[][] = { "leet" }
const humanclass1_health = 150
const Float:humanclass1_speed = 1.0
const Float:humanclass1_gravity = 1.0
new g_human_invul
new Float:g_flGodmode_cooldown[33], Float:g_flGodmode_spelltime[33];
new Float:alt_cooldown = 30.0
new Float:godmode_time = 10.0
new MsgSayText
new g_MsgScreenFade
new g_maxplayers
public plugin_precache()
{
register_plugin("[ZP] Class: Human: Invulnurable", ZP_VERSION_STRING, "_RedGamer_")
RegisterHam(Ham_ObjectCaps, "player", "fw_PlayerPressUse");
register_logevent("roundStart", 2, "1=Round_Start")
g_human_invul = zp_class_human_register(humanclass1_name, humanclass1_info, humanclass1_health, humanclass1_speed, humanclass1_gravity)
new index
for (index = 0; index < sizeof humanclass1_models; index++)
zp_class_human_register_model(g_human_invul, humanclass1_models[index])
MsgSayText = get_user_msgid("SayText")
g_MsgScreenFade = get_user_msgid("ScreenFade")
g_maxplayers = get_maxplayers()
}
public fw_PlayerPressUse(id)
{
log_to_file("test_god.log", "called press use");
if (zp_class_human_get_current(id) == g_human_invul)
{
log_to_file("test_god.log", " test vars: %d %d %d %d %d", is_user_alive(id), zp_class_human_get_current(id) == g_human_invul, !zp_get_user_zombie(id), !zp_get_user_survivor(id), pev(id, pev_button) & IN_RELOAD);
if (is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id))
{
if (pev(id, pev_button) & IN_RELOAD) {
use_ability(id);
}
}
}
}
public roundStart()
{
for (new i = 1; i <= g_maxplayers; i++)
{
reset_values(i);
}
}
public ShowHUD(id)
{
new id = TASKID_WAIT_HUD;
if (is_user_alive(id))
{
new Float:flGameTime = get_gametime();
new szText[64];
// Cooldown
if (g_flGodmode_cooldown[id] > flGameTime) {
formatex(szText, charsmax(szText), "[Перезарядка: %.0f]", g_flGodmode_cooldown[id] - flGameTime);
}
// время действия спелла неуязв.
if (g_flGodmode_spelltime[id]) {
if (g_flGodmode_spelltime[id] < flGameTime) {
set_user_rendering(id);
set_user_godmode(id, 0);
g_flGodmode_spelltime[id] = 0.0;
}
else {
formatex(szText, charsmax(szText), "[Неуязвимость: %.0f]", g_flGodmode_spelltime[id] - flGameTime);
}
}
if (szText[0] != EOS) {
set_hudmessage(200, 100, 0, 0.80, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(id, szText);
}
else {
remove_task(id + TASKID_WAIT_HUD);
g_flGodmode_cooldown[id] = 0.0;
}
}
else
{
remove_task(id + TASKID_WAIT_HUD);
if (is_user_connected(id)) {
// по идее в спавне должно ресетаться , но я в этом не уверен
set_user_godmode(id, 0);
}
}
}
public use_ability(id)
{
log_to_file("test_god.log", "Ability Use Called");
new Float:flGameTime = get_gametime();
// if (!g_flGodmode_cooldown[id] && g_flGodmode_cooldown[id] > flGameTime)
if (!g_flGodmode_cooldown[id])
{
orange_screen(id)
set_user_rendering(id, kRenderFxGlowShell, 255, 165, 0, kRenderNormal, 0)
g_flGodmode_cooldown[id] = flGameTime + alt_cooldown + godmode_time; // Время перезарядки начинается после окончания спела неуязв.
g_flGodmode_spelltime[id] = flGameTime + godmode_time;
set_user_godmode(id, 1)
client_print(id, print_chat, "[TEST] - Ability used")
set_task(1.0, "ShowHUD", id + TASKID_WAIT_HUD, _, _, .flags = "b");
}
else {
client_print(id, print_center, "[ Перезарядка: %.0f ]", g_flGodmode_cooldown[id] - flGameTime);
}
}
public orange_screen(id)
{
message_begin(MSG_ONE, g_MsgScreenFade, _, id)
write_short(FADE_TIME)
write_short(HOLD_TIME)
write_short(FADE_IN)
write_byte(R)
write_byte(G)
write_byte(B)
write_byte(FADE_ALPHA)
message_end()
}
public reset_values(id)
{
remove_task(id + TASKID_WAIT_HUD);
g_flGodmode_cooldown[id] = 0.0;
g_flGodmode_spelltime[id] = 0.0;
}
public zp_fw_core_cure_pre(id)
{
if (zp_class_human_get_next(id) == g_human_invul)
{
if (zp_level(id) < LVL_COUNT)
{
zp_colored_print(id, "^x01[^x04ZP^x01] Вы не достигли ^x04%d ^x01уровня!", LVL_COUNT)
zp_class_human_set_next(id, 0)
}
else
{
zp_class_human_set_next(id, g_human_invul)
}
}
}
public zp_fw_core_cure_post(id)
{
if ((zp_class_human_get_current(id) == g_human_invul) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id))
{
reset_values(id);
}
}
public zp_fw_core_infect_post(id)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id))
{
set_user_rendering(id);
reset_values(id);
}
}
stock zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
if (!is_user_connected(player))
continue;
static changed[5], changedcount
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, MsgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
set_task(1.0, "ShowHUD", id + TASKID_WAIT_HUD, _, _, .flags = "b")
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <zp50_class_human>
#include <zp50_class_nemesis>
#include <zp50_items>
#include <zombieplague>
#include <zp_level_system>
#define LVL_COUNT 20
//ID Tasks
#define TASKID_WAIT_HUD 7721
// Screen Fade
#define FADE_TIME 2048 // 1 sec. = 4096
#define HOLD_TIME 40960 // 2 sec. = 4096*2
#define FADE_IN 0x0000
#define R 255
#define G 160
#define B 0
#define FADE_ALPHA 100
// Invulnurable Attributes
new const humanclass1_name[] = "Invulnurable Human"
new const humanclass1_info[] = "[Invulnurability on ALT]"
new const humanclass1_models[][] = { "leet" }
const humanclass1_health = 150
const Float:humanclass1_speed = 1.0
const Float:humanclass1_gravity = 1.0
new g_human_invul
new Float:g_flGodmode_cooldown[33], Float:g_flGodmode_spelltime[33];
new Float:alt_cooldown = 30.0
new Float:godmode_time = 10.0
new MsgSayText
new g_MsgScreenFade
new g_maxplayers
public plugin_precache()
{
register_plugin("[ZP] Class: Human: Invulnurable", ZP_VERSION_STRING, "_RedGamer_")
RegisterHam(Ham_ObjectCaps, "player", "fw_PlayerPressUse");
register_logevent("roundStart", 2, "1=Round_Start")
g_human_invul = zp_class_human_register(humanclass1_name, humanclass1_info, humanclass1_health, humanclass1_speed, humanclass1_gravity)
new index
for (index = 0; index < sizeof humanclass1_models; index++)
zp_class_human_register_model(g_human_invul, humanclass1_models[index])
MsgSayText = get_user_msgid("SayText")
g_MsgScreenFade = get_user_msgid("ScreenFade")
g_maxplayers = get_maxplayers()
}
public fw_PlayerPressUse(id)
{
// log_to_file("test_god.log", "called press use");
if (zp_class_human_get_current(id) == g_human_invul)
{
// log_to_file("test_god.log", " test vars: %d %d %d %d %d", is_user_alive(id), zp_class_human_get_current(id) == g_human_invul, !zp_get_user_zombie(id), !zp_get_user_survivor(id), pev(id, pev_button) & IN_RELOAD);
if (is_user_alive(id) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id))
{
if (pev(id, pev_button) & IN_RELOAD) {
use_ability(id);
}
}
}
}
public roundStart()
{
for (new i = 1; i <= g_maxplayers; i++)
{
reset_values(i);
}
}
public ShowHUD(id)
{
new id = TASKID_WAIT_HUD;
if (is_user_alive(id))
{
new Float:flGameTime = get_gametime();
log_to_file("test_god.log", "ShowHud %f %f %f", flGameTime, g_flGodmode_spelltime[id], g_flGodmode_cooldown[id]);
new szText[64];
// Cooldown
if (g_flGodmode_cooldown[id] > flGameTime) {
formatex(szText, charsmax(szText), "[Перезарядка: %.0f]", g_flGodmode_cooldown[id] - flGameTime);
log_to_file("test_god.log", "ShowHud Reload set");
}
// время действия спелла неуязв.
if (g_flGodmode_spelltime[id]) {
if (g_flGodmode_spelltime[id] < flGameTime) {
set_user_rendering(id);
set_user_godmode(id, 0);
g_flGodmode_spelltime[id] = 0.0;
log_to_file("test_god.log", "ShowHud Spell reset");
}
else {
formatex(szText, charsmax(szText), "[Неуязвимость: %.0f]", g_flGodmode_spelltime[id] - flGameTime);
}
}
if (szText[0] != EOS) {
set_hudmessage(200, 100, 0, 0.80, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(id, szText);
}
else {
remove_task(id);
g_flGodmode_spelltime[id] = 0.0;
g_flGodmode_cooldown[id] = 0.0;
log_to_file("test_god.log", "ShowHud CD & task reset");
}
}
else
{
reset_values(id);
log_to_file("test_god.log", "ShowHud Task reset on death");
}
}
public use_ability(id)
{
// log_to_file("test_god.log", "Ability Use Called");
new Float:flGameTime = get_gametime();
// if (!g_flGodmode_cooldown[id] && g_flGodmode_cooldown[id] > flGameTime)
if (!g_flGodmode_cooldown[id])
{
orange_screen(id)
set_user_rendering(id, kRenderFxGlowShell, 255, 165, 0, kRenderNormal, 0)
g_flGodmode_cooldown[id] = flGameTime + alt_cooldown + godmode_time; // Время перезарядки начинается после окончания спела неуязв.
g_flGodmode_spelltime[id] = flGameTime + godmode_time;
set_user_godmode(id, 1)
client_print(id, print_chat, "[TEST] - Ability used")
set_task(1.0, "ShowHUD", id + TASKID_WAIT_HUD, _, _, .flags = "b");
}
else {
client_print(id, print_center, "[ Перезарядка: %.0f ]", g_flGodmode_cooldown[id] - flGameTime);
}
}
public orange_screen(id)
{
message_begin(MSG_ONE, g_MsgScreenFade, _, id)
write_short(FADE_TIME)
write_short(HOLD_TIME)
write_short(FADE_IN)
write_byte(R)
write_byte(G)
write_byte(B)
write_byte(FADE_ALPHA)
message_end()
}
public reset_values(id)
{
remove_task(id + TASKID_WAIT_HUD);
g_flGodmode_cooldown[id] = 0.0;
g_flGodmode_spelltime[id] = 0.0;
if (is_user_connected(id)) {
set_user_rendering(id);
}
}
public zp_fw_core_cure_pre(id)
{
if (zp_class_human_get_next(id) == g_human_invul)
{
if (zp_level(id) < LVL_COUNT)
{
zp_colored_print(id, "^x01[^x04ZP^x01] Вы не достигли ^x04%d ^x01уровня!", LVL_COUNT)
zp_class_human_set_next(id, 0)
}
else
{
zp_class_human_set_next(id, g_human_invul)
}
}
}
public zp_fw_core_cure_post(id)
{
if ((zp_class_human_get_current(id) == g_human_invul) && !zp_get_user_zombie(id) && !zp_get_user_survivor(id))
{
reset_values(id);
}
}
public zp_fw_core_infect_post(id)
{
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id))
{
reset_values(id);
}
}
stock zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
if (!is_user_connected(player))
continue;
static changed[5], changedcount
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, MsgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
Немного ты описалсяL 06/16/2024 - 19:36:19: [AMXX] Run time error 4: index out of bounds
L 06/16/2024 - 19:36:19: [AMXX] [0] test.sma::reset_values (line 179)
L 06/16/2024 - 19:36:19: [AMXX] [1] test.sma::ShowHUD (line 134)
new id = TASKID_WAIT_HUD;
Надо былоНемного ты описался
new id = TASKID_WAIT_HUD;
public ShowHUD(taskid)
{
new id = taskid - TASKID_WAIT_HUD;