AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [zp] campo de fuerza (https://forums.alliedmods.net/showthread.php?t=130713)

Destro- 06-26-2010 18:30

[zp] campo de fuerza
 
Soy nuevo en esto y en el foro
me pueden ayudar con esto?

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN "[ZP] Burbuja"
#define VERSION "3.0"
#define AUTHOR "Destro"

#define ONE_COLOR
#define CAMPO_TASK

//#define RANDOM_COLOR

#if defined ONE_COLOR
new Float:colour_force_shield[3] = { 255.0 , 255.0 , 255.0 }
#endif

new g_bubble_bomb[33]
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 entclas[] = "campo_grenade_forze"
new cvar_bubblepush
new register_touch

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("BUBBLEBOMB", "give_item_bubble")
register_event("CurWeapon", "hook_curwpn", "be", "1=1", "2!29");
cvar_bubblepush = register_cvar("zp_bubble_push", "100.0")

register_touch(entclas, "player", "entity_touch")

}

public plugin_precache()
{
engfunc(EngFunc_PrecacheModel, model_grenade)
engfunc(EngFunc_PrecacheModel, model)
engfunc(EngFunc_PrecacheModel, w_model)
}

// Bubble Grenade Explosion
public bubble_explode(id)
{
// Get origin
static Float:originF[3]
pev(id, pev_origin, originF)

// Create Blast
create_blast4(originF)

new attacker // variable attacker ( ataque )
attacker = pev(id, pev_owner)

g_bubble_bomb[attacker] = false

set_pcvar_num(cvar_flaregrenades,1)

// Create entitity
new iEntity = create_entity("info_target")

if(!is_valid_ent(iEntity)) // determinamos que la entidad esta en false
return PLUGIN_HANDLED

new Float: Origin[3] // origen
entity_get_vector(id, EV_VEC_origin, Origin)

entity_set_string(iEntity, EV_SZ_classname, entclas)

entity_set_vector(iEntity,EV_VEC_origin, Origin)
entity_set_model(iEntity,model)
entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER)
entity_set_size(iEntity, Float: {-110.0, -110.0, -110.0}, Float: {110.0, 110.0, 110.0})
entity_set_int(iEntity, EV_INT_renderfx, kRenderFxGlowShell)
entity_set_int(iEntity, EV_INT_rendermode, kRenderTransAlpha)
entity_set_float(iEntity, EV_FL_renderamt, 50.0) //

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_DLIGHT)
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2])
write_byte(15)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(2)
write_byte(0)
message_end()

#if defined RANDOM_COLOR
if(is_valid_ent(iEntity))
{
new Float:vColor[3]

for(new i; i < 3; i++)
vColor[i] = random_float(0.0, 255.0) // color r, g, b

entity_set_vector(iEntity, EV_VEC_rendercolor, vColor)
}
#endif

#if defined ONE_COLOR
entity_set_vector(iEntity, EV_VEC_rendercolor, colour_force_shield)
#endif

#if defined CAMPO_TASK
set_task(60.0, "DeleteEntity", iEntity)
#endif

return PLUGIN_CONTINUE;
}

// Bubble Grenade: Yellow Blast
create_blast4(const Float:originF[3])
{
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2])
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2]+385.0)
write_short(g_exploSpr)
write_byte(0)
write_byte(0)
write_byte(4)
write_byte(60)
write_byte(0)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(200)
write_byte(0)
message_end()

// Medium ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2])
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2]+470.0)
write_short(g_exploSpr)
write_byte(0)
write_byte(0)
write_byte(4)
write_byte(60)
write_byte(0)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(200)
write_byte(0)
message_end()

// Largest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2])
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2]+555.0)
write_short(g_exploSpr)
write_byte(0)
write_byte(0)
write_byte(4)
write_byte(60)
write_byte(0)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(200)
write_byte(0)
message_end()
}

// Touch bomb bubble
public entity_touch(touched, toucher)
{

if(g_zombie[toucher] || g_nemesis[toucher])

new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_bubblepush)

pev(touched, pev_origin, pos_ptr)
pev(toucher, pev_origin, pos_ptd)

for(new i = 0; i < 3; i++)
{
pos_ptd[i] -= pos_ptr[i]
pos_ptd[i] *= push_power
}
set_pev(toucher, pev_velocity, pos_ptd)
set_pev(toucher, pev_impulse, pos_ptd)
}
}

// Hook bubble bomb
public hook_curwpn(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE;

if(g_bubble_bomb[id] && !g_zombie[id])
{
new wID = read_data(2)
if(wID == CSW_SMOKEGRENADE)
set_pev(id, pev_viewmodel2, model_grenade)
}

return PLUGIN_CONTINUE;
}

// Give bubble item
public give_item_bubble(id)
{
g_bubble_bomb[id] = true
give_item(id,"weapon_smokegrenade")
}

// Remove Entity
public DeleteEntity(entity)
{
if(is_valid_ent(entity )
remove_entity(entity)
}
}



En register_touch(entclas, "player", "entity_touch") tengo algun error?porq me lo marca cuando lo qiero copilar

Desktop 06-26-2010 20:29

Re: [zp] campo de fuerza
 
[ES]
Usa [php] y [//php] (una barra sola), fijate en la nueva version de eso
[EN]
Use [php] to post the source code.
WTF
PHP Code:

#define PLUGIN "[ZP] Burbuja"
#define VERSION "3.0"
#define AUTHOR "Destro" 


Varchar' 06-26-2010 20:38

Re: [zp] campo de fuerza
 
[ES] Para postear en espaņol debes ir a la Seccion Others. (http://forums.alliedmods.net/forumdisplay.php?f=10)

[EN] This new version of this plugin, and the author is lucas_7_94.


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.0"
#define AUTHOR "lucas_7_94" // Thanks To Users in credits too!.

#define CAMPO_ROUND_NAME "Force Shield (One Round)"
#define CAMPO_TIME_NAME "Force Shield (Short-acting)"

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


//#define RANDOM_COLOR
#define ONE_COLOR

new const NADE_TYPE_CAMPO 5698 

#if defined ONE_COLOR
new Float:CampoColors[3] = { 255.0 0.0 0.0 }
#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]


/*=============================[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")

    
register_event"CurWeapon""hook_curwpn""be""1=1""2!29" );

    
    
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"AUTHORFCVAR_SERVER|FCVAR_PROTECTED)
    
    
#if defined CAMPO_ROUND
    
g_itemID zp_register_extra_item CAMPO_ROUND_NAME 30 ZP_TEAM_HUMAN )
    
#else 
    
g_itemID zp_register_extra_item CAMPO_TIME_NAME 15 ZP_TEAM_HUMAN )
    
#endif
    
    // Push cvar, [Only number's with Coma]
    
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(idg_bomb[id] = false

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 
        {
            
g_bomb[player] = true
            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(victimattackershouldgibg_bomb[victim] = false

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(!
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) {
    
    new 
attacker
    attacker 
pev(idpev_owner)
    
    
g_bomb[attacker] = false
    
    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]) 
        
g_bomb[infected] = false

public fw_touch(enttouched)
{
    if ( !
pev_valid(ent) ) return FMRES_IGNORED;
    static 
entclass[32];
    
pev(entpev_classnameentclass31);
    
    if ( 
equali(entclassentclas) )
    {    
        if(
zp_get_user_zombie(touched) || zp_get_user_nemesis(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 
hook_curwpnid ) { // Thanks Anakin_cstrike For The Code ! =D [Virus Grenade]
    
if( !is_user_aliveid ) )
        return 
PLUGIN_CONTINUE;
    
    if( 
g_bombid ] && !zp_get_user_zombieid ) )
    {
        new 
wID read_data)
        if( 
wID == CSW_SMOKEGRENADE )
            
set_pevidpev_viewmodel2model_grenade )
    }
    return 
PLUGIN_CONTINUE;


http://forums.alliedmods.net/showthread.php?t=111102

Alucard^ 06-27-2010 02:10

Re: [zp] campo de fuerza
 
Spanish people stop posting here in spanish languages :/ we have a subforum for this like Varchar said.


All times are GMT -4. The time now is 14:50.

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