Привет всем, у меня есть свой класс для людей, который имеет способность: длинный прыжок (longjump). Но эта способность срабатывает, если я зомби / выживший. Прошу помочь с проверкой на этих троих. Пробовал сам, но все без успеха.
C++:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zp50_core>
#include <zp50_gamemodes>
#include <zp50_class_human>
#include <zp50_class_survivor>
// Vip Human Attributes
new const humanclass1_name[] = "Creator Human"
new const humanclass1_info[] = "HP + ARMOR + LJ + DMG 1.5x"
new const humanclass1_models[][] = { "leet" }
const humanclass1_health = 255
const Float: humanclass1_speed = 1.0
const Float: humanclass1_gravity = 1.0
new g_human_creator
new g_GameModeSurvivorID
new LongJump[33]
public plugin_precache()
{
register_plugin("[ZP] Class Human: CREATOR", ZP_VERSION_STRING, "_RedGamer_")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
g_human_creator = 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_creator, humanclass1_models[index])
}
public plugin_cfg()
{
g_GameModeSurvivorID = zp_gamemodes_get_id("Survivor Mode")
}
public zp_fw_gamemodes_start(Gamemode)
{
new id
for (id = 1; id <= get_maxplayers(); id++)
{
if(is_user_connected(id) && ~zp_core_is_zombie(id) && (Gamemode != g_GameModeSurvivorID) && (zp_class_human_get_current(id) == g_human_creator))
set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue) + 250, 999)))
}
}
public ShowHUD(id)
{
if(is_user_alive(id))
{
set_hudmessage(200, 100, 0, 0.80, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id, "[Длинный прыжок: %d]", LongJump[id])
}
else
{
remove_task(id)
}
}
public fw_PlayerPreThink(id)
{
new Float: Time = get_gametime()
static Float: iRate[33]
if(LongJump[id] > 0){
if(iRate[id] < Time){
iRate[id] = Time + 1.0
LongJump[id]--
set_task(0.1, "ShowHUD", id, _, _, "a", LongJump[id])
}
return FMRES_IGNORED
}
if(is_user_alive(id) && zp_class_human_get_current(id) == g_human_creator){
if(pev(id, pev_button) & IN_JUMP && !(pev(id, pev_oldbuttons) & IN_JUMP) && pev(id, pev_button) & IN_DUCK && !(pev(id, pev_oldbuttons) & IN_DUCK) && pev(id, pev_flags) & FL_ONGROUND)
{
new Float: iVelocity[3]
velocity_by_aim(id, 500, iVelocity)
iVelocity[2] = 300.0
if(pev(id, pev_button) & IN_BACK)
{
iVelocity[0] *= -1
iVelocity[1] *= -1
}
set_pev(id, pev_velocity, iVelocity)
LongJump[id] = 6
}
}
return FMRES_IGNORED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(is_user_alive(attacker) && victim != attacker){
if(!zp_core_is_zombie(attacker) && get_user_weapon(attacker) && zp_class_human_get_current(attacker) == g_human_creator)
{
SetHamParamFloat(4, damage * 1.5)
}
}
}
C++:
public fw_PlayerPreThink(id)
{
new Float: Time = get_gametime()
static Float: iRate[33]
if(LongJump[id] > 0){
if(iRate[id] < Time){
iRate[id] = Time + 1.0
LongJump[id]--
set_task(0.1, "ShowHUD", id, _, _, "a", LongJump[id])
}
return FMRES_IGNORED
}
if(is_user_alive(id) && zp_class_human_get_current(id) == g_human_creator){
if(pev(id, pev_button) & IN_JUMP && !(pev(id, pev_oldbuttons) & IN_JUMP) && pev(id, pev_button) & IN_DUCK && !(pev(id, pev_oldbuttons) & IN_DUCK) && pev(id, pev_flags) & FL_ONGROUND)
{
new Float: iVelocity[3]
velocity_by_aim(id, 500, iVelocity)
iVelocity[2] = 300.0
if(pev(id, pev_button) & IN_BACK)
{
iVelocity[0] *= -1
iVelocity[1] *= -1
}
set_pev(id, pev_velocity, iVelocity)
LongJump[id] = 6
}
}
return FMRES_IGNORED
}