Post by newandclueless on Mar 4, 2016 17:22:35 GMT
Mar 4, 2016 3:46:06 GMT zmd94 said:
Just change below:public remove_froz(player)
{
if(g_Frozed[player]) {
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0)
g_Frozed[player] = false
client_print(player, print_chat, "You are good to go now, move fast biiiiaaattcccchhhhhhh!")
// Update player's maxspeed
ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
}
}
-->
public remove_froz(player)
{
if(g_Frozed[player]) {
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0)
g_Frozed[player] = false
client_print(player, print_chat, "You are good to go now, move fast biiiiaaattcccchhhhhhh!")
// Update player's maxspeed
ExecuteHamB(Ham_Player_ResetMaxSpeed, player)
}
}
updated code:
/*================================================================================
[ZP] Class: eFrozen Zombie
v1.0
By: TheArmagedon
Cvar's:
** How much time the frozen? **
zp_efzm_frozen_time [TIME] - Default:10.0
** How much frozen zombie start? **
zp_efzm_frozen_start [AMOUNT] - Default:5
** Show the Menu? **
zp_efzm_menu [1/0] - Default: 1
* If 1 show the menu / If 0 automatic Hability on E *
================================================================================*/
// Includes
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <fun>
#include <hamsandwich>
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame
// Plugin version
#define VERSION "0.2"
// Variables
new g_Frozed[33], g_iFroz[33], g_frozid[33], timeFr[33], frozenable[33];
new Ebinded[33];
new frozentime, howmcfroz, g_SPR, menufr;
// Zombie Attributes
new const zclass_name[] = { "Freezer Zombie" }
new const zclass_info[] = { "Can freeze [R]" }
new const zclass_model[] = { "zm_cold2" }
new const zclass_clawmodel[] = { "v_hands_zm_cold3.mdl" }
const zclass_health = 2900
const zclass_speed = 270
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 0.70
// Class ID
new g_zclassid1
public plugin_init()
{
// Plugin Register
register_plugin("[ZP] eFrozen Zombie", VERSION, "TheArmagedon")
// Events | Cvars | Forward | Others
frozentime = register_cvar("zp_efzm_frozen_time", "10.0")
howmcfroz = register_cvar("zp_efzm_frozen_start", "5")
menufr = register_cvar("zp_efzm_menu", "0") // If 1 show the menu | If 0 automatic Hability on E (R NOW)
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
RegisterHam(Ham_TakeDamage, "player", "player_damage")
register_forward(FM_CmdStart, "CmdStart" )
register_event("DeathMsg", "eventD", "a")
}
public plugin_precache()
{
// Register Plugin
register_plugin("[ZP] eFrozen Zombie", VERSION, "TheArmagedon")
register_cvar("zp_eFrozen", VERSION, FCVAR_SPONLY|FCVAR_SERVER)
set_cvar_string("zp_eFrozen", VERSION)
// Class Register
g_zclassid1 = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
g_SPR = precache_model("sprites/zbeam4.spr")
}
public client_disconnect(id)
{
g_Frozed[id] = false;
g_frozid[id] = false;
}
public client_connect(id)
{
g_Frozed[id] = false;
g_frozid[id] = false;
}
public eventD()
{
new id = read_data(2)
if(frozenable[id])
{
g_Frozed[id] = false
frozenable[id] = false
}
}
public fw_PlayerPreThink(id)
{
if(!is_user_alive(id))
return;
// Frozen Command
if(g_Frozed[id])
{
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
set_pev(id, pev_maxspeed, 1.0)
}
}
public zp_user_humanized_post(id)
frozenable[id] = false
// User Infected forward
public zp_user_infected_post(id, infector)
{
// Check if the infected player is using our custom zombie class
if (zp_get_user_zombie_class(id) == g_zclassid1)
{
client_print(id, print_chat, "[Freezer ZM] You're using freezer zombie. %s.", get_pcvar_num(menufr) ? "You can freeze bitches now." : "Press [R] to freeze 'em.")
g_iFroz[id] = get_pcvar_num(howmcfroz);
frozenable[id] = true
if(get_pcvar_num(menufr) == 1) {
menuItem(id)
Ebinded[id] = false
} else {
Ebinded[id] = true
}
if(!Ebinded[id])
set_task(5.0, "menuItem", id)
}
else
{
g_Frozed[id] = false
frozenable[id] = false
}
}
public menuItem(id)
{
if(is_user_alive(id)) {
if(frozenable[id]) {
if(get_pcvar_num(menufr) == 1) {
new menu = menu_create("Freezer Zombie: Menu:", "choosemenuItem")
menu_additem(menu, "\wUse", "1", 0)
menu_additem(menu, "\wUse on \rR \wKey^n^n", "2", 0)
new szText[40]
format(szText, sizeof szText -1, "\yFreezes left: \r%i", g_iFroz[id])
menu_additem(menu, szText, "3", 0)
menu_setprop(menu, MPROP_EXITNAME, "Exit")
menu_display(id, menu, 0)
}
}
}
}
public choosemenuItem(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
switch(str_to_num(data))
{
case 1:
{
if(is_user_alive(id)) {
g_iFroz[id] ? frozen(id) : client_print(id, print_console, "[ZP] Awh man, sorry to break your balls but you have used up all your ice to cool the bong!")
if(g_iFroz[id] > 0) {
set_task(2.0, "menuItem", id)
} else
client_print(id, print_chat, "[Freezer ZM] You freezing bitches is over.")
}
}
case 2:
{
if(is_user_alive(id)) {
Ebinded[id] = true
}
}
case 3:
{
menuItem(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public frozen(id)
{
if(!g_iFroz[id])
return HAM_IGNORED;
if(!frozenable[id])
return HAM_IGNORED;
if(!zp_get_user_zombie(id))
return HAM_IGNORED;
new player, body
get_user_aiming(id, player, body)
g_frozid[id] = true
dois_wave(id)
if(!is_user_connected(player) || !is_user_alive(player))
return HAM_IGNORED;
new parms[2]
parms[0] = id
parms[1] = player
set_task(0.2, "frozed", 0, parms, 2)
return HAM_IGNORED;
}
public frozed(parm[])
{
new id = parm[0]
new player = parm[1]
if(!is_user_connected(id) || !is_user_connected(player))
return
if(zp_get_user_zombie(player))
return
if(!zp_get_user_zombie(id))
return
if(zp_get_user_nemesis(id))
return
if(zp_get_user_survivor(player))
return
if(g_Frozed[player]) {
client_print(id, print_chat, "[Freezer ZM] Bitch already frozen")
return
}
g_iFroz[id]--
client_print(id, print_chat, "[Freezer ZM] %i Ice cubes left you need to keep the rest to cool down the bong because you're smoking like a chimney ." ,g_iFroz[id])
g_Frozed[player] = true
set_user_rendering(player, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
set_task(get_pcvar_float(frozentime), "remove_froz", player)
client_print(player, print_chat, "Haha you fucking sucker, you're frozen. (Unfrozen in %d Seconds)", get_pcvar_num(frozentime));
}
public remove_froz(player)
{
if(g_Frozed[player]) {
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0)
g_Frozed[player] = false
client_print(player, print_chat, "You are good to go now, move fast biiiiaaattcccchhhhhhh!")
// Update player's maxspeed
ExecuteHamB(Ham_Player_ResetMaxSpeed, player)
}
}
// Froz Skill
public dois_wave(id)
{
if(g_frozid[id]) {
if(frozenable[id]) {
new aimvec[3]
new damradius = 50
if( !is_user_alive(id) ) return
get_user_origin(id, aimvec, 3)
beam_effectz(id, aimvec, damradius)
set_task(1.5, "gfrozfalse", id)
}
}
}
public gfrozfalse(id)
g_frozid[id] = false
public beam_effectz(id, aimvec[3], damradius)
{
if(g_frozid[id]) {
new beamWidth
//Change sprite size according to blast radius
new blastSize = floatround(damradius / 12.0)
if (blastSize <= 18) {
beamWidth = 50
}
else {
beamWidth = 75
}
//Beam
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(1) //TE_BEAMENTPOINTS
write_short(id) //ent
write_coord(aimvec[0]) //position
write_coord(aimvec[1])
write_coord(aimvec[2])
write_short(g_SPR) // sprite index
write_byte(0) // start frame
write_byte(35) // framerate
write_byte(4) // life
write_byte(beamWidth) // width
write_byte(0) // noise
write_byte(0) // red (rgb color)
write_byte(100) // green (rgb color)
write_byte(200) // blue (rgb color)
write_byte(215) // brightness
write_byte(21) // speed
message_end()
}
}
public player_damage(victim, ent, attacker, Float:damage, bits)
{
if(!is_user_connected(victim) || !is_user_connected(attacker))
return HAM_IGNORED;
if(g_Frozed[attacker])
return HAM_SUPERCEDE;
return HAM_IGNORED;
}
public CmdStart( const id, const uc_handle, random_seed ) {
if(is_user_alive(id))
{
new buttons = pev(id, pev_button)
new oldbuttons = pev(id, pev_oldbuttons)
if(Ebinded[id]) {
if(buttons & IN_RELOAD) {
if(g_iFroz[id] > 0) {
if(!timeFr[id]) {
timeFr[id] = true
set_task(5.0, "RmvTask", id)
frozen(id)
}
}
}
}
if(Ebinded[id]) {
if(oldbuttons & IN_RELOAD && !(buttons & IN_RELOAD)) {
if(g_iFroz[id] > 0) {
if(!timeFr[id]) {
timeFr[id] = true
set_task(5.0, "RmvTask", id)
frozen(id)
}
}
}
}
}
return FMRES_IGNORED
}
public RmvTask(id)
timeFr[id] = false
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/