Raised This Month: $ Target: $400
 0% 

Campo de Fuerza


  
 
 
Thread Tools Display Modes
Author Message
Lukriss
Member
Join Date: Jul 2011
Old 09-15-2011 , 22:32   Campo de Fuerza
#1

Buenas, he estado modificando un plugin es un campo de fuerza, un item extra de ZP pero quiero modificarlo para que funcione normal, no para ZP, estoy tratando de crear un pequeño mod y me fascino esto, e tratado de modificarlo me compilaba y todo pero al tirar la granada se quedaba en el suelo y no hacia nada, Aqui les dejo el code sin ningun cambio, si me pueden ayudar.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <zombieplague>
#include <hamsandwich>
#include <fakemeta_util>
#include <fun>

#define PLUGIN "[ZP] Extra Item: Force Field Grenade"
#define VERSION "v2.1"
#define AUTHOR "lucas_7_94" // Thanks To Users in credits too!.

#define CAMPO_ROUND_NAME "Force Shield (Complete Round)"
#define CAMPO_TIME_NAME "Force Shield (Short-Time)"
#define ValidTouch(%1) ( is_user_alive(%1) && ( zp_get_user_zombie(%1) || zp_get_user_nemesis(%1) ) )

/*=============================[Plugin Customization]=============================*/
#define CAMPO_TASK
//#define CAMPO_ROUND

//#define RANDOM_COLOR
#define ONE_COLOR

new const NADE_TYPE_CAMPO 3679

#if defined ONE_COLOR
new Float:CampoColors[3] = { 
    
255.0 // r
    
0.0 ,   // g
    
0.0     // b
}
#endif

new const model_grenade[] = "models/zombie_plague/v_auragren.mdl"
new const model[] = "models/zombie_plague/aura8.mdl"
new const w_model[] = "models/zombie_plague/w_aura.mdl"
new const sprite_grenade_trail[] = "sprites/laserbeam.spr"
new const entclas[] = "campo_grenade_forze"

new cvar_flaregrenadesg_trailSprcvar_pushg_SayTextg_itemID

new bool:g_bomb[33]

const 
item_cost 15
/*=============================[End Customization]=============================*/

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade")
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
    
cvar_flaregrenades get_cvar_pointer("zp_flare_grenades")
    
    
register_forward(FM_SetModel"fw_SetModel")
    

    
RegisterHam(Ham_Item_Deploy"weapon_smokegrenade""shield_deploy"1)
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
register_forward(FM_Touch"fw_touch")
    
    
g_SayText get_user_msgid("SayText")
    
    
register_cvar("zp_shield_creator""lucas_7_94"FCVAR_SERVER|FCVAR_PROTECTED)
    
    
#if defined CAMPO_ROUND
    
g_itemID zp_register_extra_item CAMPO_ROUND_NAME item_cost ZP_TEAM_HUMAN )
    
#else 
    
g_itemID zp_register_extra_item CAMPO_TIME_NAME item_cost ZP_TEAM_HUMAN )
    
#endif
    
    // Push cvar, (Only float's numbers)
    
cvar_push register_cvar("zp_forze_push""7.5")
}

public 
event_round_start() {
    
    
#if defined CAMPO_ROUND
    
remove_entity_name(entclas)
    
#endif
    
    
arraysetg_bombfalse33 );
}

public 
plugin_precache() {
    
    
g_trailSpr engfunc(EngFunc_PrecacheModelsprite_grenade_trail)
    
engfunc(EngFunc_PrecacheModelmodel_grenade)
    
engfunc(EngFunc_PrecacheModelmodel)
    
engfunc(EngFunc_PrecacheModelw_model)
}

public 
client_disconnect(id
    
arraysetg_bombfalse33 );

public 
zp_extra_item_selected(playeritemid) {
    
    if(
itemid == g_itemID)
    {
        if(
g_bomb[player]) 
            
Color(player"!g[Shield]!y You already have a force field")
        else 
        {
            
arraysetg_bombtrueplayer );
            
            
give_item(player,"weapon_smokegrenade")
            
            
            
#if defined CAMPO_ROUND
            
Color(player"!g[Shield]!y You Bought a force field!. This, lasts 1 round complete.")
            
#else
            
Color(player"!g[Shield]!y You Bought a force field!. This, lasts very little!")
            
#endif
        
}
        
        
    }
    
}
public 
fw_PlayerKilled(victimattackershouldgibarraysetg_bombfalse33 );

public 
fw_ThinkGrenade(entity) {   
    
    if(!
pev_valid(entity)) return HAM_IGNORED
    
    
static Float:dmgtime   
    pev
(entitypev_dmgtimedmgtime)
    
    if (
dmgtime get_gametime())
        return 
HAM_IGNORED   
    
    
if(pev(entitypev_flTimeStepSound) == NADE_TYPE_CAMPO)
        
crear_ent(entity)
    
    return 
HAM_SUPERCEDE
}


public 
fw_SetModel(entity, const model[]) {    
    
    static 
Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    if (
dmgtime == 0.0)
        return 
FMRES_IGNORED;
    
    if (
equal(model[7], "w_sm"4))
    {        
        new 
owner pev(entitypev_owner)        
        
        if( 
is_user_alive(owner) && !zp_get_user_zombie(owner) && g_bomb[owner]) 
        {
            
set_pcvar_num(cvar_flaregrenades,0)            
            
            
fm_set_rendering(entitykRenderFxGlowShell000255255kRenderNormal16)
            
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_BEAMFOLLOW// TE id
            
write_short(entity// entity
            
write_short(g_trailSpr// sprite
            
write_byte(10// life
            
write_byte(10// width
            
write_byte(000// r
            
write_byte(255// g
            
write_byte(255// b
            
write_byte(500// brightness
            
message_end()
            
            
set_pev(entitypev_flTimeStepSoundNADE_TYPE_CAMPO)
            
            
set_task(6.0"DeleteEntityGrenade" ,entity)
            
entity_set_model(entityw_model)
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
    
}

public 
DeleteEntityGrenade(entityremove_entity(entity)

public 
crear_ent(id) {
    
    
arraysetg_bombfalseid );
    
    
set_pcvar_num(cvar_flaregrenades,1)
    
    
// Create entitity
    
new iEntity create_entity("info_target")
    
    if(!
is_valid_ent(iEntity))
        return 
PLUGIN_HANDLED
    
    
new FloatOrigin[3
    
entity_get_vector(idEV_VEC_originOrigin
    
    
entity_set_string(iEntityEV_SZ_classnameentclas)
    
    
entity_set_vector(iEntity,EV_VEC_originOrigin)
    
entity_set_model(iEntity,model)
    
entity_set_int(iEntityEV_INT_solidSOLID_TRIGGER)
    
entity_set_size(iEntityFloat: {-100.0, -100.0, -100.0}, Float: {100.0100.0100.0})
    
entity_set_int(iEntityEV_INT_renderfxkRenderFxGlowShell)
    
entity_set_int(iEntityEV_INT_rendermodekRenderTransAlpha)
    
entity_set_float(iEntityEV_FL_renderamt50.0)
    
    
#if defined RANDOM_COLOR
    
if(is_valid_ent(iEntity))
    {
        new 
Float:vColor[3]
        
        for(new 
i3i++)
            
vColor[i] = random_float(0.0255.0)
        
        
entity_set_vector(iEntityEV_VEC_rendercolorvColor)
    }
    
#endif
    
    #if defined ONE_COLOR
    
entity_set_vector(iEntityEV_VEC_rendercolorCampoColors)
    
#endif
    
    #if defined CAMPO_TASK
    
set_task(15.0"DeleteEntity"iEntity)
    
#endif
    
    
    
return PLUGIN_CONTINUE;
}

public 
zp_user_infected_post(infectedinfector
    if (
g_bomb[infected]) 
        
arraysetg_bombfalseinfected );

public 
fw_touch(enttouched)
{
    if ( !
pev_valid(ent) ) return FMRES_IGNORED;
    static 
entclass[32];
    
pev(entpev_classnameentclass31);
    
    if ( 
equali(entclassentclas) )
    {    
        if( 
ValidTouch(touched) )
        {
            new 
Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power get_pcvar_float(cvar_push)
            
            
pev(entpev_originpos_ptr)
            
pev(touchedpev_originpos_ptd)
            
            for(new 
03i++)
            {
                
pos_ptd[i] -= pos_ptr[i]
                
pos_ptd[i] *= push_power
            
}
            
set_pev(touchedpev_velocitypos_ptd)
            
set_pev(touchedpev_impulsepos_ptd)
        }
    }
    return 
PLUGIN_HANDLED
}

public 
remove_ent() 
{
    
remove_entity_name(entclas)
}  

public 
DeleteEntityentity )  // Thanks xPaw For The Code =D
    
if( is_valid_ententity ) ) 
    
remove_entityentity );

stock Color(const id, const input[], any:...)
{
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    
message_begin(MSG_ONE_UNRELIABLEg_SayText_id)
    
write_byte(id)
    
write_string(msg)
    
message_end()
}

public 
shield_deployshield_ent )
{
    if( 
pev_validshield_ent ) != )
        return 
HAM_IGNORED;
    
    new 
id get_pdata_cbaseshield_ent41);
    
    if( 
g_bombid ] && !zp_get_user_zombieid ) )
        
set_pevidpev_viewmodel2model_grenade );
    
    return 
HAM_IGNORED;

Lukriss is offline
Old 09-15-2011, 22:33
Geoslide
This message has been deleted by Starsailor.
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 09-16-2011 , 09:55   Re: Campo de Fuerza
#2

Ese no lo uses , espera que estoy trabajando en otra version porque me equivoque con los arraysets.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Lukriss
Member
Join Date: Jul 2011
Old 09-16-2011 , 11:41   Re: Campo de Fuerza
#3

Bueno, pero no podrias trabajar para un campo de fuerza que funcione asi ?
Lukriss is offline
matrix123
Veteran Member
Join Date: Feb 2011
Old 09-16-2011 , 13:02   Re: Campo de Fuerza
#4

Quote:
Originally Posted by Lukriss View Post
Bueno, pero no podrias trabajar para un campo de fuerza que funcione asi ?
[sarcasmo] dale ya que estas de paso lucas haceme un zombie con levels y que en vez de cuchillo tengan el bate de jason y no te olvides de hacer para que puedan volar tipo aviones ;) [/sarcasmo]

chabon ademas que lo hace queres que te haga el que vos queres :S
matrix123 is offline
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 09-16-2011 , 15:05   Re: Campo de Fuerza
#5

Quote:
Originally Posted by lucas_7_94 View Post
Ese no lo uses , espera que estoy trabajando en otra version porque me equivoque con los arraysets.
Feo,ya esta mi fix,funciona de 10 en 4.3,en 4.2 no reemplaza el v_model porque usa curweapon.
__________________
Destro- is offline
Lawer
Senior Member
Join Date: Jul 2010
Location: C:\WINDOWS\MyHouse
Old 09-16-2011 , 15:45   Re: Campo de Fuerza
#6

Primero que nada sacas el inc del zombieplague. Segundo tenes que empezar sacar las cosas que son del zp, eso incluye los publics. Debes crear un public nuevo donde al player le setee el bool de g_bomb a true.
__________________
Lawer is offline
Send a message via Skype™ to Lawer
Lukriss
Member
Join Date: Jul 2011
Old 09-16-2011 , 18:13   Re: Campo de Fuerza
#7

@Lawer lo de sacar el zombie plague y hacer nuevos public's lo se, pero de setearle bools nada, No puedes ayudarme tu ?
Lukriss is offline
Lawer
Senior Member
Join Date: Jul 2010
Location: C:\WINDOWS\MyHouse
Old 09-16-2011 , 21:52   Re: Campo de Fuerza
#8

Es sencillo lo de setear el bool. Creas un public con el nombre que quieras, ej:
PHP Code:
public darcampodefuerza(id) {    g_bomb[id] = true    give_item(id"weapon_smokegrenade") } 
Es algo asi simple sin ponerle ningun return por si ya tiene la funcion activada, pero es para que masomenos te de una idea de como hacerlo.
__________________
Lawer is offline
Send a message via Skype™ to Lawer
Lukriss
Member
Join Date: Jul 2011
Old 09-16-2011 , 22:16   Re: Campo de Fuerza
#9

nununu, :s No me sale, gracias de todos modos
Lukriss is offline
Geoslide
Senior Member
Join Date: Jun 2011
Location: Chilean player
Old 09-17-2011 , 12:37   Re: Campo de Fuerza
#10

Y me parece que deberias borrar los g_itemID que estan en el plugin_init no ?
__________________
Basebuilder V6 - plugin for sale
Jailbreak V6 - plugin for sale
more plugins in progress ...

Geoslide ?
Geoslide 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 04:20.


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