Senior Member
|
08-02-2020
, 22:48
Plugin's commands and hud messages arent shown
|
#1
|
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <zombieplague>
#define PLUGIN "Regular Zombie CSO-LIKE"
#define VERSION "1.0"
#define AUTHOR "DeclineD"
new cooldown[33]
new cooldown2[33]
new const hp = 15000
new const speed = 240
new Float:gravity = 0.300
new Float:knockback = 1.0
new Ready[33]
new Ready2[33]
new abilityended[33]
new abilitystarted[33]
new Float:ability1cooldown = 20.0
new Float:ability2cooldown = 10.0
new g_ent_playermodel[33]
new regular
new const zombieh[] = { "v_regular.mdl" }
new const zombiemodel1[] = { "regularzombie" }
new const zombiemodel2[] = { "regularzombiehost"}
new const bothmodels[] = { "regularzombie", "regularzombiehost" }
new const ability1start[] = { "csolike/start.wav" }
new const ability2sound[] = { "csolike/ability2.wav" }
new const ability1end[] = { "csolike/end.wav" }
new const infectsound[] = { "csolike/regularinfect.wav" }
new const hit[] = { "csolike/hit1.wav", "csolike/hit2.wav"}
new const deathsound[] = { "csolike/death1.wav", "csolike/death2.wav" }
new const health[] = {
2000,
3000,
4000,
5000
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("+drop","ability1")
register_clcmd("+reload","ability2")
register_concmd("+drop","ability1")
register_concmd("+reload","ability2")
RegisterHam(Ham_TakeDamage,"player","dmg")
register_event("DeathMsg","death","a")
regular = zp_register_zombie_class("Regular Zombie","\r[\yCSO-LIKE\r] [\yBerserk\r|\yReproduce\r]",bothmodels ,zombieh,hp,speed,gravity,knockback)
}
public plugin_precache()
{
precache_sound(ability1start)
precache_sound(ability1end)
precache_sound(ability2sound)
precache_sound(infectsound)
precache_sound(hit)
precache_sound(deathsound)
precache_model("models/player/regularzombiehost/regularzombiehost.mdl")
precache_model("models/player/regularzombie/regularzombie.mdl")
}
public ability1(id)
{
if(is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && !zp_get_user_nemesis(id))
{
new Float:uspeed = 1000.0
if(Ready[id] == 1)
{
client_cmd(id,"cl_forwardspeed 1600")
client_cmd(id,"cl_backspeed 1600")
set_user_maxspeed(id, uspeed)
cooldown[id] = 21
Ready[id] = 0
abilitystarted[id] = 1
abilityended[id] = 0
set_task(ability1cooldown,"ready",id)
}
else client_print(id,print_chat,"[Ability] Wait 'till ability is ready")
}
}
public ability2(id)
{
if(zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && zp_get_user_nemesis(id))
{
new healthnum
if(Ready2[id] == 1)
{
healthnum = random_num(0,charsmax(health))
set_pev(id, pev_health, float(pev(id, pev_health) + health[healthnum]))
Ready2[id] = 0
emit_sound(id, CHAN_STREAM, ability1start, 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(ability2cooldown,"ready2",id)
}
else client_print(id,print_chat,"[Ability] Wait 'till ability is ready")
}
}
public hud(id)
{
if(Ready[id] == 1)
{
set_hudmessage(170, 255, 85, -1.0, 0.85, 0, 6.0, 0.4,0.1,0.1)
show_hudmessage(id, "[Berserk - Ready] [G]")
}
if(Ready[id] == 0)
{
set_hudmessage(170, 255, 85, -1.0, 0.85, 0, 6.0, 0.5,0.1,0.1)
show_hudmessage(id, "[Berserk - %d] [G]",cooldown[id] - 1)
}
if(Ready2[id] == 1)
{
set_hudmessage(255, 0, 0, -1.0, 0.91, 0, 6.0, 0.4,0.1,0.1)
show_hudmessage(id, "[Reproduce - Ready] [R]")
}
if(Ready2[id] == 0)
{
set_hudmessage(255, 0, 0, -1.0, 0.91, 0, 6.0, 0.4,0.1,0.1)
show_hudmessage(id, "[Reproduce - %d] [R]",cooldown2[id] - 1)
}
if(abilityended[id] == 1)
{
abilityended[id] = 0
emit_sound(id, CHAN_STREAM, ability1end, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
public ready(id)
{
Ready[id] = 1
abilityended[id] = 1
abilitystarted[id] = 0
}
public ready2(id)
{
Ready2[id] = 1
}
public death(id)
{
if(is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && !zp_get_user_nemesis(id))
{
emit_sound(id, CHAN_STREAM, deathsound, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
public zp_user_infected_post(id)
{
if(zp_get_user_zombie_class(id) == regular && zp_get_user_zombie(id) && zp_get_user_nemesis(id))
{
if(zp_get_user_first_zombie(id))
{
fm_set_playermodel_ent(id,zombiemodel2,0)
}
else fm_set_playermodel_ent(id,zombiemodel1,0)
Ready[id] = 1
Ready2[id] = 1
set_task(0.5,"hud",id,_,_,"b")
emit_sound(id,CHAN_STREAM,infectsound,1.0,ATTN_NORM,0,PITCH_NORM)
}
}
public dmg(victim, inflictor, id, Float:damage, damagebits)
{
new Zombie[33]
new class[33]
new Human[33]
Zombie[id] = zp_get_user_zombie(id)
Human[id] = !zp_get_user_zombie(id)
class[id] = zp_get_user_zombie_class(id) == regular
if(Zombie[id] == inflictor && class[id])
{
if(abilityended[id] == 0)
{
SetHamParamFloat(4,damage * 2.0)
}
else if(abilityended[id] == 1)
{
SetHamParamFloat(4,damage * 1.0)
}
}
if(Human[id] == inflictor)
{
emit_sound(id,CHAN_STREAM,hit,1.0,ATTN_NORM,0,PITCH_NORM)
}
}
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
static Float:color[3]
color[0] = float(r)
color[1] = float(g)
color[2] = float(b)
set_pev(entity, pev_renderfx, fx)
set_pev(entity, pev_rendercolor, color)
set_pev(entity, pev_rendermode, render)
set_pev(entity, pev_renderamt, float(amount))
}
stock fm_set_playermodel_ent(id, const modelname[],anim)
{
fm_set_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
static modelpath[100]
formatex(modelpath, sizeof modelpath - 1, "models/player/%s/%s.mdl", modelname, modelname)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
if (!pev_valid(g_ent_playermodel[id])) return
set_pev(g_ent_playermodel[id], pev_classname, "regular_classname")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_animtime, get_gametime()+0.1)
set_pev(g_ent_playermodel[id], pev_framerate, 1.0)
set_pev(g_ent_playermodel[id], pev_sequence, anim)
set_pev(g_ent_playermodel[id], pev_owner, id)
}
engfunc(EngFunc_SetModel, g_ent_playermodel[id], modelpath)
}
idk what to do now, i even upgraded to amxx 1.8.3... but nothing
SO
the plugin's commands doesn t work idk why and the plugin's hud messages aren t shown.
The code seems to be fine but when i try use it doesn't work,
I want to mention that im using zp 4.3 patched from moddb , i will try use zp 4.3 fix5a instead to see if that s the problem
Last edited by AnimalMonster; 08-03-2020 at 00:17.
|
|