Thread: Help please!
View Single Post
Author Message
ZentarisChaoz
BANNED
Join Date: Sep 2023
Old 09-06-2023 , 22:28   Help please!
Reply With Quote #1

I'm new to the world of scripting. When I want to add addtext in a zombie class it won't let me and gives me compilation error.


#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <zombieplague>
#include zmvip

new const zclass_name[] = "Lockerz Zombie" // name
new const zclass_info[] = "" // description
new const zclass_model[] = "silent_zm_lockerz" // model
new const zclass_clawmodel[] = "v_knife_lockerz.mdl" // claw model
const zclass_health = 3000 // health
const zclass_speed = 300 // speed
const Float:zclass_gravity = 0.65 // gravity
const Float:zclass_knockback = 1.0 // knockback

// Class IDs
new g_lockerz

// Main var
new beam
new bool:can_lock[33]
new bool:target_locked[33]

// Main cvar
new cvar_distance
new cvar_cooldown
new cvar_cooldown_target

public plugin_init()
{
register_plugin("[ZP] Zombie Class: Lockerz Zombie", "1.0", "Dias Leon")
register_clcmd("drop", "lock_now")
register_forward(FM_CmdStart, "fw_Start")
cvar_distance = register_cvar("lz_distance", "750")
cvar_cooldown = register_cvar("lz_cooldown_time", "30.0")
cvar_cooldown_target = register_cvar("lz_cooldown_target_time", "10.0")
}

public plugin_precache()
{
g_lockerz = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
beam = precache_model("sprites/lgtning.spr")
}
public zp_zombie_class_selected_pre(id, classid)
{
if(classid == g_lockerz)
{
if(zv_get_user_flags(id))
zp_zombie_class_textadd("\y[Lock Human Weapon > G]")
else
{
zp_zombie_class_textadd("\r[Access Denied (VIP Only)]")
return ZP_PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public zp_user_infected_post(id, infector)
{
if(zp_get_user_zombie_class(id) == g_lockerz)
{
ChatColor(id, "!g[ZP] !yAim the player you want to block that him weapon, And Press (G) !!!")
can_lock[id] = true
}
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!r", "^3")
replace_all(msg, 190, "!b", "^0")

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), {0,0,0}, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
public zp_user_humanized_post(id)
{
if(is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_lockerz)
{
can_lock[id] = false
}
}

public lock_now(id)
{
if(is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_lockerz && !zp_get_user_nemesis(id))
{
if(is_user_alive(id) && can_lock[id] == true)
{
new target1, body1
static Float:start1[3]
static Float:end1[3]

pev(id, pev_origin, start1)
start1[2] += 16.0
fm_get_aim_origin(id, end1)
end1[2] += 16.0

get_user_aiming(id, target1, body1, cvar_distance)
if(is_user_alive(target1) && !zp_get_user_zombie(target1) && !zp_get_user_survivor(target1))
{
lock_target(target1)
ChatColor(id, "!g[ZP] !yTarget Locked !g[Hit]")
} else {
ChatColor(id, "!g[ZP] !yTarget not Locked !g[Miss]")
}
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(0)
engfunc(EngFunc_WriteCoord, start1[0])
engfunc(EngFunc_WriteCoord, start1[1])
engfunc(EngFunc_WriteCoord, start1[2])
engfunc(EngFunc_WriteCoord, end1[0])
engfunc(EngFunc_WriteCoord, end1[1])
engfunc(EngFunc_WriteCoord, end1[2])
write_short(beam)
write_byte(0)
write_byte(30)
write_byte(20)
write_byte(50)
write_byte(50)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(100)
write_byte(50)
message_end()

can_lock[id] = false
set_task(get_pcvar_float(cvar_cooldown), "ability_reload", id)
} else {
if(is_user_alive(id) && can_lock[id] == false)
{
ChatColor(id, "!g[ZP] !yYou can't use your ability right now. Please waiting for %i", get_pcvar_num(cvar_cooldown))
}
}
}
}

public lock_target(id)
{
target_locked[id] = true

set_task(get_pcvar_float(cvar_cooldown_target ), "unlock_target", id)
ChatColor(id, "!g[ZP] !yYour weapons are locked, Now you can't fire. Please waiting for %i", get_pcvar_num(cvar_cooldown_target))

return PLUGIN_HANDLED
}

public ability_reload(id)
{
can_lock[id] = true
ChatColor(id, "!g[ZP] !yYou can use your ability again, Press (G)")
}

public unlock_target(id)
{
target_locked[id] = false
ChatColor(id, "!g[ZP] !yYour weapons are Unlocked, Now you can fire")

return PLUGIN_HANDLED
}

public fw_Start(id, uc_handle, seed)
{
if(is_user_alive(id) && target_locked[id] == true)
{
new button = get_uc(uc_handle,UC_Buttons)
if(button & IN_ATTACK || button & IN_ATTACK2)
{
set_uc(uc_handle,UC_Buttons,(button & ~IN_ATTACK) & ~IN_ATTACK2)
}
}
}
Attached Files
File Type: sma Get Plugin or Get Source (zp_zclass_lockerz.sma - 66 views - 5.2 KB)

Last edited by ZentarisChaoz; 09-06-2023 at 22:29.
ZentarisChaoz is offline