Raised This Month: $ Target: $400
 0% 

[Request] zclass conversion to ZP to BB


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 04-22-2018 , 11:07   [Request] zclass conversion to ZP to BB
Reply With Quote #1

I whanna convert this zm class to basebuilder mod. please help me..

Basebuilder inl
Code:
#if defined _basebuilder_included
  #endinput
#endif
#define _basebuilder_included

enum
{
	COLOR_RED = 0, 		//200, 000, 000
	COLOR_REDORANGE, 	//255, 083, 073
	COLOR_ORANGE, 		//255, 117, 056
	COLOR_YELLOWORANGE, 	//255, 174, 066
	COLOR_PEACH, 		//255, 207, 171
	COLOR_YELLOW, 		//252, 232, 131
	COLOR_LEMONYELLOW, 	//254, 254, 034
	COLOR_JUNGLEGREEN, 	//059, 176, 143
	COLOR_YELLOWGREEN, 	//197, 227, 132
	COLOR_GREEN, 		//000, 200, 000
	COLOR_AQUAMARINE, 	//120, 219, 226
	COLOR_BABYBLUE, 		//135, 206, 235
	COLOR_SKYBLUE, 		//128, 218, 235
	COLOR_BLUE, 		//000, 000, 200
	COLOR_VIOLET, 		//146, 110, 174
	COLOR_PINK, 		//255, 105, 180
	COLOR_MAGENTA, 		//246, 100, 175
	COLOR_MAHOGANY,		//205, 074, 076
	COLOR_TAN, 		//250, 167, 108
	COLOR_LIGHTBROWN, 	//234, 126, 093
	COLOR_BROWN, 		//180, 103, 077
	COLOR_GRAY, 		//149, 145, 140
	COLOR_BLACK, 		//000, 000, 000
	COLOR_WHITE 		//255, 255, 255
}

enum
{
	PUSHING = 1,
	PULLING
}

enum
{
	ATT_HEALTH = 0,
	ATT_SPEED,
	ATT_GRAVITY
}

/**
 * Returns whether Base Builder is active.
 */
stock is_basebuilder_active()
{
	if(!cvar_exists("bb_enabled"))
	{
		log_amx("Cvar: ^"bb_enabled^" does not exist.")
		return 0
	}
	return get_cvar_num("bb_enabled")
}

/**
 * Registers a custom class which will be added to the zombie classes menu of BB.
 *
 * Note: The returned zombie class ID can be later used to identify
 * the class when calling the bb_get_user_zombie_class() natives.
 *
 * @param name		Caption to display on the menu.
 * @param info		Brief description of the class.
 * @param model		Player model to be used.
 * @param clawmodel	Claws model to be used.
 * @param hp		Initial health points.
 * @param speed		Maximum speed.
 * @param gravity	Gravity multiplier.
 * @param knockback	Empty value.
 * @param adminflags	Set flag of admin only class, ADMIN_USER is normal players.
 * @param credits	Cost of unlocking this class (if credits is enabled).
 * @return		An internal zombie class ID, or -1 on failure.
 */
native bb_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback = 0.0, adminflags = ADMIN_ALL, credits = 0 )
native zp_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback = 0.0, adminflags = ADMIN_ALL, credits = 0 )

/**
 * Returns a zombie classes cost.
 *
 * @param classid	A valid zombie class ID.
 */
native bb_get_class_cost(classid)

/**
 * Returns a player's current zombie class ID.
 *
 * @param id		Player index.
 * @return		Internal zombie class ID, or -1 if not yet chosen.
 */
native bb_get_user_zombie_class(id)
native zp_get_user_zombie_class(id)

/**
 * Returns a player's next zombie class ID (when they respawn).
 *
 * @param id		Player index.
 * @return		Internal zombie class ID, or -1 if not yet chosen.
 */
native bb_get_user_next_class(id)
native zp_get_user_next_class(id)

/**
 * Sets a player's next zombie class ID (when they respawn).
 *
 * @param id		Player index.
 * @param classid	A valid zombie class ID.
 * @return		True on success, false otherwise.
 */
native bb_set_user_zombie_class(id, classid)
native zp_set_user_zombie_class(id, classid)

/**
 * Returns whether a player is a zombie.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native bb_is_user_zombie(id)
native zp_get_user_zombie(id)

/**
 * Returns whether a player is banned from building.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native bb_is_user_banned(id)

/**
 * Returns whether the game is still in the build phase.
 *
 * @param id		Player index.
 * @return		True if it is, false otherwise.
 */
native bb_is_build_phase()

/**
 * Returns whether the game is in the preparation phase.
 *
 * @return		True if it is, false otherwise.
 */
native bb_is_prep_phase()

/**
 * Returns the current build time (in seconds).
 */
native bb_get_build_time()

/**
 * Sets the build timer to a specified number.
 *
 * @param time		Time to set build timer to. (integer)
 */
native bb_set_build_time(time)

/**
 * Returns the players current color ENUM.
 *
 * @param id		Player index.
 */
native bb_get_user_color(id)

/**
 * Sets the build timer to a specified number.
 *
 * @param id		Player index.
 * @param color		Color to set. (enum)
 */
native bb_set_user_color(id, color)

/**
 * Drops the users entity (if he has one).
 *
 * @param id		Player index.
 */
native bb_drop_user_block(id)

/**
 * Returns the users entity..
 *
 * @param id		Player index.
 * @return		Entity index if true, 0 if none
 */
native bb_get_user_block(id)

/**
 * Sets the users current moving block to the entity specified.
 *
 * @param id		Player index.
 * @param entity	Entity index.
 */
native bb_set_user_block(id, entity)

/**
 * Returns whether a block is locked or not.
 *
 * @param entity	Entity index.
 * @return		True if it is, false otherwise
 */
native bb_is_locked_block(entity)

/**
 * Locks specified block if applicable.
 *
 * @param entity	Entity index.
 */
native bb_lock_block(entity)

/**
 * Unlocks specified block if applicable.
 *
 * @param entity	Entity index.
 */
native bb_unlock_block(id, entity)

/**
 * Releases the zombies if valid.
 */
native bb_release_zombies()

/**
 * Sets their "primary weapon" (weapon that is drawn at round start).
 *
 * @param id		Player index.
 * @param csw_primary	CSW_ primary to set to from CSW_P228 to CSW_P90.
 */
native bb_set_user_primary(id, csw_gun)

/**
 * Returns their current primary weapon.
 *
 * @param id		Player index.
 * @return		Returns primary weapon as CSW_ constant.
 */
native bb_get_user_primary(id)

/**
 * Returns current mod admin flags for the following
 *
 * @return		Returns the ADMIN flags for specified level
 */
native bb_get_flags_build()
native bb_get_flags_lock()
native bb_get_flags_buildban()
native bb_get_flags_swap()
native bb_get_flags_revive()
native bb_get_flags_guns()
native bb_get_flags_release()
native bb_get_flags_override()

/*------------------------------------------------------------------------------------------------*/

//Disabled until fixed

/**
 * Sets a multiplier for a class (for use with credits add-on)
 *
 * @param id		Player index.
 * @param attribute	Attribute enum to change
 * @param amount	Float value hat will multiply by
 * @return		Returns 1 if successful, 0 if not
 */
//native bb_set_user_mult(id, attribute, Float:amount)
/*------------------------------------------------------------------------------------------------*/

/**
 * Called when the zombies are released
 * at the end of the build or preparation phase
 */
forward bb_round_started()

/**
 * Called when the preparation phase begins
 * at the end of the build phase, before zombie release
 */
forward bb_prepphase_started()

/**
 * Called when the build phase begins
 * When the round starts (logevent)
 */
forward bb_buildphase_started()

/**
 * Called when a player picks his NEXT zombie class
 *
 * @param id		Player index forwarding the event.
 * @param class		Class index picked
 */
forward bb_zombie_class_picked(id, class)

/**
 * Called when a player has his CURRENT class applied. (respawn)
 *
 * @param id		Player index forwarding the event.
 * @param class		Class index picked
 */
forward bb_zombie_class_set(id, class)

/**
 * Called when a player pushes or pulls an entity
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being moved
 * @param pushpull	Whether it's being pushed or pulled
 *			1 = pushing, 2 = pulling
 */
forward bb_block_pushpull(id, entity, pushpull)

/**
 * Called when a player grabs an entity
 *	Before entity successfully grabbed
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being grabbed
 */
forward bb_grab_pre(id, entity)

/**
 * Called when a player grabs an entity
 *	After the entity is grabbed
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being grabbed
 */
forward bb_grab_post(id, entity)

/**
 * Called when a player drops an entity
 *	Before entity actually dropped
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being dropped
 */
forward bb_drop_pre(id, entity)

/**
 * Called when a player drops an entity
 *	After the entity is dropped
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being dropped
 */
forward bb_drop_post(id, entity)

/**
 * Called when a player receives a new color
 *	Only when they random or select from menu
 *
 * @param id		Player index forwarding the event.
 * @param color		The entity index being dropped
 */
forward bb_new_color(id, color)

/**
 * Called when a player locks an entity
 *	Before entity actually locked
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being locked
 */
forward bb_lock_pre(id, entity)

/**
 * Called when a player locks an entity
 *	After the entity is locked
 *
 * @param id		Player index forwarding the event.
 * @param entity	The entity index being locked
 */
forward bb_lock_post(id, entity)
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Attached Files
File Type: sma Get Plugin or Get Source (zp_zclass_smoker.sma - 495 views - 13.9 KB)
eNNkds is offline
Send a message via Skype™ to eNNkds
spooky HL15
Member
Join Date: Oct 2015
Old 04-22-2018 , 13:09   Re: [Request] zclass conversion to ZP to BB
Reply With Quote #2

i guess it will work
PHP Code:

#include <amxmodx>
#include <basebuilder>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

#define PLUGIN "[ZP] Class Smoker"
#define VERSION "1.3"
#define AUTHOR "4eRT"

//Main Class, modelT & Sprite Beam
new g_zclass_smokerg_Line
new const generic_models[][] = { "models/player/zombie_smoker/zombie_smokerT.mdl" 
//Sounds
new g_sndMiss[] = "zombie_plague/Smoker_TongueHit_miss.wav"
new g_sndDrag[] = "zombie_plague/Smoker_TongueHit_drag.wav"
//Some vars
new g_hooked[33], g_hooksLeft[33], g_unable2move[33], g_ovr_dmg[33]
new 
Float:g_lastHook[33]
new 
boolg_bind_use[33] = falseboolg_bind_or_not[33] = falseboolg_drag_i[33] = false
//Cvars
new cvar_maxdragscvar_dragspeedcvar_cooldowncvar_dmg2stopcvar_matescvar_extrahookcvar_unb2move
//Menu keys
new keys MENU_KEY_1|MENU_KEY_2|MENU_KEY_3
//Smoker Atributes
new const zclass_name[] = { "Smoker" }
new const 
zclass_info[] = { "Can drag players" }
new const 
zclass_model[] = { "zombie_smoker" }
new const 
zclass_clawmodel[] = { "v_knife_smoker" }
const 
zclass_health 1400
const zclass_speed 190
const Float:zclass_gravity 1.0
const Float:zclass_knockback 1.0

public plugin_init()
{
    
cvar_dragspeed register_cvar("zp_smoker_dragspeed""160")
    
cvar_maxdrags register_cvar("zp_smoker_maxdrags""10")
    
cvar_cooldown register_cvar("zp_smoker_cooldown""5")
    
cvar_dmg2stop register_cvar("zp_smoker_dmg2stop""300")
    
cvar_mates register_cvar("zp_smoker_mates""0")
    
cvar_extrahook register_cvar("zp_smoker_extrahook""2")
    
cvar_unb2move register_cvar("zp_smoker_unable_move""1")
    
register_event("ResetHUD""newSpawn""b")
    
register_event("DeathMsg""smoker_death""a")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_clcmd("+drag","drag_start"ADMIN_USER"bind ^"key^" ^"+drag^"")
    
register_clcmd("-drag","drag_end")
    
register_menucmd(register_menuid("Do you want to bind V +drag?"), keys"bind_v_key")
}
public 
plugin_precache()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_zclass_smoker zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    
precache_sound(g_sndDrag)
    
precache_sound(g_sndMiss)
    
g_Line precache_model("sprites/zbeam4.spr")
    
    for (new 
0sizeof generic_modelsi++)
    
precache_model(generic_models[i])
}

public 
zp_user_infected_post(idinfector)
{
    if ((
zp_get_user_zombie_class(infector) == g_zclass_smoker) && (get_pcvar_num(cvar_extrahook) > 0))
    {
        
g_hooksLeft[infector] = g_hooksLeft[infector] + get_pcvar_num(cvar_extrahook)
        
set_hudmessage(25500, -1.00.4500.03.00.010.01, -1)
        
show_hudmessage(infector"+%d drag%s!"get_pcvar_num(cvar_extrahook), (get_pcvar_num(cvar_extrahook) < 2) ? "" "s")
    }
    
    if (
zp_get_user_zombie_class(id) == g_zclass_smoker)
    {
        
g_hooksLeft[id] = get_pcvar_num(cvar_maxdrags)
        
        if (!
g_bind_or_not[id])
        {
            new 
menu[192]
            
format(menu191"Do you want to bind V +drag?^n^n1. Yes^n2. No^n3. Drag on +USE")
            
show_menu(idkeysmenu)
        }
    }
}

public 
newSpawn(id)
{
    if (
g_hooked[id])
        
drag_end(id)
}

public 
drag_start(id// starts drag, checks if player is Smoker, checks cvars
{        
    if (
zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_smoker) && !g_drag_i[id]) {
        
        static 
Float:cdown
        cdown 
get_pcvar_float(cvar_cooldown)

        if (!
is_user_alive(id)) {
            
client_print(idprint_chat"[ZP] You can't drag if you are dead!")
            return 
PLUGIN_HANDLED
        
}

        if (
g_hooksLeft[id] <= 0) {
            
client_print(idprint_chat"[ZP] You can't drag anymore!")
            return 
PLUGIN_HANDLED
        
}

        if (
get_gametime() - g_lastHook[id] < cdown) {
            
client_print(idprint_chat"[ZP] Wait %.f0 sec. to drag again!"get_pcvar_float(cvar_cooldown) - (get_gametime() - g_lastHook[id]))
            return 
PLUGIN_HANDLED
        
}
        
        new 
hooktargetbody
        get_user_aiming
(idhooktargetbody)
        

        
        if (
is_user_alive(hooktarget)) {
            if (!
zp_get_user_zombie(hooktarget))
                {

                    
g_hooked[id] = hooktarget
                    emit_sound
(hooktargetCHAN_BODYg_sndDrag1.0ATTN_NORM0PITCH_HIGH)
                }
            else
                {
                    if (
get_pcvar_num(cvar_mates) == 1)
                    {
                        
g_hooked[id] = hooktarget
                        emit_sound
(hooktargetCHAN_BODYg_sndDrag1.0ATTN_NORM0PITCH_HIGH)
                    }
                    else
                    {
                        
client_print(idprint_chat"[ZP] You can't drag teammates!")
                        return 
PLUGIN_HANDLED
                    
}
                }

            if (
get_pcvar_float(cvar_dragspeed) <= 0.0)
                
cvar_dragspeed 1
            
            
new parm[2]
            
parm[0] = id
            parm
[1] = hooktarget
            
            set_task
(0.1"smoker_reelin"idparm2"b")
            
harpoon_target(parm)
            
            
g_hooksLeft[id]--
            
client_print(idprint_chat"[ZP] You can drag player to youself %d time%s"g_hooksLeft[id], (g_hooksLeft[id] < 2) ? "" "s")
            
g_drag_i[id] = true
            
            
if(get_pcvar_num(cvar_unb2move) == 1)
                
g_unable2move[hooktarget] = true
                
            
if(get_pcvar_num(cvar_unb2move) == 2)
                
g_unable2move[id] = true
                
            
if(get_pcvar_num(cvar_unb2move) == 3)
            {
                
g_unable2move[hooktarget] = true
                g_unable2move
[id] = true
            
}
        } else {
            
g_hooked[id] = 33
            noTarget
(id)
            
emit_sound(hooktargetCHAN_BODYg_sndMiss1.0ATTN_NORM0PITCH_HIGH)
            
g_drag_i[id] = true
            g_hooksLeft
[id]--
            
client_print(idprint_chat"[ZP] You can drag player to youself %d time%s"g_hooksLeft[id], (g_hooksLeft[id] < 2) ? "" "s")
        }
    }
    else
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE
}

public 
smoker_reelin(parm[]) // dragging player to smoker
{
    new 
id parm[0]
    new 
victim parm[1]

    if (!
g_hooked[id] || !is_user_alive(victim))
    {
        
drag_end(id)
        return
    }

    new 
Float:fl_Velocity[3]
    new 
idOrigin[3], vicOrigin[3]

    
get_user_origin(victimvicOrigin)
    
get_user_origin(ididOrigin)

    new 
distance get_distance(idOriginvicOrigin)

    if (
distance 1) {
        new 
Float:fl_Time distance get_pcvar_float(cvar_dragspeed)

        
fl_Velocity[0] = (idOrigin[0] - vicOrigin[0]) / fl_Time
        fl_Velocity
[1] = (idOrigin[1] - vicOrigin[1]) / fl_Time
        fl_Velocity
[2] = (idOrigin[2] - vicOrigin[2]) / fl_Time
    
} else {
        
fl_Velocity[0] = 0.0
        fl_Velocity
[1] = 0.0
        fl_Velocity
[2] = 0.0
    
}

    
entity_set_vector(victimEV_VEC_velocityfl_Velocity//<- rewritten. now uses engine
}

public 
drag_end(id// drags end function
{
    
g_hooked[id] = 0
    beam_remove
(id)
    
remove_task(id)
    
    if (
g_drag_i[id])
        
g_lastHook[id] = get_gametime()
    
    
g_drag_i[id] = false
    g_unable2move
[id] = false
}

public 
smoker_death() // if smoker dies drag off
{
    new 
id read_data(2)
    
    
beam_remove(id)
    
    if (
g_hooked[id])
        
drag_end(id)
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damage// if take damage drag off
{
    if (
is_user_alive(attacker) && (get_pcvar_num(cvar_dmg2stop) > 0))
    {
        
g_ovr_dmg[victim] = g_ovr_dmg[victim] + floatround(damage)
        if (
g_ovr_dmg[victim] >= get_pcvar_num(cvar_dmg2stop))
        {
            
g_ovr_dmg[victim] = 0
            drag_end
(victim)
            return 
HAM_IGNORED;
        }
    }

    return 
HAM_IGNORED;
}

public 
fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
new button get_user_button(id)
    new 
oldbutton get_user_oldbutton(id)
    
    if (
g_bind_use[id] && zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_smoker))
    {
        if (!(
oldbutton IN_USE) && (button IN_USE))
            
drag_start(id)
        
        if ((
oldbutton IN_USE) && !(button IN_USE))
            
drag_end(id)
    }
    
    if (!
g_drag_i[id]) {
        
g_unable2move[id] = false
    
}
        
    if (
g_unable2move[id] && get_pcvar_num(cvar_unb2move) > 0)
    {
        
set_pev(idpev_maxspeed1.0)
    }
    
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id// if client disconnects drag off
{
    if (
id <= || id 32)
        return
    
    if (
g_hooked[id])
        
drag_end(id)
    
    if(
g_unable2move[id])
        
g_unable2move[id] = false
}

public 
harpoon_target(parm[]) // set beam (ex. tongue:) if target is player
{
    new 
id parm[0]
    new 
hooktarget parm[1]

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(8)    // TE_BEAMENTS
    
write_short(id)
    
write_short(hooktarget)
    
write_short(g_Line)    // sprite index
    
write_byte(0)    // start frame
    
write_byte(0)    // framerate
    
write_byte(200)    // life
    
write_byte(8)    // width
    
write_byte(1)    // noise
    
write_byte(155)    // r, g, b
    
write_byte(155)    // r, g, b
    
write_byte(55)    // r, g, b
    
write_byte(90)    // brightness
    
write_byte(10)    // speed
    
message_end()
}

public 
bind_v_key(idkeys)
{
    
g_bind_or_not[id] = true
    
switch(keys)
    {
        case 
0:
            
client_cmd(id"bind v ^"+drag^"")
    
        case 
1:
            
client_print(idprint_chat"[ZP] To drag player to youself (bind ^'^'key^'^' ^'^'+drag^'^') hold binded key")
            
        case 
2:
            
g_bind_use[id] = true
            
        
default:
            
g_bind_or_not[id] = false
    
}
    
    return 
PLUGIN_HANDLED
}

public 
noTarget(id// set beam if target isn't player
{
    new 
endorigin[3]

    
get_user_origin(idendorigin3)

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byteTE_BEAMENTPOINT ); // TE_BEAMENTPOINT
    
write_short(id)
    
write_coord(endorigin[0])
    
write_coord(endorigin[1])
    
write_coord(endorigin[2])
    
write_short(g_Line// sprite index
    
write_byte(0)    // start frame
    
write_byte(0)    // framerate
    
write_byte(200)    // life
    
write_byte(8)    // width
    
write_byte(1)    // noise
    
write_byte(155)    // r, g, b
    
write_byte(155)    // r, g, b
    
write_byte(55)    // r, g, b
    
write_byte(75)    // brightness
    
write_byte(0)    // speed
    
message_end()
}

public 
beam_remove(id// remove beam
{
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(99)    //TE_KILLBEAM
    
write_short(id)    //entity
    
message_end()

__________________
GK™
Website
spooky HL15 is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 04-23-2018 , 16:16   Re: [Request] zclass conversion to ZP to BB
Reply With Quote #3

can you remove cvar_extrahook = register_cvar("zp_smoker_extrahook", "2") and public zp_user_infected_post(id, infector) in bb.inc infected post doesen't exsist.. thank you
eNNkds is offline
Send a message via Skype™ to eNNkds
Dote
Member
Join Date: Jan 2018
Old 04-24-2018 , 12:43   Re: [Request] zclass conversion to ZP to BB
Reply With Quote #4

Quote:
Originally Posted by eNNkds View Post
can you remove cvar_extrahook = register_cvar("zp_smoker_extrahook", "2") and public zp_user_infected_post(id, infector) in bb.inc infected post doesen't exsist.. thank you
test it
PHP Code:
#include <amxmodx>
#include <basebuilder>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

#define PLUGIN "[ZP] Class Smoker"
#define VERSION "1.3"
#define AUTHOR "4eRT"

//Main Class, modelT & Sprite Beam
new g_zclass_smokerg_Line
new const generic_models[][] = { "models/player/zombie_smoker/zombie_smokerT.mdl" 
//Sounds
new g_sndMiss[] = "zombie_plague/Smoker_TongueHit_miss.wav"
new g_sndDrag[] = "zombie_plague/Smoker_TongueHit_drag.wav"
//Some vars
new g_hooked[33], g_hooksLeft[33], g_unable2move[33], g_ovr_dmg[33]
new 
Float:g_lastHook[33]
new 
boolg_bind_use[33] = falseboolg_bind_or_not[33] = falseboolg_drag_i[33] = false
//Cvars
new cvar_maxdragscvar_dragspeedcvar_cooldowncvar_dmg2stopcvar_matescvar_extrahookcvar_unb2move
//Menu keys
new keys MENU_KEY_1|MENU_KEY_2|MENU_KEY_3
//Smoker Atributes
new const zclass_name[] = { "Smoker" }
new const 
zclass_info[] = { "Can drag players" }
new const 
zclass_model[] = { "zombie_smoker" }
new const 
zclass_clawmodel[] = { "v_knife_smoker" }
const 
zclass_health 1400
const zclass_speed 190
const Float:zclass_gravity 1.0
const Float:zclass_knockback 1.0

public plugin_init()
{
    
cvar_dragspeed register_cvar("bb_smoker_dragspeed""160")
    
cvar_maxdrags register_cvar("bb_smoker_maxdrags""10")
    
cvar_cooldown register_cvar("bb_smoker_cooldown""5")
    
cvar_dmg2stop register_cvar("bb_smoker_dmg2stop""300")
    
cvar_mates register_cvar("bb_smoker_mates""0")
    
cvar_extrahook register_cvar("bb_smoker_extrahook""2")
    
cvar_unb2move register_cvar("bb_smoker_unable_move""1")
    
register_event("ResetHUD""newSpawn""b")
    
register_event("DeathMsg""smoker_death""a")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_clcmd("+drag","drag_start"ADMIN_USER"bind ^"key^" ^"+drag^"")
    
register_clcmd("-drag","drag_end")
    
register_menucmd(register_menuid("Do you want to bind V +drag?"), keys"bind_v_key")
}
public 
plugin_precache()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_zclass_smoker bb_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    
precache_sound(g_sndDrag)
    
precache_sound(g_sndMiss)
    
g_Line precache_model("sprites/zbeam4.spr")
    
    for (new 
0sizeof generic_modelsi++)
    
precache_model(generic_models[i])
}

public 
bb_user_infected_post(idinfector)
{
    if ((
bb_get_user_zombie_class(infector) == g_zclass_smoker) && (get_pcvar_num(cvar_extrahook) > 0))
    {
        
g_hooksLeft[infector] = g_hooksLeft[infector] + get_pcvar_num(cvar_extrahook)
        
set_hudmessage(25500, -1.00.4500.03.00.010.01, -1)
        
show_hudmessage(infector"+%d drag%s!"get_pcvar_num(cvar_extrahook), (get_pcvar_num(cvar_extrahook) < 2) ? "" "s")
    }
    
    if (
bb_get_user_zombie_class(id) == g_zclass_smoker)
    {
        
g_hooksLeft[id] = get_pcvar_num(cvar_maxdrags)
        
        if (!
g_bind_or_not[id])
        {
            new 
menu[192]
            
format(menu191"Do you want to bind V +drag?^n^n1. Yes^n2. No^n3. Drag on +USE")
            
show_menu(idkeysmenu)
        }
    }
}

public 
newSpawn(id)
{
    if (
g_hooked[id])
        
drag_end(id)
}

public 
drag_start(id// starts drag, checks if player is Smoker, checks cvars
{        
    if (
bb_get_user_zombie(id) && (bb_get_user_zombie_class(id) == g_zclass_smoker) && !g_drag_i[id]) {
        
        static 
Float:cdown
        cdown 
get_pcvar_float(cvar_cooldown)

        if (!
is_user_alive(id)) {
            
client_print(idprint_chat"[ZP] You can't drag if you are dead!")
            return 
PLUGIN_HANDLED
        
}

        if (
g_hooksLeft[id] <= 0) {
            
client_print(idprint_chat"[ZP] You can't drag anymore!")
            return 
PLUGIN_HANDLED
        
}

        if (
get_gametime() - g_lastHook[id] < cdown) {
            
client_print(idprint_chat"[ZP] Wait %.f0 sec. to drag again!"get_pcvar_float(cvar_cooldown) - (get_gametime() - g_lastHook[id]))
            return 
PLUGIN_HANDLED
        
}
        
        new 
hooktargetbody
        get_user_aiming
(idhooktargetbody)
        

        
        if (
is_user_alive(hooktarget)) {
            if (!
bb_get_user_zombie(hooktarget))
                {

                    
g_hooked[id] = hooktarget
                    emit_sound
(hooktargetCHAN_BODYg_sndDrag1.0ATTN_NORM0PITCH_HIGH)
                }
            else
                {
                    if (
get_pcvar_num(cvar_mates) == 1)
                    {
                        
g_hooked[id] = hooktarget
                        emit_sound
(hooktargetCHAN_BODYg_sndDrag1.0ATTN_NORM0PITCH_HIGH)
                    }
                    else
                    {
                        
client_print(idprint_chat"[ZP] You can't drag teammates!")
                        return 
PLUGIN_HANDLED
                    
}
                }

            if (
get_pcvar_float(cvar_dragspeed) <= 0.0)
                
cvar_dragspeed 1
            
            
new parm[2]
            
parm[0] = id
            parm
[1] = hooktarget
            
            set_task
(0.1"smoker_reelin"idparm2"b")
            
harpoon_target(parm)
            
            
g_hooksLeft[id]--
            
client_print(idprint_chat"[ZP] You can drag player to youself %d time%s"g_hooksLeft[id], (g_hooksLeft[id] < 2) ? "" "s")
            
g_drag_i[id] = true
            
            
if(get_pcvar_num(cvar_unb2move) == 1)
                
g_unable2move[hooktarget] = true
                
            
if(get_pcvar_num(cvar_unb2move) == 2)
                
g_unable2move[id] = true
                
            
if(get_pcvar_num(cvar_unb2move) == 3)
            {
                
g_unable2move[hooktarget] = true
                g_unable2move
[id] = true
            
}
        } else {
            
g_hooked[id] = 33
            noTarget
(id)
            
emit_sound(hooktargetCHAN_BODYg_sndMiss1.0ATTN_NORM0PITCH_HIGH)
            
g_drag_i[id] = true
            g_hooksLeft
[id]--
            
client_print(idprint_chat"[ZP] You can drag player to youself %d time%s"g_hooksLeft[id], (g_hooksLeft[id] < 2) ? "" "s")
        }
    }
    else
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE
}

public 
smoker_reelin(parm[]) // dragging player to smoker
{
    new 
id parm[0]
    new 
victim parm[1]

    if (!
g_hooked[id] || !is_user_alive(victim))
    {
        
drag_end(id)
        return
    }

    new 
Float:fl_Velocity[3]
    new 
idOrigin[3], vicOrigin[3]

    
get_user_origin(victimvicOrigin)
    
get_user_origin(ididOrigin)

    new 
distance get_distance(idOriginvicOrigin)

    if (
distance 1) {
        new 
Float:fl_Time distance get_pcvar_float(cvar_dragspeed)

        
fl_Velocity[0] = (idOrigin[0] - vicOrigin[0]) / fl_Time
        fl_Velocity
[1] = (idOrigin[1] - vicOrigin[1]) / fl_Time
        fl_Velocity
[2] = (idOrigin[2] - vicOrigin[2]) / fl_Time
    
} else {
        
fl_Velocity[0] = 0.0
        fl_Velocity
[1] = 0.0
        fl_Velocity
[2] = 0.0
    
}

    
entity_set_vector(victimEV_VEC_velocityfl_Velocity//<- rewritten. now uses engine
}

public 
drag_end(id// drags end function
{
    
g_hooked[id] = 0
    beam_remove
(id)
    
remove_task(id)
    
    if (
g_drag_i[id])
        
g_lastHook[id] = get_gametime()
    
    
g_drag_i[id] = false
    g_unable2move
[id] = false
}

public 
smoker_death() // if smoker dies drag off
{
    new 
id read_data(2)
    
    
beam_remove(id)
    
    if (
g_hooked[id])
        
drag_end(id)
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damage// if take damage drag off
{
    if (
is_user_alive(attacker) && (get_pcvar_num(cvar_dmg2stop) > 0))
    {
        
g_ovr_dmg[victim] = g_ovr_dmg[victim] + floatround(damage)
        if (
g_ovr_dmg[victim] >= get_pcvar_num(cvar_dmg2stop))
        {
            
g_ovr_dmg[victim] = 0
            drag_end
(victim)
            return 
HAM_IGNORED;
        }
    }

    return 
HAM_IGNORED;
}

public 
fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
new button get_user_button(id)
    new 
oldbutton get_user_oldbutton(id)
    
    if (
g_bind_use[id] && bb_get_user_zombie(id) && (bb_get_user_zombie_class(id) == g_zclass_smoker))
    {
        if (!(
oldbutton IN_USE) && (button IN_USE))
            
drag_start(id)
        
        if ((
oldbutton IN_USE) && !(button IN_USE))
            
drag_end(id)
    }
    
    if (!
g_drag_i[id]) {
        
g_unable2move[id] = false
    
}
        
    if (
g_unable2move[id] && get_pcvar_num(cvar_unb2move) > 0)
    {
        
set_pev(idpev_maxspeed1.0)
    }
    
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id// if client disconnects drag off
{
    if (
id <= || id 32)
        return
    
    if (
g_hooked[id])
        
drag_end(id)
    
    if(
g_unable2move[id])
        
g_unable2move[id] = false
}

public 
harpoon_target(parm[]) // set beam (ex. tongue:) if target is player
{
    new 
id parm[0]
    new 
hooktarget parm[1]

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(8)    // TE_BEAMENTS
    
write_short(id)
    
write_short(hooktarget)
    
write_short(g_Line)    // sprite index
    
write_byte(0)    // start frame
    
write_byte(0)    // framerate
    
write_byte(200)    // life
    
write_byte(8)    // width
    
write_byte(1)    // noise
    
write_byte(155)    // r, g, b
    
write_byte(155)    // r, g, b
    
write_byte(55)    // r, g, b
    
write_byte(90)    // brightness
    
write_byte(10)    // speed
    
message_end()
}

public 
bind_v_key(idkeys)
{
    
g_bind_or_not[id] = true
    
switch(keys)
    {
        case 
0:
            
client_cmd(id"bind v ^"+drag^"")
    
        case 
1:
            
client_print(idprint_chat"[ZP] To drag player to youself (bind ^'^'key^'^' ^'^'+drag^'^') hold binded key")
            
        case 
2:
            
g_bind_use[id] = true
            
        
default:
            
g_bind_or_not[id] = false
    
}
    
    return 
PLUGIN_HANDLED
}

public 
noTarget(id// set beam if target isn't player
{
    new 
endorigin[3]

    
get_user_origin(idendorigin3)

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byteTE_BEAMENTPOINT ); // TE_BEAMENTPOINT
    
write_short(id)
    
write_coord(endorigin[0])
    
write_coord(endorigin[1])
    
write_coord(endorigin[2])
    
write_short(g_Line// sprite index
    
write_byte(0)    // start frame
    
write_byte(0)    // framerate
    
write_byte(200)    // life
    
write_byte(8)    // width
    
write_byte(1)    // noise
    
write_byte(155)    // r, g, b
    
write_byte(155)    // r, g, b
    
write_byte(55)    // r, g, b
    
write_byte(75)    // brightness
    
write_byte(0)    // speed
    
message_end()
}

public 
beam_remove(id// remove beam
{
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(99)    //TE_KILLBEAM
    
write_short(id)    //entity
    
message_end()

Dote is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 04-24-2018 , 18:03   Re: [Request] zclass conversion to ZP to BB
Reply With Quote #5

@dote i tryed to complied 3 errors appears..

test.sma(94) : error 017: undefined symbol "bb_get_user_zombie"
test.sma(120) : error 017: undefined symbol "bb_get_user_zombie"
test.sma(261) error 017: undefined symbol "bb_get_user_zombie"
eNNkds is offline
Send a message via Skype™ to eNNkds
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:38.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode