Veteran Member
|
04-11-2012
, 13:26
Force Field Grenade to Normal Server
|
#1
|
Hi, could someone make the bubble is for a normal server (not using the zombie plague), which is the default bubble smokegrenade, thanks.
[ZP] Extra Item : Force Field Grenade [v2.1] [Update 09-12-11]
>>Customization:
You can edit it your way.
This plugin has 2 defines.
PHP Code:
//#define CAMPO_TASK #define CAMPO_ROUND
In this case, the effect lasts 1 round whole.
In This Case :
PHP Code:
#define CAMPO_TASK //#define CAMPO_ROUND
This effect lasts 15 sec.
NEW!:
PHP Code:
/* Color Defines */ //#define RANDOM_COLOR #define ONE_COLOR /* End Color Defines*/
If you choose RANDOM_COLOR, the color will be chosen at random.
ONE_COLOR If you choose, you can choose your color by editing this line.
PHP Code:
new Float:CampoColors[3] = { 255.0 , 0.0 , 0.0 }
PD: Only supports numbers with a comma.
>> Cvars:
PHP Code:
cvar_push = register_cvar("zp_forze_push", "7.5") // Push // You can not use whole numbers, only with a comma.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <engine> #include <fakemeta_util> #include <fun> #include <hamsandwich> #include <zombieplague>
#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 p_bubble[] = "models/zombie_plague/p_bubble.mdl" new const v_bubble[] = "models/zombie_plague/v_bubble.mdl" new const w_bubble[] = "models/zombie_plague/w_bubble.mdl" new const bubble_shield[] = "models/zombie_plague/bubble_shield.mdl" new const sprite_grenade_trail[] = "sprites/laserbeam.spr" new const entclas[] = "campo_grenade_forze"
new cvar_flaregrenades, g_trailSpr, cvar_push, g_itemID
new bool:g_bomb[33]
const item_cost = 15 /*=============================[End Customization]=============================*/
public plugin_init() { register_plugin("[ZP] Extra Item: Force Field Grenade", "v2.1", "lucas_7_94"); // Thanks To Users in credits too! RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "Bubble_Deploy", 1) cvar_flaregrenades = get_cvar_pointer("zp_flare_grenades") register_event("HLTV", "event_round_start", "a", "1=0", "2=0") register_forward(FM_Touch, "fw_touch") register_forward(FM_SetModel, "fw_SetModel") 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 * 2 , 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 arrayset( g_bomb, false, 33 ); }
public plugin_precache() { engfunc(EngFunc_PrecacheModel, p_bubble) engfunc(EngFunc_PrecacheModel, v_bubble) engfunc(EngFunc_PrecacheModel, w_bubble) engfunc(EngFunc_PrecacheModel, bubble_shield) g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail) }
public client_disconnect(id) arrayset( g_bomb, false, 33 );
public zp_extra_item_selected(player, itemid) { if(itemid == g_itemID) { if(g_bomb[player]) ChatColor(player, "!g[ Bubble ] !yYou already have a force field.") else { arrayset( g_bomb, true, player ); give_item(player,"weapon_smokegrenade") #if defined CAMPO_ROUND ChatColor(player, "!g[ Bubble ] !yYou Bought a force field!. This, lasts 1 round complete.") #else ChatColor(player, "!g[ Bubble ] !yYou Bought a force field!. This, lasts very little!") #endif } } }
public fw_PlayerKilled(victim, attacker, shouldgib) arrayset( g_bomb, false, 33 );
public fw_ThinkGrenade(entity) { if(!pev_valid(entity)) return HAM_IGNORED static Float:dmgtime pev(entity, pev_dmgtime, dmgtime) if (dmgtime > get_gametime()) return HAM_IGNORED if(pev(entity, pev_flTimeStepSound) == NADE_TYPE_CAMPO) crear_ent(entity) return HAM_SUPERCEDE }
public fw_SetModel(entity, const model[]) { static Float:dmgtime pev(entity, pev_dmgtime, dmgtime) if (dmgtime == 0.0) return FMRES_IGNORED; if (equal(model[7], "w_sm", 4)) { new owner = pev(entity, pev_owner) if( is_user_alive(owner) && !zp_get_user_zombie(owner) && g_bomb[owner]) { set_pcvar_num(cvar_flaregrenades,0) fm_set_rendering(entity, kRenderFxGlowShell, 000, 255, 255, kRenderNormal, 16) message_begin(MSG_BROADCAST, SVC_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(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO) set_task(6.0, "DeleteEntityGrenade" ,entity) entity_set_model(entity, w_bubble) return FMRES_SUPERCEDE } } return FMRES_IGNORED }
public DeleteEntityGrenade(entity) remove_entity(entity)
public crear_ent(id) { arrayset( g_bomb, false, id ); set_pcvar_num(cvar_flaregrenades,1) // Create entitity new iEntity = create_entity("info_target") if(!is_valid_ent(iEntity)) return PLUGIN_HANDLED new Float: Origin[3] 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, bubble_shield) entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER) entity_set_size(iEntity, Float: {-100.0, -100.0, -100.0}, Float: {100.0, 100.0, 100.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) #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) entity_set_vector(iEntity, EV_VEC_rendercolor, vColor) } #endif #if defined ONE_COLOR entity_set_vector(iEntity, EV_VEC_rendercolor, CampoColors) #endif #if defined CAMPO_TASK set_task(15.0, "DeleteEntity", iEntity) #endif return PLUGIN_CONTINUE; }
public zp_user_infected_post(infected, infector) if (g_bomb[infected]) arrayset( g_bomb, false, infected );
public fw_touch(ent, touched) { if ( !pev_valid(ent) ) return FMRES_IGNORED; static entclass[32]; pev(ent, pev_classname, entclass, 31); if ( equali(entclass, entclas) ) { if( ValidTouch(touched) ) { new Float:pos_ptr[3], Float:pos_ptd[3], Float:push_power = get_pcvar_float(cvar_push) pev(ent, pev_origin, pos_ptr) pev(touched, pev_origin, pos_ptd) for(new i = 0; i < 3; i++) { pos_ptd[i] -= pos_ptr[i] pos_ptd[i] *= push_power } set_pev(touched, pev_velocity, pos_ptd) set_pev(touched, pev_impulse, pos_ptd) } } return PLUGIN_HANDLED }
public remove_ent() remove_entity_name(entclas)
public DeleteEntity( entity ) // Thanks xPaw For The Code =D if( is_valid_ent( entity ) ) remove_entity( entity );
stock ChatColor(const id, const input[], any:...) { new count = 1, players[32]; static msg[191]; vformat(msg, 190, input, 3);
replace_all(msg, 190, "!y", "^1"); // Default Color replace_all(msg, 190, "!g", "^4"); // Green Color replace_all(msg, 190, "!team", "^3"); // Team Color if (id) players[0] = id; else get_players(players, count, "ch"); { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } } }
public Bubble_Deploy( shield_ent ) { if( pev_valid( shield_ent ) != 2 ) return HAM_IGNORED; new id = get_pdata_cbase( shield_ent, 41, 4 ); if( g_bomb[ id ] && !zp_get_user_zombie( id ) ) set_pev( id, pev_weaponmodel2, p_bubble ); set_pev( id, pev_viewmodel2, v_bubble ); return HAM_IGNORED; }
__________________
Last edited by leonard19941; 04-11-2012 at 16:57.
|
|