OciXCrom, I need your help again, I'm using a zombie from ZP 4.3 to ZP 5.0, and I would like to add a level requirement to it. That if the player doesn't have enough level he won't get the zombie level, but even using what you said on page 58, it's still possible to select him. I think you need to put in the classes menu that if the player doesn't have enough level for the zombie, and the infection round starts, he will automatically change the zombie to level 0. In this case, the first zombie on the list that doesn't have any requirement
Your code:
PHP Code:
#include <crxranks>
const zombieclass_unlock_level = 15
public zp_fw_class_zombie_select_pre(id, iClass)
{
if(iClass == g_ZombieClassID)
{
if(crxranks_get_user_level(id) < zombieclass_unlock_level)
{
return ZP_CLASS_NOT_AVAILABLE
}
}
return ZP_CLASS_AVAILABLE
}
Zombie Class ZP 4.3 para 5.0 (?):
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "NST Zombie Class Heal"
#define VERSION "1.0"
#define AUTHOR "NST"
new const zclass_name[] = "Iyilesen Zombi (Heal)"
new const zclass_info[] = "[Yetenek Icin 'G']"
new const zclass_model[] = "zombie_healerl"
new const zclass_clawmodel[] = "v_knife_zombie_healer.mdl"
const zclass_health = 15000
const zclass_speed = 300
const Float:zclass_gravity = 0.68
const Float:zclass_knockback = 3.00
new idclass
new const zombie_sound_heal[] = "df_sr/zombi_heal.wav"
new const zombie_sound_healteam[] = "df_sr/td_heal.wav"
const Float:heal_timewait = 10.0
const Float:heal_dmg = 0.3
const heal_dmg_team = 500
new idsprites_heal
new g_heal_wait[33]
new g_msgDamage, g_msgScreenFade, g_msgSayText
new g_maxplayers
new g_roundend
enum (+= 100)
{
TASK_WAIT_HEAL = 2000,
TASK_BOT_USE_SKILL
}
#define ID_WAIT_HEAL (taskid - TASK_WAIT_HEAL)
#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)
public plugin_precache()
{
precache_sound(zombie_sound_heal)
precache_sound(zombie_sound_healteam)
idsprites_heal = precache_model("sprites/zb_restore_health.spr")
idclass = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("DeathMsg", "Death", "a")
register_logevent("logevent_round_end", 2, "1=Round_End")
register_clcmd("drop", "cmd_heal")
g_msgDamage = get_user_msgid("Damage")
g_msgScreenFade = get_user_msgid("ScreenFade")
g_msgSayText = get_user_msgid("SayText")
g_maxplayers = get_maxplayers()
}
public client_putinserver(id)
{
reset_value_player(id)
}
public client_disconnect(id)
{
reset_value_player(id)
}
public event_round_start()
{
g_roundend = 0
for (new id=1; id<=g_maxplayers; id++)
{
if (!is_user_connected(id)) continue;
reset_value_player(id)
}
}
public logevent_round_end()
{
g_roundend = 1
}
public Death()
{
new victim = read_data(2)
reset_value_player(victim)
}
public zp_user_infected_post(id)
{
reset_value_player(id)
if(zp_get_user_nemesis(id)) return;
if(zp_get_user_zombie_class(id) == idclass)
{
if(is_user_bot(id))
{
set_task(random_float(5.0,15.0), "bot_use_skill", id+TASK_BOT_USE_SKILL)
return
}
zp_colored_print(id, "^x04[ZE]^x01 Sinifinin yetenegi Iyilestirme. Yuklenme suresi %.1f saniye.", heal_timewait)
}
}
public zp_user_humanized_post(id)
{
reset_value_player(id)
}
public cmd_heal(id)
{
if (g_roundend) return PLUGIN_CONTINUE
if (!is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_nemesis(id)) return PLUGIN_CONTINUE
if (zp_get_user_zombie_class(id) == idclass && !g_heal_wait[id])
{
new start_health = zp_get_zombie_maxhealth(id)
if (get_user_health(id)>=start_health) return PLUGIN_CONTINUE
g_heal_wait[id] = 1
new Float:health, Float:heath_up, health_set
health = float(get_user_health(id))
heath_up = health*heal_dmg
health_set = floatround(health) + max(heal_dmg_team, floatround(heath_up))
health_set = min(start_health, health_set)
fm_set_user_health(id, health_set)
UpdateHealthZombieTeam(id)
PlaySound(id, zombie_sound_heal)
EffectRestoreHealth(id)
set_task(heal_timewait, "RemoveWaitSmoke", id+TASK_WAIT_HEAL)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public bot_use_skill(taskid)
{
new id = ID_BOT_USE_SKILL
if (!is_user_alive(id)) return;
cmd_heal(id)
set_task(random_float(5.0,15.0), "bot_use_skill", id+TASK_BOT_USE_SKILL)
}
public RemoveWaitSmoke(taskid)
{
new id = ID_WAIT_HEAL
g_heal_wait[id] = 0
zp_colored_print(id, "^x04[ZE]^x01 Iyilestirme Yetenegin hazir.")
}
UpdateHealthZombieTeam(id)
{
for (new i = 1; i <= g_maxplayers; i++)
{
if (!is_user_alive(i) || zp_get_user_nemesis(i)) return;
if (zp_get_user_zombie(i) && i != id)
{
new current_health = get_user_health(i)
new start_health = zp_get_zombie_maxhealth(i)
if (current_health < start_health)
{
new health_new
health_new = min(start_health, (current_health+heal_dmg_team))
fm_set_user_health(i, health_new)
EffectRestoreHealth(i)
PlaySound(i, zombie_sound_healteam)
}
}
}
}
PlaySound(id, const sound[])
{
client_cmd(id, "spk ^"%s^"", sound)
}
fm_set_user_health(id, health)
{
(health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
}
EffectRestoreHealth(id)
{
if (!is_user_alive(id)) return;
static origin[3]
get_user_origin(id, origin)
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SPRITE)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]+30)
write_short(idsprites_heal)
write_byte(5)
write_byte(192)
message_end()
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade , _, id)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(255)
write_byte(0)
write_byte(0)
write_byte(75)
message_end()
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id)
write_byte(0)
write_byte(0)
write_long(DMG_NERVEGAS)
write_coord(0)
write_coord(0)
write_coord(0)
message_end()
}
reset_value_player(id)
{
g_heal_wait[id] = 0
remove_task(id+TASK_WAIT_HEAL)
remove_task(id+TASK_BOT_USE_SKILL)
}
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, g_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, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
I believe that a code can be placed here so that all humans who do not have enough level and select a zombie, in addition to the chat saying "You have no level for this class" after the random selection of zombies it will automatically change the zombie to class 1. (Class without requirements)
=====================
In general example [EXAMPLE]
1. Zombie Basic - Level 0
2. Zombie Advanced - Level 10
Player level: 2
He selects class 2.
Player has no level for class 2.
Infection done, class automatically changed to class 1.