Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Defines promblem's

shel
сообщение 24.10.2014, 20:40
Сообщение #1
Стаж: 12 лет

Сообщений: 79
Благодарностей: 7
Полезность: 0

Код:
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <fakemeta_util>
#include <cstrike>

#define PLUGIN "[ZP] Extra Item: Force Field Grenade"
#define VERSION "v2.3"
#define AUTHOR "lucas_7_94" // Thanks To Users in credits too!.
#define _zzz "cs_get_user_team(id) == CS_TEAM_T"
#define _zzz1 "cs_get_user_team(id) == CS_TEAM_CT"
#define CAMPO_ROUND_NAME "Force Shield (Complete Round)"
#define CAMPO_TIME_NAME "Force Shield (Short-Time)"
#define ValidTouch(%1) ( is_user_alive(%1) && (_zzz(%1)) )

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


new const NADE_TYPE_CAMPO = 6545
new Float:CampoColors[ 3 ] = { 0.0 , 0.0 , 0.0 }
new TrailColor[ 3 ] = { 000, 000, 000 }
new Float:Maxs[ 3 ] = { 100.0 , 100.0 , 100.0 }
new Float:Mins[ 3 ] = { -100.0, -100.0, -100.0 }

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

new g_trailSpr, g_SayText, g_itemID

new gBomb
const Float:Push = 5.0

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

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

RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
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)
register_clcmd("zzzz", "give_ent")
}

public event_round_start() {
remove_entity_name(entclas)
gBomb = 1
}

public plugin_precache() {

g_trailSpr = engfunc(EngFunc_PrecacheModel, sprite_grenade_trail)
engfunc(EngFunc_PrecacheModel, model_grenade)
engfunc(EngFunc_PrecacheModel, model)
engfunc(EngFunc_PrecacheModel, w_model)
}

public client_disconnect(id)
gBomb &= ~( 1 << ( id % 32 ) )

public fw_PlayerKilled(victim, attacker, shouldgib)
{
if( ( 1 <= attacker <= 32 ) && ( gBomb & ( 1 << ( victim % 32 ) ) ) )
gBomb &= ~( 1 << ( victim % 32 ) )
}

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 plugin_natives(){
register_native("givegrenade", "give_ent", 1);
}

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 id = pev(entity, pev_owner)
if(is_user_alive(id) && _zzz1 && ( gBomb & ( 1 << ( id % 32 ) ) ) )
{
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(TrailColor[ 0 ]) // r
write_byte(TrailColor[ 1 ]) // g
write_byte(TrailColor[ 2 ]) // b
write_byte(500) // brightness
message_end()

set_pev(entity, pev_flTimeStepSound, NADE_TYPE_CAMPO)
gBomb &= ~( 1 << ( id % 32 ) )
entity_set_model(entity, w_model)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED

}

public give_ent(id){
gBomb |= ( 1 << ( id % 32 ) )

if( !user_has_weapon( id, CSW_SMOKEGRENADE ) )
give_item(id,"weapon_smokegrenade")
}

public DeleteEntityGrenade(entity)
if( is_valid_ent( entity ) )
remove_entity(entity)

public crear_ent(id) {
// 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,model)
entity_set_int(iEntity, EV_INT_solid, SOLID_TRIGGER)
entity_set_size(iEntity, Mins, Maxs )
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)
entity_set_vector(iEntity, EV_VEC_rendercolor, CampoColors)
return PLUGIN_CONTINUE;
}

public fw_touch(ent, touched)
{
if ( !pev_valid(ent) ) return FMRES_IGNORED;
static entclass[32];
pev(ent, pev_model, entclass, 31);

if ( strcmp( entclass, model ) == 0 )
{
if( ValidTouch(touched) )
{
static Float:pos_ptr[3], Float:pos_ptd[3]

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
}
set_pev(touched, pev_velocity, pos_ptd)
set_pev(touched, pev_impulse, pos_ptd)
}
}
return FMRES_HANDLED
}


public DeleteEntity( entity ) // Thanks xPaw For The Code =D
if( is_valid_ent( entity ) )
remove_entity( entity );

stock Color(const id, const input[], any:...)
{
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")

message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, id)
write_byte(id)
write_string(msg)
message_end()
}

public shield_deploy( shield_ent )
{
if( pev_valid( shield_ent ) != 2 )
return HAM_IGNORED;

static const mPlayer = 41

new id = get_pdata_cbase( shield_ent, mPlayer, 4 );

if( (gBomb & (1<<(id%32))) && _zzz1)
set_pev( id, pev_viewmodel2, model_grenade );

return HAM_IGNORED;
}

Типо хотел портировать конкретные проблемы вышли с _zzz и _zzz1

Отредактировал: shel, - 24.10.2014, 20:41
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: