Raised This Month: $ Target: $400
 0% 

[Zp] Como agregar una nueva clase


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
JorG
Junior Member
Join Date: Mar 2012
Old 04-11-2012 , 18:52   [Zp] Como agregar una nueva clase
#1

Bueno creo que el titulo lo dice todo. Yo quiero agregar una clase nueva de zombie a mi zp.

Como hago para agregar esta clase.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <zombieplague>

// Zombie Attributes
new const zclass_name[] = "Deimos Zombie" // name
new const zclass_info[] = "| G -> Drop Human Weapon" // description
new const zclass_model[] = "deimos_zombi_origin" // model
new const zclass_clawmodel[] = "v_knife_deimos_zombi.mdl" // claw model
const zclass_health 2000 // health
const zclass_speed 280 // speed
const Float:zclass_gravity 1.0 // gravity
const Float:zclass_knockback 1.0 // knockback

new g_zclass_deimos
new bool:can_use_skill[33]

new 
trail_spr
new exp_spr

const m_flTimeWeaponIdle 48
const m_flNextAttack 83

new const light_classname[] = "deimos_skill"
new const skill_start[] = "zombie_plague/deimos_skill_start.wav"
new const skill_hit[] = "zombie_plague/deimos_skill_hit.wav"

#define TASK_WAIT 11111
#define TASK_ATTACK 22222
#define TASK_COOLDOWN 33333

const WPN_NOT_DROP = ((1<<2)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

new 
cvar_cooldown


public plugin_init()
{
    
register_plugin("[ZP] Zombie Class: Deimos""1.0""Dias")
    
    
cvar_cooldown register_cvar("zp_deimos_cooldown""30")
    
    
register_forward(FM_Touch"fw_Touch")
    
register_clcmd("drop""use_skill")
}

public 
plugin_precache()
{
    
trail_spr precache_model("sprites/zb3/trail.spr")
    
exp_spr precache_model("sprites/zb3/deimosexp.spr")
    
    
precache_sound(skill_start)
    
precache_sound(skill_hit)
    
    
g_zclass_deimos zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)    
}

public 
zp_user_infected_post(idinfector)
{
    if (
zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_zclass_deimos)
    {
        
can_use_skill[id] = true
        client_print
(idprint_chat"[ZP] You are Deimos Zombie, Aim and Press (G) to Drop Human Weapon")
    }
}

public 
use_skill(id)
{
    if (
zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_zclass_deimos && !zp_get_user_nemesis(id))
    {
        if(
can_use_skill[id])
        {
            
do_skill(id)
            
can_use_skill[id] = false
        
} else {
            
client_print(idprint_chat"[ZP] You can't use your skill now...")
        }
    }
}

public 
do_skill(id)
{
    
play_weapon_anim(id8)
    
set_weapons_timeidle(id7.0)
    
set_player_nextattack(id0.5)
    
PlayEmitSound(idskill_start)
    
entity_set_int(idEV_INT_sequence10)

    
set_task(0.5"launch_light"id+TASK_ATTACK)
}

public 
launch_light(taskid)
{
    new 
id taskid TASK_ATTACK
    
if (task_exists(id+TASK_ATTACK)) remove_task(id+TASK_ATTACK)
    
    if (!
is_user_alive(id)) return;
    
    
// check
    
new FloatfOrigin[3], Float:fAngle[3],FloatfVelocity[3]
    
pev(idpev_originfOrigin)
    
pev(idpev_view_ofsfAngle)
    
fm_velocity_by_aim(id2.0fVelocityfAngle)
    
fAngle[0] *= -1.0
    
    
// create ent
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
set_pev(entpev_classnamelight_classname)
    
engfunc(EngFunc_SetModelent"models/w_hegrenade.mdl")
    
set_pev(entpev_minsFloat:{-1.0, -1.0, -1.0})
    
set_pev(entpev_maxsFloat:{1.01.01.0})
    
set_pev(entpev_originfOrigin)
    
fOrigin[0] += fVelocity[0]
    
fOrigin[1] += fVelocity[1]
    
fOrigin[2] += fVelocity[2]
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
set_pev(entpev_gravity0.01)
    
fVelocity[0] *= 1000
    fVelocity
[1] *= 1000
    fVelocity
[2] *= 1000
    set_pev
(entpev_velocityfVelocity)
    
set_pev(entpev_ownerid)
    
set_pev(entpev_anglesfAngle)
    
set_pev(entpev_solidSOLID_BBOX)                        //store the enitty id
    
    // invisible ent
    
fm_set_rendering(entkRenderFxGlowShell000kRenderTransAlpha0)
    
    
// show trail    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byte(TE_BEAMFOLLOW)
    
write_short(ent)                //entity
    
write_short(trail_spr)        //model
    
write_byte(5)        //10)//life
    
write_byte(3)        //5)//width
    
write_byte(209)                    //r, hegrenade
    
write_byte(120)                    //g, gas-grenade
    
write_byte(9)                    //b
    
write_byte(200)        //brightness
    
message_end()                    //move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)
    
    
client_print(idprint_chat"[ZP] You have to wait %i seconds to continue use skill !!!"get_pcvar_num(cvar_cooldown))
    
set_task(get_pcvar_float(cvar_cooldown), "reset_cooldown"id+TASK_COOLDOWN)
    
    return;
}

public 
reset_cooldown(taskid)
{
    new 
id taskid TASK_COOLDOWN
    
    
if (zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_zclass_deimos && !zp_get_user_nemesis(id))
    {
        
can_use_skill[id] = true
        client_print
(idprint_chat"[ZP] Now. You can use your skill. Aim and Press (G)")
    }
}

public 
fw_Touch(entvictim)
{
    if (!
pev_valid(ent)) return FMRES_IGNORED
    
    
new EntClassName[32]
    
entity_get_string(entEV_SZ_classnameEntClassNamecharsmax(EntClassName))
    
    if (
equal(EntClassNamelight_classname)) 
    {
        
light_exp(entvictim)
        
remove_entity(ent)
        return 
FMRES_IGNORED
    
}
    
    return 
FMRES_IGNORED
}

light_exp(entvictim)
{
    if (!
pev_valid(ent)) return;
    
    if (
is_user_alive(victim) && !zp_get_user_zombie(victim) && !zp_get_user_survivor(victim))
    {
        new 
wpnwpnname[32]
        
wpn get_user_weapon(victim)
        if( !(
WPN_NOT_DROP & (1<<wpn)) && get_weaponname(wpnwpnnamecharsmax(wpnname)) )
        {
            
engclient_cmd(victim"drop"wpnname)
        }
    }
    
    
// create effect
    
static Float:origin[3];
    
pev(entpev_originorigin);
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); 
    
write_byte(TE_EXPLOSION); // TE_EXPLOSION
    
write_coord(floatround(origin[0])); // origin x
    
write_coord(floatround(origin[1])); // origin y
    
write_coord(floatround(origin[2])); // origin z
    
write_short(exp_spr); // sprites
    
write_byte(40); // scale in 0.1's
    
write_byte(30); // framerate
    
write_byte(14); // flags 
    
message_end(); // message end
    
    // play sound exp
    
PlayEmitSound(entskill_hit)
}

PlayEmitSound(id, const sound[])
{
    
emit_sound(idCHAN_WEAPONsound1.0ATTN_NORM0PITCH_NORM)
}

play_weapon_anim(playeranim)
{
    
set_pev(playerpev_weaponanimanim)
    
message_begin(MSG_ONESVC_WEAPONANIM, {000}, player)
    
write_byte(anim)
    
write_byte(pev(playerpev_body))
    
message_end()
}

fm_velocity_by_aim(iIndexFloat:fDistanceFloat:fVelocity[3], Float:fViewAngle[3])
{
    
//new Float:fViewAngle[3]
    
pev(iIndexpev_v_anglefViewAngle)
    
fVelocity[0] = floatcos(fViewAngle[1], degrees) * fDistance
    fVelocity
[1] = floatsin(fViewAngle[1], degrees) * fDistance
    fVelocity
[2] = floatcos(fViewAngle[0]+90.0degrees) * fDistance
    
return 1
}

get_weapon_ent(idweaponid)
{
    static 
wname[32], weapon_ent
    get_weaponname
(weaponidwnamecharsmax(wname))
    
weapon_ent fm_find_ent_by_owner(-1wnameid)
    return 
weapon_ent
}

set_weapons_timeidle(idFloat:timeidle)
{
    new 
entwpn get_weapon_ent(idget_user_weapon(id))
    if (
pev_valid(entwpn)) set_pdata_float(entwpnm_flTimeWeaponIdletimeidle+3.04)
}

set_player_nextattack(idFloat:nexttime)
{
    
set_pdata_float(idm_flNextAttacknexttime4)
}

stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) { /* keep looping */ }
    return 
entity;
}

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16)
{
    static 
Float:color[3]
    
color[0] = float(r)
    
color[1] = float(g)
    
color[2] = float(b)
    
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorcolor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))

Bueno eso es todo Salu2
JorG is offline
 



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 19:03.


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