Raised This Month: $51 Target: $400
 12% 

[Zp] Como agregar una nueva clase


  
 
 
Thread Tools Display Modes
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
xLeoNNN
Veteran Member
Join Date: Sep 2010
Location: de_dust2
Old 04-11-2012 , 19:08   Re: [Zp] Como agregar una nueva clase
#2

cambia las natives, zp_get_user_zombie por g_zombie, zp_get_user_nemesis por g_nemesis, zp_register_zombie_class por native_register_zombie_class (creo), y así.
luego, fijate si hay eventos que ya esten registrados en el zp y adaptalos, si no lo estan registrarlos.

yo hago las clases de zombies externas, o haz varias en un plugin si quieres evitar tener tantos.
__________________
xLeoNNN is offline
Send a message via MSN to xLeoNNN
JorG
Junior Member
Join Date: Mar 2012
Old 04-11-2012 , 19:50   Re: [Zp] Como agregar una nueva clase
#3

He si yo las clases de zombie las tengo registradas asi

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

// Classic Zombie Attributes
new const zclass1_name[] = { "Classic Zombie" }
new const 
zclass1_info[] = { "=Balanced=" }
new const 
zclass1_model[] = { "zombie_source" }
new const 
zclass1_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass1_health 1800
const zclass1_speed 190
const Float:zclass1_gravity 1.0
const Float:zclass1_knockback 1.0

// Raptor Zombie Attributes
new const zclass2_name[] = { "Raptor Zombie" }
new const 
zclass2_info[] = { "HP-- Speed++ Knockback++" }
new const 
zclass2_model[] = { "zombie_source" }
new const 
zclass2_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass2_health 900
const zclass2_speed 225
const Float:zclass2_gravity 1.0
const Float:zclass2_knockback 1.5

// Poison Zombie Attributes
new const zclass3_name[] = { "Poison Zombie" }
new const 
zclass3_info[] = { "HP- Jump+ Knockback+" }
new const 
zclass3_model[] = { "zombie_source" }
new const 
zclass3_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass3_health 1400
const zclass3_speed 190
const Float:zclass3_gravity 0.75
const Float:zclass3_knockback 1.25

// Big Zombie Attributes
new const zclass4_name[] = { "Big Zombie" }
new const 
zclass4_info[] = { "HP++ Speed- Knockback--" }
new const 
zclass4_model[] = { "zombie_source" }
new const 
zclass4_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass4_health 2700
const zclass4_speed 155
const Float:zclass4_gravity 1.0
const Float:zclass4_knockback 0.5

// Leech Zombie Attributes
new const zclass5_name[] = { "Leech Zombie" }
new const 
zclass5_info[] = { "HP- Knockback+ Leech++" }
new const 
zclass5_model[] = { "zombie_source" }
new const 
zclass5_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass5_health 1300
const zclass5_speed 190
const Float:zclass5_gravity 1.0
const Float:zclass5_knockback 1.25
const zclass5_infecthp 200 // extra hp for infections

/*============================================================================*/

// Class IDs
new g_zclass_leech

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    
register_plugin("[ZP] Default Zombie Classes""4.3""MeRcyLeZZ")
    
    
// Register all classes
    
zp_register_zombie_class(zclass1_namezclass1_infozclass1_modelzclass1_clawmodelzclass1_healthzclass1_speedzclass1_gravityzclass1_knockback)
    
zp_register_zombie_class(zclass2_namezclass2_infozclass2_modelzclass2_clawmodelzclass2_healthzclass2_speedzclass2_gravityzclass2_knockback)
    
zp_register_zombie_class(zclass3_namezclass3_infozclass3_modelzclass3_clawmodelzclass3_healthzclass3_speedzclass3_gravityzclass3_knockback)
    
zp_register_zombie_class(zclass4_namezclass4_infozclass4_modelzclass4_clawmodelzclass4_healthzclass4_speedzclass4_gravityzclass4_knockback)
    
g_zclass_leech zp_register_zombie_class(zclass5_namezclass5_infozclass5_modelzclass5_clawmodelzclass5_healthzclass5_speedzclass5_gravityzclass5_knockback)
}

// User Infected forward
public zp_user_infected_post(idinfector)
{
    
// If attacker is a leech zombie, gets extra hp
    
if (zp_get_user_zombie_class(infector) == g_zclass_leech)
        
set_pev(infectorpev_healthfloat(pev(infectorpev_health) + zclass5_infecthp))

PD: No entendi lo que me quisiste decir

Last edited by JorG; 04-11-2012 at 19:55.
JorG is offline
xLeoNNN
Veteran Member
Join Date: Sep 2010
Location: de_dust2
Old 04-11-2012 , 20:12   Re: [Zp] Como agregar una nueva clase
#4

pensé que querias adaptarlo al zombie plague internamente jaja.
pero en que tienes problemas ? te apuesto a que no has intentado adaptarlo si quiera :/
__________________
xLeoNNN is offline
Send a message via MSN to xLeoNNN
XINLEI
me too
Join Date: Jun 2011
Location: Colombian Coffee storage
Old 04-11-2012 , 20:44   Re: [Zp] Como agregar una nueva clase
#5

Falta el zp_register_zombie_class.
XINLEI is offline
JorG
Junior Member
Join Date: Mar 2012
Old 04-11-2012 , 20:45   Re: [Zp] Como agregar una nueva clase
#6

No si pero lo que no entiendo es como poner esa clase de zombie.

Nc si va esta sola parte del plugin
PHP Code:
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 
xq si es eso nomas es facil pero cmo hago para poner todo el plugins eso es lo que no entiendo.

Edito: Ho iria asi
PHP Code:
g_zclass_deimos zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback
esa parte nomas del plugin en zclasses?

Last edited by JorG; 04-11-2012 at 20:48.
JorG is offline
XINLEI
me too
Join Date: Jun 2011
Location: Colombian Coffee storage
Old 04-11-2012 , 20:50   Re: [Zp] Como agregar una nueva clase
#7

Quote:
Originally Posted by JorG View Post
Edito: Ho iria asi
PHP Code:
g_zclass_deimos zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback
esa parte nomas del plugin en zclasses?
Ho iria asi:
PHP Code:
zp_register_zombie_class(zclass_namezclass_infozclass_model,  zclass_clawmodelzclass_healthzclass_speedzclass_gravity,  zclass_knockback
Y en esta parte:
PHP Code:
if (zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_zclass_deimos && !zp_get_user_nemesis(id)) 
Quite el g_zclass_deimos.

Last edited by XINLEI; 04-11-2012 at 20:52.
XINLEI is offline
JorG
Junior Member
Join Date: Mar 2012
Old 04-11-2012 , 20:59   Re: [Zp] Como agregar una nueva clase
#8

Solucionado Muchas Gracias Sal2

Last edited by JorG; 04-11-2012 at 21:03.
JorG is offline
Old 04-11-2012, 21:00
JorG
This message has been deleted by JorG. Reason: lo subi 2 veces sin qerer
 



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 00:55.


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