I tried to convert a 4.3 zombie class and make it 5.0.8, for the most part I think I succeeded, if I didn't.. correct me please .. I have a warning and I don't know why it still appears
Code:
zp50_class_zombie_hunter.sma(66) : warning 213: tag mismatch
line 66 is here
Code:
g_hunter = zp_class_zombie_register(zclass_name, zclass_info, zclass_health, zclass_speed, zclass_gravity)
Code:
#include <amxmodx>
#include <fakemeta>
#if AMXX_VERSION_NUM < 180
#assert AMX Mod X v1.8.0 or later library required!
#endif
#include <hamsandwich>
/*================================================================================
[Zombie Plague 5.0 Includes]
=================================================================================*/
#include <zp50_class_zombie>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>
/*================================================================================
[Customizations]
=================================================================================*/
// Zombie Attributes
new const zclass_name[] = "Hunter"
new const zclass_info[] = "Hunting Humans"
new const zclass_model[] = "zp_zClass_Hunter"
new const zclass_clawmodel[] = "zp_zclass_Hunter.mdl"
const zclass_health = 5400
const zclass_speed = 250
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.0
new const leap_sound[4][] =
{
"zp_zclasses/zp_hunter/z_hunter1.wav",
"zp_zclasses/zp_hunter/z_hunter2.wav",
"zp_zclasses/zp_hunter/z_hunter3.wav",
"zp_zclasses/zp_hunter/z_hunter4.wav"
}
/*================================================================================
Customization ends here!
Any edits will be your responsibility
=================================================================================*/
// Variables
new g_hunter
// Arrays
new Float:g_lastleaptime[33]
// Cvar pointers
new cvar_force, cvar_cooldown
// Plugin info.
#define PLUG_VERSION "0.2"
#define PLUG_AUTHOR "!"
/*================================================================================
[Init, CFG and Precache]
=================================================================================*/
public plugin_precache()
{
// Register the new class and store ID for reference
new index
g_hunter = zp_class_zombie_register(zclass_name, zclass_info, zclass_health, zclass_speed, zclass_gravity)
zp_class_zombie_register_kb(g_hunter, zclass_knockback)
for (index = 0; index < sizeof zclass_model; index++)
zp_class_zombie_register_model(g_hunter, zclass_model[index])
for (index = 0; index < sizeof zclass_clawmodel; index++)
zp_class_zombie_register_claw(g_hunter, zclass_clawmodel[index])
// Sound
static i
for(i = 0; i < sizeof leap_sound; i++)
precache_sound(leap_sound[i])
}
public plugin_init()
{
// Plugin Info
register_plugin("[ZP] Hunter", PLUG_VERSION, PLUG_AUTHOR)
// Forward
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
// Cvars
cvar_force = register_cvar("zp_hunter_jump_force", "600")
cvar_cooldown = register_cvar("zp_hunter_jump_cooldown", "10.0")
}
/*================================================================================
[Zombie Plague Forwards]
=================================================================================*/
public zp_user_infected_post(id, infector)
{
// It's the selected zombie class
if(zp_class_zombie_get_current(id) == g_hunter && !zp_class_nemesis_get(id))
{
// Message
ColorChat(id, "^4[Hunter]^1 To use the super jump ability press - ^4[CTRL + E]")
ColorChat(id, "^4[Hunter]^1 You can use the ability every^4 10 seconds.")
}
}
/*================================================================================
[Main Forwards]
=================================================================================*/
public fw_PlayerPreThink(id)
{
if(!is_user_alive(id))
return
if(zp_class_nemesis_get(id))
return
if(is_user_connected(id) && zp_class_zombie_get_current(id))
{
if (allowed_hunterjump(id))
{
static Float:velocity[3]
velocity_by_aim(id, get_pcvar_num(cvar_force), velocity)
set_pev(id, pev_velocity, velocity)
emit_sound(id, CHAN_STREAM, leap_sound[random_num(0, sizeof leap_sound -1)], 1.0, ATTN_NORM, 0, PITCH_HIGH)
// Set the current super jump time
g_lastleaptime[id] = get_gametime()
}
}
}
/*================================================================================
[Internal Functions]
=================================================================================*/
allowed_hunterjump(id)
{
if (!zp_class_zombie_get_current(id) && zp_class_nemesis_get(id))
return false
if (zp_class_zombie_get_current(id) != g_hunter)
return false
if (!((pev(id, pev_flags) & FL_ONGROUND) && (pev(id, pev_flags) & FL_DUCKING)))
return false
static buttons
buttons = pev(id, pev_button)
// Not doing a longjump (added bot support)
if (!(buttons & IN_USE) && !is_user_bot(id))
return false
static Float:cooldown
cooldown = get_pcvar_float(cvar_cooldown)
if (get_gametime() - g_lastleaptime[id] < cooldown)
return false
return true
}
stock ColorChat(id, String[], any:...)
{
static szMesage[192];
vformat(szMesage, charsmax(szMesage), String, 3);
replace_all(szMesage, charsmax(szMesage), "!1", "^1");
replace_all(szMesage, charsmax(szMesage), "!3", "^3");
replace_all(szMesage, charsmax(szMesage), "!4", "^4");
static g_msg_SayText = 0;
if(!g_msg_SayText)
g_msg_SayText = get_user_msgid("SayText");
new Players[32], iNum = 1, i;
if(id) Players[0] = id;
else get_players(Players, iNum, "ch");
for(--iNum; iNum >= 0; iNum--)
{
i = Players[iNum];
message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
write_byte(i);
write_string(szMesage);
message_end();
}
}