AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help please! (https://forums.alliedmods.net/showthread.php?t=343836)

ZentarisChaoz 09-06-2023 22:28

Help please!
 
1 Attachment(s)
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)
}
}
}

fysiks 09-06-2023 23:04

Re: Help please!
 
Since you're new, you'll want to learn how to post code in these forums. If you do post code or a code snippet in a post, you need to put it in [code][/code] or [php][/php] tags. I generally also say that if the code is short, add it in the post but if it's a longer plugin, simply attach the .sma file (no need to do both).

Also, when you are going to post about a compilation error, you need to post the error (the full output of the compiler) using [code][/code] tags. This is because not everybody will be able to even attempt to compile your plugin due to using non-default include files.

If you have a link to the original plugin, that can also help.

henrybolton1 09-14-2023 09:21

Re: Help please!
 
Hello friends, I have pretty similar question..can someone help me please? Providing an essay pro review is essential for transparency in the academic writing industry. Be honest about your experiences, both positive and negative, to guide others in their choices.

Mo3taz 09-14-2023 09:59

Re: Help please!
 
@henrybolton1
make a topic and add your questions

Mo3taz 09-14-2023 10:07

Re: Help please!
 
symbol "zp_zombie_class_textadd" is undefined
you have to define it
post your zombieplague include
or try this one:
Code:

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]")
                        ChatColor(id, "[Lock Human Weapon > G]")
                else
                {
                        //zp_zombie_class_textadd("\r[Access Denied (VIP Only)]")
                        ChatColor(id, "[Access Denied (VIP Only)]")
                        return ZP_PLUGIN_HANDLED
                }
        }
        return PLUGIN_CONTINUE
}


mlibre 09-15-2023 15:14

Re: Help please!
 

CrazY. 09-21-2023 19:48

Re: Help please!
 
Please attach your zombieplague.inc and zmvip.inc, the zp_zombie_class_textadd is likely not defined that's why you are getting that error


All times are GMT -4. The time now is 05:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.