Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
- Ошибка
-
ошибка снизу.
- Компилятор
- Локальный
- Amx Mod X
- 1.10.0
- Исходный код
-
/*
- Отключено:
1. Лечение дружеских строений
2. Возможность постройки более 1 раздатчика
3. Заморозка раздатчика на определенное время
4. Улучшение раздатчика до раздатчика денег
5. Эффект постройки раздатчика
6. Вознограждение за разрушение раздатчика
7. Работа с достижениями
- Можно изменить эффект раздатчика при пополнении здоровья
- Количество уровней можно регулировать в данный момент 4 уровня
- Изменен эффект взрыва раздатчика
- Добавлено меню раздатчика
- Разделен на VIP игроков и обычных:
1. Для VIP постройка дешевле
2. Для VIP улучшение дешевле
3. VIP могут прокачивать свой раздатчик сколько угодно
- Цвет луча лечения зеленого цвета
- При полном здоровье игрока луч пропадает
- Дружественные раздатчики могут лечить друг друга
- Раздатчик повернут в ту сторону, куда смотрит игрока
- Соотношение размеров учтено, можно забираться на раздатчик
- Уничтожение раздатчика подправлено
*/
#include < amxmodx >
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < cstrike >
#include < engine >
#include < hamsandwich >
#include < xs >
#include < dhudmessage >
//#include <mission_inc>
#define BREAK_COMPUTER 6
#define MAX_PLAYERS 32 + 1
#define is_valid_player(%1) ( 1 <= %1 <= gMaxPlayers )
new const gDamageSounds[ ][ ] =
{
"debris/metal1.wav",
"debris/metal2.wav",
"debris/metal3.wav"
};
set_player_bonus(id, bonus) return 0 // native set_player_bonus(id, bonus)
// native get_sentry_team(ent)
get_bariga(id) return 0 //native get_bariga(id) - функция делалась для моего сервера
//native get_SentryLevel(ent)
new const gDispenserClassname[ ] = "NiceDispenser";
new const gDispenserActive[ ] = "disp_csdm/dispenser.wav";
new const gDispenserMdl[ ] = "models/new_dispkk.mdl";
new const gHealingSprite[ ] = "sprites/dispenser.spr";
new gSpr_regeneration
enum
{
x,
y,
z
}
new g_iSPR_Smoke3;
new gHealingBeam;
new gMaxPlayers;
new g_iPlayerDispenser[33]
new ExplSpr
new Float:flood_disptouch[33]
#define DISPENSER_COST 3000
#define DISPENSER_COST_VIP 2000
new const moneytraf[2] = {3000, 8000}
new const d_upgcost[4] = {3000,2000,2500,6000}
new const d_upgcost_vip[4] = {2000,1000,1500,4500}
new const d_enthp[4] = {3000,4500,6000,8000}
new const Float:d_radius[4] = {600.0,750.0,900.0,1100.0}
new const d_hp[4] = {100,200,300,400}
new const Float:g_HEALTHSS[5] = {3000.0, 4000.0, 5000.0, 6000.0, 7000.0}
new const d_ap[4] = {100,200,300,400}
new const Float:d_takehp[4] = {1.0,1.5,2.0,2.5}
new const Float:d_takehpabjects[4] = {1.0,2.0,3.0,4.0}
new const Float:d_takeap[4] = {1.0,1.5,2.0,2.5}
// new Float:gDispenserOrigin[ MAX_PLAYERS ][ 3 ];
new gBeamcolor[ MAX_PLAYERS ][ 3 ];
new bool:bDispenserBuild[ MAX_PLAYERS ];
new touchdisp[33]
//native dips_balanced(id, amount)
new Disp_balance[1000]
new dispFreez[1000]
new updatingdisp[1000]
public plugin_init( )
{
register_plugin( "Build Dispenser", "0.1", "pro100iweb" );
register_event( "TextMsg", "EVENT_TextMsg", "a", "2&#Game_C", "2&#Game_w", "2&#Game_will_restart_in" );
register_logevent( "LOG_RoundEnd", 2, "1=Round_End" );
register_event ( "Spectator", "ev_Spectation", "a" )
register_forward ( FM_TraceLine, "fw_TraceLine_Post", 1 )
RegisterHam( Ham_TakeDamage, "func_breakable", "bacon_TakeDamage", 1 );
RegisterHam( Ham_TakeDamage, "func_breakable", "bacon_TakeDamagePre", 0 );
register_think( gDispenserClassname, "DispenserThink" );
register_touch ( gDispenserClassname, "player", "fw_DispenserTouch" )
register_clcmd( "build_dispenser", "CommandDispenserBuild" );
//register_clcmd( "setf", "setf" );
//register_clcmd( "setddd", "show_updatemenu" );
register_clcmd( "say dispstats", "dispstats" );
register_clcmd( "detonate_dispenser", "disppp_menu" );
gMaxPlayers = get_maxplayers( );
}
/* public plugin_natives ()
{
register_native ( "set_freezDispenser", "nativeget_setfreezDispenser", 1)
}
public nativeget_setfreezDispenser(sentry)
{
if(dispFreez[sentry]) return 1
new iEntity = create_entity("info_target")
new Float: Origin[3]
entity_get_vector(sentry, EV_VEC_origin, Origin)
entity_set_string(iEntity, EV_SZ_classname, "Shield_Ent")
entity_set_vector(iEntity,EV_VEC_origin, Origin)
entity_set_model(iEntity, "models/great_sentries/PFG_BLOCKS.mdl")
set_pev(iEntity, pev_solid, SOLID_TRIGGER );
set_pev(iEntity, pev_body, 1);
set_pev(sentry,pev_euser4,iEntity)
set_task ( 15.0, "DelayRemoveFreezD", sentry+2000)
return dispFreez[sentry] = 1
}
public DelayRemoveFreezD(entoff){
new sentry = entoff-2000
new iceCub = pev(sentry,pev_euser4)
if(pev_valid(sentry)){
dispFreez[sentry] = 0
}
if(pev_valid(iceCub)){
remove_entity(iceCub)
}
} */
/* public setf(id){
cs_set_user_money(id, cs_get_user_money(id) + 1000)
} */
public DeleteEntity( entity ){
new iceCub = pev(entity,pev_euser4)
if(pev_valid(iceCub) && dispFreez[entity]){
remove_entity(iceCub)
set_pev(iceCub,pev_euser4, 0)
dispFreez[entity] = 0
}
iceCub = pev(entity,pev_euser3)
if(pev_valid(iceCub)){
remove_entity(iceCub)
set_pev(iceCub,pev_euser3, 0)
}
if(task_exists(entity+3000)){
remove_task(entity+3000)
}
if(task_exists(entity+2000)){
remove_task(entity+2000)
}
if(pev_valid(entity)){
remove_entity(entity)
}
}
public ev_Spectation ()
{
new id = read_data ( 1 )
BreakAllPlayerDispensers(id)
}
public show_updatemenu(id){
new szItem[128]
format(szItem, 127, "\wУстановить способность^nРаздатчик \rДенег \wHP \r%d", moneytraf[0])
new menu = menu_create(szItem,"touchdispc");
format(szItem, 127, "\r[\wДа \r%d\y$!\r]", moneytraf[1])
menu_additem( menu, szItem)
menu_additem( menu, "\r[\wНет\r]")
menu_display(id,menu)
return PLUGIN_HANDLED
}
public touchdispc(id, menu, key){
key++
menu_destroy(menu)
if(key==1){
if(!pev_valid(touchdisp[id]))
return;
if ( pev ( touchdisp[id], pev_iuser4 ) != _:cs_get_user_team ( id ) )
return;
if(cs_get_user_money(id)<moneytraf[1])
return;
cs_set_user_money(id,cs_get_user_money(id)-moneytraf[1]);
//set_bankmoney(id,moneytraf[1])
set_pev( touchdisp[id], pev_health, float(moneytraf[0]) );
set_pev( touchdisp[id], pev_iuser1, 1 );
} else {
return
}
}
public disppp_menu(id)
{
if(g_iPlayerDispenser[id] == 0){
ChatColor ( id, "^4У тебя нет раздатчика")
return HAM_IGNORED
}
new szItem[128];
new szItem1[128];
new msentry_item = menu_create("\yВыберите раздатчик!", "cl_mendisp")
static ent = -1
while ((ent = find_ent_by_class(ent, gDispenserClassname)))
{
if( pev( ent, pev_iuser2) != id) continue;
if(pev_valid(ent))
{
new iLevel = pev ( ent, pev_iuser3 )
new iHealth = pev ( ent, pev_health )
format(szItem, 127, "%d", ent)
format(szItem1, 127, "\wID \r%d \w| уровень \r%d \w[HP \y%d\w]", ent, iLevel, iHealth)
menu_additem( msentry_item, szItem1, szItem, 0)
}
}
menu_setprop(msentry_item, MPROP_EXIT, MEXIT_ALL)
menu_setprop(msentry_item, MPROP_EXITNAME, "\yВыход")
menu_display(id, msentry_item, 0)
return PLUGIN_HANDLED
}
public cl_mendisp(id, menu, item) {
new s_Data[6], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
new i_Key = str_to_num(s_Data)
menu_destroy(menu)
if(i_Key == 0) return 0
if ( !is_valid_ent ( i_Key ) ) return 0
touchdisp[id] = i_Key
disp_menu_func(id)
return 1
}
public disp_menu_func(id)
{
if(g_iPlayerDispenser[id] == 0){
ChatColor ( id, "^4У тебя нет раздатчика")
return HAM_IGNORED
}
new szItem[128];
new szItem1[128];
new ent = touchdisp[id];
if(ent==0) return PLUGIN_HANDLED
new msentry_item = menu_create("\yЧто делать с раздатчиком?!", "cl_mend");
if(pev_valid(ent))
{
new iLevel = pev ( ent, pev_iuser3 )
new iHealth = pev ( ent, pev_health )
format(szItem, 127, "%d", ent)
menu_additem( msentry_item, "\wУничтожить")
//menu_additem( msentry_item, "\wУлучшить до раздатчика денег")
//menu_additem( msentry_item, "\wПоложить в раздатчик 10000$ НДС \r1000\y$")
menu_addblank( msentry_item, 0)
menu_addblank( msentry_item, 0)
menu_addblank( msentry_item, 0)
format(szItem1, 127, "\wID \r%d", ent)
menu_addtext( msentry_item, szItem1)
format(szItem1, 127, "Уровень \r%d", iLevel)
menu_addtext( msentry_item, szItem1)
format(szItem1, 127, "\w[HP \y%d\w]", iHealth)
menu_addtext( msentry_item, szItem1)
}
menu_setprop(msentry_item, MPROP_EXIT, MEXIT_ALL)
menu_setprop(msentry_item, MPROP_EXITNAME, "\yВыход")
menu_display(id, msentry_item, 0)
return PLUGIN_HANDLED
}
public cl_mend(id, menu, item) {
item++
new ent = touchdisp[id]
new iLevel = pev ( ent, pev_iuser3 )
menu_destroy(menu)
if(item == 0) return 0
if(pev_valid(ent)){
switch(item){
case 1:{
if ( !is_valid_ent ( ent ) ) return 0
DeleteEntity( ent )
g_iPlayerDispenser[ id ]--;
if(g_iPlayerDispenser[ id ] == 0)
bDispenserBuild[ id ] = false;
}
case 2:{
if ( !is_valid_ent ( ent ) )
return 0;
if ( iLevel != 4 ){
ChatColor ( id, "^1Только на 4 уровне!");
return 0;
}
if ( pev ( ent, pev_iuser4 ) != _:cs_get_user_team ( id ) )
return 0;
if(cs_get_user_money(id)<moneytraf[1]){
ChatColor ( id, "^1Не достаточно средств! Стоимость %d", moneytraf[1]);
return 0;
}
cs_set_user_money(id,cs_get_user_money(id)-moneytraf[1]);
//set_bankmoney(id,moneytraf[1])
set_pev( ent, pev_health, float(moneytraf[0]) );
set_pev( ent, pev_iuser1, 1 );
}
case 3:{
if(cs_get_user_money(id)<11000)
return 0;
cs_set_user_money(id,cs_get_user_money(id)-11000);
//set_bankmoney(id,11000)
//set_pev( ent, pev_fuser1, 10000.0 );
Disp_balance[ent] = 10000;
}
}
}
return 1
}
public dispstats(id)
{
ChatColor ( id, "^1У вас [ ^4%d ^1] раздатчик(ов)!", g_iPlayerDispenser[id])
}
public client_connect( id )
{
bDispenserBuild[ id ] = false;
g_iPlayerDispenser[id] = 0
}
public client_disconnect( id )
{
BreakAllPlayerDispensers(id)
g_iPlayerDispenser[id] = 0
}
public plugin_precache( )
{
gHealingBeam = precache_model( gHealingSprite );
g_iSPR_Smoke3 = precache_model("sprites/black_smoke4.spr")
precache_model( gDispenserMdl );
precache_sound( gDispenserActive );
gSpr_regeneration = precache_model("sprites/th_jctf_heal.spr")
new i;
for( i = 0; i < sizeof gDamageSounds; i++ )
{
precache_sound( gDamageSounds[ i ] );
}
ExplSpr = precache_model("sprites/gp_1.spr");
// precache_model("models/great_sentries/PFG_BLOCKS.mdl")
// precache_model("models/great_sentries/PFG_SENTRIES_OLD2.mdl")
}
public fw_TraceLine_Post ( Float:v1[3], Float:v2[3], noMonsters, id )
{
if ( !is_valid_player ( id ) || is_user_bot ( id ) || !is_user_alive ( id ) )
return FMRES_IGNORED
new iHitEnt = get_tr ( TR_pHit )
if ( iHitEnt <= gMaxPlayers || !pev_valid ( iHitEnt ) )
return FMRES_IGNORED
new sClassname[32]
pev ( iHitEnt, pev_classname, sClassname, charsmax ( sClassname ) )
if ( !equal ( sClassname, gDispenserClassname ) )
return FMRES_IGNORED
new iTeam = pev ( iHitEnt, pev_iuser4 )
if ( _:cs_get_user_team ( id ) != iTeam )
return FMRES_IGNORED
new iHealth = pev ( iHitEnt, pev_health )
if ( iHealth <= 0 )
return FMRES_IGNORED
new iOwner = pev ( iHitEnt, pev_iuser2 )
if ( !is_user_connected ( iOwner ) )
return FMRES_IGNORED
new sName[33]
get_user_name ( iOwner, sName, charsmax ( sName ) )
new iLevel = pev ( iHitEnt, pev_iuser3 )
set_dhudmessage ( 255, 255, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "Установил: %s^nID %d HP: %d/%d^nLevel: %d Coins:", sName, iHitEnt, iHealth, d_enthp[iLevel-1], iLevel )
set_dhudmessage ( 255, 0, 0, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "^n^n OFF")
/* switch(pev( iHitEnt, pev_iuser1)){
case 0:{
set_dhudmessage ( 255, 255, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "Установил: %s^nID %d HP: %d/%d^nLevel: %d Coins:", sName, iHitEnt, iHealth, d_enthp[iLevel-1], iLevel )
set_dhudmessage ( 255, 0, 0, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "^n^n OFF")
}
case 1:{
set_dhudmessage ( 255, 255, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "Установил: %s^nID %d HP: %d/%d^nLevel: %d Coins:^nОбъем: %d", sName, iHitEnt, iHealth, moneytraf[0], iLevel, Disp_balance[iHitEnt] )
set_dhudmessage ( 0, 0, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "^n^n ON")
}
} */
return FMRES_IGNORED
}
public bacon_TakeDamagePre( ent, idinflictor, idattacker, Float:damage, damagebits )
{
new szClassname[ 32 ];
pev( ent, pev_classname, szClassname, charsmax( szClassname ) );
if( equal( szClassname, gDispenserClassname ) )
{
if(updatingdisp[ent])
return HAM_SUPERCEDE
new iOwner = pev( ent, pev_iuser2 );
if(!is_user_connected(iOwner) || 1 > iOwner > 32 || !is_user_connected(idattacker) || 1 > idattacker > 32)
return HAM_SUPERCEDE
if(cs_get_user_team(iOwner)==cs_get_user_team(idattacker) && idattacker != iOwner)
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public bacon_TakeDamage( ent, idinflictor, idattacker, Float:damage, damagebits )
{
if ( !pev_valid ( ent ) )
return HAM_IGNORED
new szClassname[ 32 ];
pev( ent, pev_classname, szClassname, charsmax( szClassname ) );
if( equal( szClassname, gDispenserClassname ) )
{
if(updatingdisp[ent])
return HAM_SUPERCEDE
new iOwner = pev( ent, pev_iuser2 );
if(!is_user_connected(iOwner) || 1 > iOwner > 32 || !is_user_connected(idattacker) || 1 > idattacker > 32)
return HAM_SUPERCEDE
if(cs_get_user_team(iOwner)==cs_get_user_team(idattacker) && idattacker != iOwner)
return HAM_SUPERCEDE
if( pev( ent, pev_health ) <= 0.0 )
{
new szName[ 32 ];
get_user_name( idattacker, szName, charsmax( szName ) );
if( idattacker == iOwner )
{
ChatColor ( iOwner, "^3[^4Действие^3]^1 Вы уничтожили собственный раздатчик!")
} else {
ChatColor ( iOwner, "^3[^4Действие^3]^1 %s уничтожил ваш раздатчик!", szName)
ChatColor ( idattacker, "^3[^4Раздатчик^3]^1 Вам начислено 15 бонусов!", szName)
/*код достижения*/
/* if(get_player_type(idattacker) == 1){
if(get_kill_disp(idattacker) == 0){
if(get_player_expmm(idattacker) < 300){
set_player_expmm(idattacker, 1);
if(get_player_expmm(idattacker) >= 300){
set_kill_disp(idattacker, 1);
set_player_type(idattacker, 0)
}
} else if(get_player_expmm(idattacker) >= 300){
set_kill_disp(idattacker, 1);
set_player_type(idattacker, 0)
}
}
} */
/*код достижения*/
}
}
emit_sound( ent, CHAN_STATIC, gDamageSounds[ random_num( 0, charsmax( gDamageSounds ) ) ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}
return HAM_IGNORED
}
stock create_explosion(Float:origin_[3]) {
new origin[3]
FVecIVec(origin_, origin)
message_begin(MSG_ALL,SVC_TEMPENTITY,{0,0,0})
write_byte(TE_SPRITETRAIL) //Спрайт захвата
write_coord((origin[0]))
write_coord((origin[1]))
write_coord((origin[2])+20)
write_coord((origin[0]))
write_coord((origin[1]))
write_coord((origin[2])+80)
write_short(ExplSpr)
write_byte(20)
write_byte(20)
write_byte(4)
write_byte(20)
write_byte(10)
message_end()
}
public CommandDispenserBuild( id )
{
if( !is_user_alive( id ) )
{
return PLUGIN_CONTINUE;
}
if( !( pev( id, pev_flags ) & FL_ONGROUND ) )
{
ChatColor ( id, "^3[^4Информация^3]^1 Вы можете построить раздатчик только на земле!")
return PLUGIN_HANDLED;
}
if ( g_iPlayerDispenser[id] == 2 && get_bariga(id))
{
ChatColor ( id, "^3[^4Информация^3]^1 Вы уже построили 2 раздатчика!")
return PLUGIN_HANDLED;
} else if(!get_bariga(id)){
if( bDispenserBuild[ id ] == true )
{
ChatColor ( id, "^3[^4Информация^3]^1 Вы уже построили раздатчик!")
return PLUGIN_HANDLED;
}
}
new iMoney = cs_get_user_money( id );
if (get_user_flags(id) & ADMIN_LEVEL_B)
{
if( iMoney < d_upgcost_vip[0] )
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost_vip[0] )
return PLUGIN_HANDLED;
}
}
else
{
if( iMoney < d_upgcost[0] )
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost[0] )
return PLUGIN_HANDLED;
}
}
new Float:playerOrigin[3]
entity_get_vector(id, EV_VEC_origin, playerOrigin)
new Float:vNewOrigin[3]
new Float:vTraceDirection[3]
new Float:vTraceEnd[3]
new Float:vTraceResult[3]
velocity_by_aim(id, 64, vTraceDirection) // get a velocity in the directino player is aiming, with a multiplier of 64...
vTraceEnd[0] = vTraceDirection[0] + playerOrigin[0] // find the new max end position
vTraceEnd[1] = vTraceDirection[1] + playerOrigin[1]
vTraceEnd[2] = vTraceDirection[2] + playerOrigin[2]
trace_line(id, playerOrigin, vTraceEnd, vTraceResult) // trace, something can be in the way, use hitpoint from vTraceResult as new origin, if nothing's in the way it should be same as vTraceEnd
vNewOrigin[0] = vTraceResult[0]// just copy the new result position to new origin
vNewOrigin[1] = vTraceResult[1]// just copy the new result position to new origin
vNewOrigin[2] = playerOrigin[2] // always build in the same height as player.
if (CreateDispanser(vNewOrigin, id))
{
if (get_user_flags(id) & ADMIN_LEVEL_B)
{
cs_set_user_money(id, cs_get_user_money(id) - d_upgcost_vip[0])
//set_bankmoney(id,d_upgcost_vip[0])
g_iPlayerDispenser[id]++
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - d_upgcost[0])
//set_bankmoney(id,d_upgcost[0])
g_iPlayerDispenser[id]++
}
}
else
{
ChatColor ( id, "^3[^4Информация^3]^1 Здесь не получается установить раздатчик!")
}
return PLUGIN_HANDLED;
}
stock bool:CreateDispanser(Float:origin[3], creator)
{
if (point_contents(origin) != CONTENTS_EMPTY || TraceCheckCollides(origin, 35.0))
{
return false
}
new Float:hitPoint[3], Float:originDown[3]
originDown = origin
originDown[2] = -5000.0 // dunno the lowest possible height...
trace_line(0, origin, originDown, hitPoint)
new Float:baDistanceFromGround = vector_distance(origin, hitPoint)
new Float:difference = 20.0 - baDistanceFromGround
if (difference < -1 * 20.0 || difference > 20.0) return false
new iEntity = create_entity( "func_breakable" );
if( !pev_valid( iEntity ) )
return false
set_pev( iEntity, pev_classname, gDispenserClassname );
new Float:flAngles[ 3 ];
new Float:flAnglesF[ 3 ];
pev( creator, pev_angles, flAngles );
pev( iEntity, pev_angles, flAnglesF );
flAnglesF[1] = flAngles[1]+90.0
set_pev( iEntity, pev_angles, flAnglesF );
engfunc( EngFunc_SetModel, iEntity, gDispenserMdl );
engfunc( EngFunc_SetSize, iEntity, Float:{ -20.0, -10.0, 0.0 }, Float:{ 20.0, 10.0, 50.0 } );
set_pev( iEntity, pev_origin, origin );
set_pev( iEntity, pev_solid, SOLID_BBOX );
set_pev( iEntity, pev_movetype, MOVETYPE_FLY );
set_pev( iEntity, pev_health, float(d_enthp[0]) );
set_pev( iEntity, pev_takedamage, 2.0 );
set_pev( iEntity, pev_iuser1, 0 );
//set_pev( iEntity, pev_fuser1, float(moneytraf[1]) );
Disp_balance[iEntity] = 1000;
set_pev( iEntity, pev_iuser2, creator );
set_pev( iEntity, pev_iuser3, 1 );
set_pev( iEntity, pev_iuser4, get_user_team(creator) );
set_pev( iEntity, pev_nextthink, get_gametime( ) + 0.1 );
engfunc( EngFunc_DropToFloor, iEntity );
dispFreez[iEntity] = 0
updatingdisp[iEntity] = 0
// gDispenserOrigin[ creator ][ 0 ] = origin[ 0 ];
// gDispenserOrigin[ creator ][ 1 ] = origin[ 1 ];
// gDispenserOrigin[ creator ][ 2 ] = origin[ 2 ];
bDispenserBuild[ creator ] = true;
switch( cs_get_user_team( creator ) )
{
case CS_TEAM_T:
{
gBeamcolor[ creator ][ 0 ] = 0, gBeamcolor[ creator ][ 1 ] = 255, gBeamcolor[ creator ][ 2 ] = 0;
set_pev(iEntity, pev_body, 4);
}
case CS_TEAM_CT:
{
gBeamcolor[ creator ][ 0 ] = 0, gBeamcolor[ creator ][ 1 ] = 255, gBeamcolor[ creator ][ 2 ] = 0;
set_pev(iEntity, pev_body, 0);
}
}
emit_sound( iEntity, CHAN_STATIC, gDispenserActive, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
return true;
}
public DispenserThink( iEnt )
{
if( pev_valid( iEnt ) )
{
static iOwner; iOwner = pev( iEnt, pev_iuser2 )
if(get_user_team(iOwner) != pev( iEnt, pev_iuser4)){
BreakAllPlayerDispensers(iOwner)
return PLUGIN_CONTINUE
}
if ( !is_user_connected ( iOwner ) )
return PLUGIN_CONTINUE
if( pev( iEnt, pev_health ) <= 0.0 )
{
new Float:origin[3]
entity_get_vector(iEnt, EV_VEC_origin, origin)
DeleteEntity( iEnt )
create_explosion(origin)
g_iPlayerDispenser[iOwner]--
client_cmd( iOwner, "speak ^"vox/bizwarn computer destroyed^"" );
if(g_iPlayerDispenser[iOwner]==0)
bDispenserBuild[ iOwner ] = false;
return PLUGIN_CONTINUE
}
new id, iLevel = pev ( iEnt, pev_iuser3 )
new Float:fRadius = d_radius[iLevel-1]
new Float:origin[ 3 ];
pev( iEnt, pev_origin, origin );
if(!dispFreez[iEnt]){
for( id = 1; id <= gMaxPlayers; id++ )
{
if( !is_user_bot(id) && is_user_connected ( id ) && is_user_alive( id ) && cs_get_user_team( id ) == cs_get_user_team( iOwner ))
{
new Float:flOrigin[ 3 ];
pev( id, pev_origin, flOrigin );
if( get_distance_f( origin, flOrigin ) <= floatround(fRadius))
{
//if( UTIL_IsVisible( id, iEnt ) && ((cs_get_user_money(id) < 100000 && iOwner == id && Disp_balance[iEnt]>0) || pev(id, pev_health) < d_hp[iLevel - 1] || pev(id, pev_armorvalue) < d_ap[iLevel - 1]))
if( UTIL_IsVisible( id, iEnt ) && (pev(id, pev_health) < d_hp[iLevel - 1] || pev(id, pev_armorvalue) < d_ap[iLevel - 1]))
{
if( pev(id, pev_health) < d_hp[iLevel - 1] )
{
set_pev(id, pev_health, floatmin(pev(id, pev_health) + d_takehp[iLevel-1], float(d_hp[iLevel - 1])) );
//if(pev( iEnt, pev_iuser1)==1) cs_set_user_money(id, cs_get_user_money(id) - 1 );
}
if( pev(id, pev_armorvalue) < d_ap[iLevel - 1] )
{
set_pev(id, pev_armorvalue, floatmin(pev(id, pev_armorvalue) + d_takeap[iLevel-1], float(d_ap[iLevel - 1])) );
//if(pev( iEnt, pev_iuser1)==1) cs_set_user_money(id, cs_get_user_money(id) - 1 );
}
/* if(cs_get_user_money(id)>0 && pev( iEnt, pev_iuser1)==1 && iOwner != id){
Disp_balance[iEnt]+=1
dips_balanced(id, 1)
} else if( cs_get_user_money(id) < 100000 && Disp_balance[iEnt] > 0 && pev( iEnt, pev_iuser1)==1 && iOwner == id)
{
cs_set_user_money(id, cs_get_user_money(id) + 1 );
//set_pev( iEnt, pev_fuser1, pev( iEnt, pev_fuser1) - 1.0 );
Disp_balance[iEnt]-=1
dips_balanced(id, -1)
} else if( pev(id, pev_health) < d_hp[iLevel - 1] || pev(id, pev_armorvalue) < d_ap[iLevel - 1]){ if(pev( iEnt, pev_iuser1)==1 && iOwner != id) cs_set_user_money(id, cs_get_user_money(id) - 1 );}
*/
//player_healingEffect(id)
new bool:BigBeam = pev(id, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(id, pev_health) < float(d_hp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
}
}
}
new ent = -1, sClassName[32]
while ( ( ent = engfunc ( EngFunc_FindEntityInSphere, ent, origin, fRadius ) ) != 0 ) {
pev ( ent, pev_classname, sClassName, charsmax ( sClassName ) )
if(pev_valid(ent)){
new Float:flOrigin[ 3 ];
pev( ent, pev_origin, flOrigin );
if(equal(sClassName,gDispenserClassname)){
if(get_user_team(iOwner) == pev( ent, pev_iuser4)){
if(ent != iEnt){
flOrigin[2]+=20.0
if( UTIL_IsVisible( ent, iEnt ) && pev(ent, pev_health) < d_enthp[pev(ent, pev_iuser3)-1])
{
set_pev(ent, pev_health, pev(ent, pev_health) + d_takehpabjects[iLevel-1]);
new bool:BigBeam = pev(ent, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(ent, pev_health) < float(d_enthp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
}
}
} /*else if(equal(sClassName,"lasermine")){
if( UTIL_IsVisible( ent, iEnt ) && pev(ent, pev_health) < 400)
{
set_pev(ent, pev_health, pev(ent, pev_health) + d_takehpabjects[iLevel-1]);
new bool:BigBeam = pev(ent, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(ent, pev_health) < float(d_enthp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
} else if(equal(sClassName,"sentry")){
if(cs_get_user_team(iOwner)==get_sentry_team(ent)){
if(pev(ent, pev_health)<g_HEALTHSS[get_SentryLevel(ent)]){
if(UTIL_IsVisible(ent,iEnt))
{
set_pev(ent, pev_health, pev(ent, pev_health) + d_takehpabjects[iLevel-1]);
new bool:BigBeam = pev(ent, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(ent, pev_health) < float(d_enthp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
}
}
} */
}
}
}
new Float:entorigin[3]
pev( iEnt, pev_origin, entorigin )
new HP = pev ( iEnt, pev_health )
if(HP<=600.0){
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_SMOKE)
engfunc(EngFunc_WriteCoord, entorigin[0]+random_float(-8.0, 8.0))
engfunc(EngFunc_WriteCoord, entorigin[1]+random_float(-8.0, 8.0))
engfunc(EngFunc_WriteCoord, entorigin[2]+random_float(25.0, 35.0))
write_short(g_iSPR_Smoke3)
write_byte(random_num(3,7))
write_byte(30)
message_end()
}
if(get_user_team(iOwner) != pev( iEnt, pev_iuser4))
{
BreakAllPlayerDispensers(iOwner);
g_iPlayerDispenser[id] = 0
return PLUGIN_CONTINUE;
}
set_pev( iEnt, pev_nextthink, get_gametime( ) + 0.1 );
}
return PLUGIN_CONTINUE;
}
// updatingdisp[ent]
public fw_DispenserTouch ( ent, id )
{
if(updatingdisp[ent])
return
new iLevel = pev ( ent, pev_iuser3 );
static Float:time;time=get_gametime()
if(flood_disptouch[id] > time)
return
flood_disptouch[id] = time+2.0
if ( !pev_valid ( ent ) )
return
if ( !is_user_connected ( id ) || !is_user_alive ( id ) )
return
if ( pev ( ent, pev_iuser4 ) != _:cs_get_user_team ( id ) )
return
// if ( iLevel == 4 && pev( ent, pev_iuser1) == 0){
// touchdisp[id] = ent
// show_updatemenu(id)
// return
// }
if(iLevel == 4)
return
new iOwner = pev ( ent, pev_iuser2 )
new money = cs_get_user_money ( id )
if (get_user_flags(id) & ADMIN_LEVEL_B && money < d_upgcost_vip[iLevel])
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost_vip[iLevel] )
return;
}
else if( money < d_upgcost[iLevel] )
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost[iLevel] )
return;
}
if ( !is_user_connected ( iOwner ) )
return
if (get_user_flags(id) & ADMIN_LEVEL_B)
{
cs_set_user_money(id, money - d_upgcost_vip[iLevel-1])
//set_bankmoney(id,d_upgcost_vip[iLevel-1])
}
else
{
cs_set_user_money(id, money - d_upgcost[iLevel-1])
//set_bankmoney(id,d_upgcost[iLevel-1])
}
new sUpgraderName[32]
get_user_name ( id, sUpgraderName, charsmax ( sUpgraderName ) )
client_print ( iOwner, print_center, "%s прокачал твой раздатчик", sUpgraderName )
set_player_bonus(id, 15)
gBeamcolor[ id ][ 0 ] = 0, gBeamcolor[ id ][ 1 ] = 255, gBeamcolor[ id ][ 2 ] = 0;
/*код достижения*/
/* if(iOwner != id){
if(get_player_type(id) == 2){
if(get_upd_disp(id) == 0){
if(get_player_expmm(id) < 650){
set_player_expmm(id, 1);
if(get_player_expmm(id) >= 650){
set_upd_disp(id, 1);
set_player_type(id, 0)
}
} else if(get_player_expmm(id) >= 650){
set_upd_disp(id, 1);
set_player_type(id, 0)
}
}
}
} */
/*код достижения*/
updatingdisp[ent] = 1
/* new iEntity = create_entity("info_target")
new Float: Origin[3]
entity_get_vector(ent, EV_VEC_origin, Origin)
Origin[0]-=30.0
Origin[1]+=5.0
Origin[2]+=70.0
entity_set_string(iEntity, EV_SZ_classname, "Shield_Ent")
entity_set_vector(iEntity,EV_VEC_origin, Origin)
entity_set_model(iEntity, "models/great_sentries/PFG_SENTRIES_OLD2.mdl")
set_pev(iEntity, pev_solid, SOLID_TRIGGER );
set_pev(iEntity, pev_body, 8);
set_pev(iEntity, pev_sequence, 9)
set_pev(iEntity, pev_framerate, 1.0)
switch( pev ( ent, pev_iuser4 ) )
{
case CS_TEAM_T:
{
set_pev(iEntity, pev_skin, 3);
}
case CS_TEAM_CT:
{
set_pev(iEntity, pev_skin, 2);
}
}
set_pev(ent,pev_euser3,iEntity) */
fw_DispenserTouchTwo(ent+3000)
//set_task ( 3.0, "fw_DispenserTouchTwo",ent+3000)
}
public fw_DispenserTouchTwo (entoff){
new ent = entoff-3000
/* new iceCub = pev(ent,pev_euser3)
if(pev_valid(iceCub)){
remove_entity(iceCub)
set_pev(ent,pev_euser3, 0)
} */
new iLevel = pev ( ent, pev_iuser3 );
iLevel++
set_pev ( ent, pev_iuser3, iLevel )
set_pev ( ent, pev_health, float ( d_enthp[iLevel-1] ) )
engfunc( EngFunc_SetModel, ent, gDispenserMdl )
engfunc( EngFunc_SetSize, ent, Float:{ -20.0, -10.0, 0.0 }, Float:{ 20.0, 10.0, 50.0 } )
emit_sound( ent, CHAN_STATIC, gDispenserActive, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
switch( pev ( ent, pev_iuser4 ) )
{
case CS_TEAM_T:
{
switch(iLevel)
{
case 2: set_pev(ent, pev_body, 5);
case 3: set_pev(ent, pev_body, 6);
case 4: set_pev(ent, pev_body, 7);
}
}
case CS_TEAM_CT:
{
switch(iLevel)
{
case 2: set_pev(ent, pev_body, 1);
case 3: set_pev(ent, pev_body, 2);
case 4: set_pev(ent, pev_body, 3);
}
}
}
updatingdisp[ent] = 0
}
public EVENT_TextMsg( )
{
UTIL_DestroyDispensers( );
}
public LOG_RoundEnd( )
{
UTIL_DestroyDispensers( );
}
stock UTIL_DestroyDispensers( )
{
new iEnt = FM_NULLENT;
while( ( iEnt = find_ent_by_class( iEnt, gDispenserClassname ) ) )
{
if(is_valid_ent ( iEnt )){
new iOwner = pev( iEnt, pev_iuser2 );
bDispenserBuild[ iOwner ] = false;
g_iPlayerDispenser[ iOwner ]--;
DeleteEntity( iEnt )
}
}
}
stock UTIL_BeamEnts( Float:flStart[ 3 ], Float:flEnd[ 3 ], r, g, b, sprite, width, ampl )
{
engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flStart );
write_byte( TE_BEAMPOINTS );
engfunc( EngFunc_WriteCoord, flStart[ 0 ] );
engfunc( EngFunc_WriteCoord, flStart[ 1 ] );
engfunc( EngFunc_WriteCoord, flStart[ 2 ] );
engfunc( EngFunc_WriteCoord, flEnd[ 0 ] );
engfunc( EngFunc_WriteCoord, flEnd[ 1 ] );
engfunc( EngFunc_WriteCoord, flEnd[ 2 ] );
write_short( sprite );
write_byte( 5 );
write_byte( 2 );
write_byte( 1 );
write_byte( width );
write_byte( ampl );
write_byte( r );
write_byte( g );
write_byte( b );
write_byte( 130 );
write_byte( 30 );
message_end( );
}
stock bool:UTIL_IsVisible( index, entity, ignoremonsters = 0 )
{
new Float:flStart[ 3 ], Float:flDest[ 3 ];
pev( index, pev_origin, flStart );
pev( index, pev_view_ofs, flDest );
xs_vec_add( flStart, flDest, flStart );
pev( entity, pev_origin, flDest );
engfunc( EngFunc_TraceLine, flStart, flDest, ignoremonsters, index, 0 );
new Float:flFraction;
get_tr2( 0, TR_flFraction, flFraction );
if( flFraction == 1.0 || get_tr2( 0, TR_pHit) == entity )
{
return true;
}
return false;
}
public BreakAllPlayerDispensers(id)
{
static ent = -1
while ((ent = find_ent_by_class(ent, gDispenserClassname)))
{
if(pev( ent, pev_iuser2 ) != id)
continue
if(pev_valid(ent))
{
DeleteEntity( ent )
//set_pev( ent, pev_flags, pev( ent, pev_flags ) | FL_KILLME );
}
}
bDispenserBuild[ id ] = false;
g_iPlayerDispenser[ id ] = 0;
}
bool:TraceCheckCollides(Float:origin[3], const Float:BOUNDS)
{
new Float:traceEnds[8][3], Float:traceHit[3], hitEnt
traceEnds[0][0] = origin[0] - BOUNDS
traceEnds[0][1] = origin[1] - BOUNDS
traceEnds[0][2] = origin[2] - BOUNDS
traceEnds[1][0] = origin[0] - BOUNDS
traceEnds[1][1] = origin[1] - BOUNDS
traceEnds[1][2] = origin[2] + BOUNDS
traceEnds[2][0] = origin[0] + BOUNDS
traceEnds[2][1] = origin[1] - BOUNDS
traceEnds[2][2] = origin[2] + BOUNDS
traceEnds[3][0] = origin[0] + BOUNDS
traceEnds[3][1] = origin[1] - BOUNDS
traceEnds[3][2] = origin[2] - BOUNDS
traceEnds[4][0] = origin[0] - BOUNDS
traceEnds[4][1] = origin[1] + BOUNDS
traceEnds[4][2] = origin[2] - BOUNDS
traceEnds[5][0] = origin[0] - BOUNDS
traceEnds[5][1] = origin[1] + BOUNDS
traceEnds[5][2] = origin[2] + BOUNDS
traceEnds[6][0] = origin[0] + BOUNDS
traceEnds[6][1] = origin[1] + BOUNDS
traceEnds[6][2] = origin[2] + BOUNDS
traceEnds[7][0] = origin[0] + BOUNDS
traceEnds[7][1] = origin[1] + BOUNDS
traceEnds[7][2] = origin[2] - BOUNDS
for (new i = 0; i < 8; i++)
{
if (point_contents(traceEnds[i]) != CONTENTS_EMPTY)
return true
hitEnt = trace_line(0, origin, traceEnds[i], traceHit)
if (hitEnt != 0)
return true
for (new j = 0; j < 3; j++)
{
if (traceEnds[i][j] != traceHit[j])
return true
}
}
return false
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 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();
}
}
}
}
player_healingEffect(id)
{
new iOrigin[3]
get_user_origin(id, iOrigin)
message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
write_byte(TE_PROJECTILE)
write_coord(iOrigin[x] + random_num(-10, 10))
write_coord(iOrigin[y] + random_num(-10, 10))
write_coord(iOrigin[z] + random_num(0, 30))
write_coord(0)
write_coord(0)
write_coord(15)
write_short(gSpr_regeneration)
write_byte(1)
write_byte(id)
message_end()
}
ошибка на скрине, можете исправить ошибки? заранее благодарю.
Код:
/*
- Отключено:
1. Лечение дружеских строений
2. Возможность постройки более 1 раздатчика
3. Заморозка раздатчика на определенное время
4. Улучшение раздатчика до раздатчика денег
5. Эффект постройки раздатчика
6. Вознограждение за разрушение раздатчика
7. Работа с достижениями
- Можно изменить эффект раздатчика при пополнении здоровья
- Количество уровней можно регулировать в данный момент 4 уровня
- Изменен эффект взрыва раздатчика
- Добавлено меню раздатчика
- Разделен на VIP игроков и обычных:
1. Для VIP постройка дешевле
2. Для VIP улучшение дешевле
3. VIP могут прокачивать свой раздатчик сколько угодно
- Цвет луча лечения зеленого цвета
- При полном здоровье игрока луч пропадает
- Дружественные раздатчики могут лечить друг друга
- Раздатчик повернут в ту сторону, куда смотрит игрока
- Соотношение размеров учтено, можно забираться на раздатчик
- Уничтожение раздатчика подправлено
*/
#include < amxmodx >
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < cstrike >
#include < engine >
#include < hamsandwich >
#include < xs >
#include < dhudmessage >
//#include <mission_inc>
#define BREAK_COMPUTER 6
#define MAX_PLAYERS 32 + 1
#define is_valid_player(%1) ( 1 <= %1 <= gMaxPlayers )
new const gDamageSounds[ ][ ] =
{
"debris/metal1.wav",
"debris/metal2.wav",
"debris/metal3.wav"
};
set_player_bonus(id, bonus) return 0 // native set_player_bonus(id, bonus)
// native get_sentry_team(ent)
get_bariga(id) return 0 //native get_bariga(id) - функция делалась для моего сервера
//native get_SentryLevel(ent)
new const gDispenserClassname[ ] = "NiceDispenser";
new const gDispenserActive[ ] = "disp_csdm/dispenser.wav";
new const gDispenserMdl[ ] = "models/new_dispkk.mdl";
new const gHealingSprite[ ] = "sprites/dispenser.spr";
new gSpr_regeneration
enum
{
x,
y,
z
}
new g_iSPR_Smoke3;
new gHealingBeam;
new gMaxPlayers;
new g_iPlayerDispenser[33]
new ExplSpr
new Float:flood_disptouch[33]
#define DISPENSER_COST 3000
#define DISPENSER_COST_VIP 2000
new const moneytraf[2] = {3000, 8000}
new const d_upgcost[4] = {3000,2000,2500,6000}
new const d_upgcost_vip[4] = {2000,1000,1500,4500}
new const d_enthp[4] = {3000,4500,6000,8000}
new const Float:d_radius[4] = {600.0,750.0,900.0,1100.0}
new const d_hp[4] = {100,200,300,400}
new const Float:g_HEALTHSS[5] = {3000.0, 4000.0, 5000.0, 6000.0, 7000.0}
new const d_ap[4] = {100,200,300,400}
new const Float:d_takehp[4] = {1.0,1.5,2.0,2.5}
new const Float:d_takehpabjects[4] = {1.0,2.0,3.0,4.0}
new const Float:d_takeap[4] = {1.0,1.5,2.0,2.5}
// new Float:gDispenserOrigin[ MAX_PLAYERS ][ 3 ];
new gBeamcolor[ MAX_PLAYERS ][ 3 ];
new bool:bDispenserBuild[ MAX_PLAYERS ];
new touchdisp[33]
//native dips_balanced(id, amount)
new Disp_balance[1000]
new dispFreez[1000]
new updatingdisp[1000]
public plugin_init( )
{
register_plugin( "Build Dispenser", "0.1", "pro100iweb" );
register_event( "TextMsg", "EVENT_TextMsg", "a", "2&#Game_C", "2&#Game_w", "2&#Game_will_restart_in" );
register_logevent( "LOG_RoundEnd", 2, "1=Round_End" );
register_event ( "Spectator", "ev_Spectation", "a" )
register_forward ( FM_TraceLine, "fw_TraceLine_Post", 1 )
RegisterHam( Ham_TakeDamage, "func_breakable", "bacon_TakeDamage", 1 );
RegisterHam( Ham_TakeDamage, "func_breakable", "bacon_TakeDamagePre", 0 );
register_think( gDispenserClassname, "DispenserThink" );
register_touch ( gDispenserClassname, "player", "fw_DispenserTouch" )
register_clcmd( "build_dispenser", "CommandDispenserBuild" );
//register_clcmd( "setf", "setf" );
//register_clcmd( "setddd", "show_updatemenu" );
register_clcmd( "say dispstats", "dispstats" );
register_clcmd( "detonate_dispenser", "disppp_menu" );
gMaxPlayers = get_maxplayers( );
}
/* public plugin_natives ()
{
register_native ( "set_freezDispenser", "nativeget_setfreezDispenser", 1)
}
public nativeget_setfreezDispenser(sentry)
{
if(dispFreez[sentry]) return 1
new iEntity = create_entity("info_target")
new Float: Origin[3]
entity_get_vector(sentry, EV_VEC_origin, Origin)
entity_set_string(iEntity, EV_SZ_classname, "Shield_Ent")
entity_set_vector(iEntity,EV_VEC_origin, Origin)
entity_set_model(iEntity, "models/great_sentries/PFG_BLOCKS.mdl")
set_pev(iEntity, pev_solid, SOLID_TRIGGER );
set_pev(iEntity, pev_body, 1);
set_pev(sentry,pev_euser4,iEntity)
set_task ( 15.0, "DelayRemoveFreezD", sentry+2000)
return dispFreez[sentry] = 1
}
public DelayRemoveFreezD(entoff){
new sentry = entoff-2000
new iceCub = pev(sentry,pev_euser4)
if(pev_valid(sentry)){
dispFreez[sentry] = 0
}
if(pev_valid(iceCub)){
remove_entity(iceCub)
}
} */
/* public setf(id){
cs_set_user_money(id, cs_get_user_money(id) + 1000)
} */
public DeleteEntity( entity ){
new iceCub = pev(entity,pev_euser4)
if(pev_valid(iceCub) && dispFreez[entity]){
remove_entity(iceCub)
set_pev(iceCub,pev_euser4, 0)
dispFreez[entity] = 0
}
iceCub = pev(entity,pev_euser3)
if(pev_valid(iceCub)){
remove_entity(iceCub)
set_pev(iceCub,pev_euser3, 0)
}
if(task_exists(entity+3000)){
remove_task(entity+3000)
}
if(task_exists(entity+2000)){
remove_task(entity+2000)
}
if(pev_valid(entity)){
remove_entity(entity)
}
}
public ev_Spectation ()
{
new id = read_data ( 1 )
BreakAllPlayerDispensers(id)
}
public show_updatemenu(id){
new szItem[128]
format(szItem, 127, "\wУстановить способность^nРаздатчик \rДенег \wHP \r%d", moneytraf[0])
new menu = menu_create(szItem,"touchdispc");
format(szItem, 127, "\r[\wДа \r%d\y$!\r]", moneytraf[1])
menu_additem( menu, szItem)
menu_additem( menu, "\r[\wНет\r]")
menu_display(id,menu)
return PLUGIN_HANDLED
}
public touchdispc(id, menu, key){
key++
menu_destroy(menu)
if(key==1){
if(!pev_valid(touchdisp[id]))
return;
if ( pev ( touchdisp[id], pev_iuser4 ) != _:cs_get_user_team ( id ) )
return;
if(cs_get_user_money(id)<moneytraf[1])
return;
cs_set_user_money(id,cs_get_user_money(id)-moneytraf[1]);
//set_bankmoney(id,moneytraf[1])
set_pev( touchdisp[id], pev_health, float(moneytraf[0]) );
set_pev( touchdisp[id], pev_iuser1, 1 );
} else {
return
}
}
public disppp_menu(id)
{
if(g_iPlayerDispenser[id] == 0){
ChatColor ( id, "^4У тебя нет раздатчика")
return HAM_IGNORED
}
new szItem[128];
new szItem1[128];
new msentry_item = menu_create("\yВыберите раздатчик!", "cl_mendisp")
static ent = -1
while ((ent = find_ent_by_class(ent, gDispenserClassname)))
{
if( pev( ent, pev_iuser2) != id) continue;
if(pev_valid(ent))
{
new iLevel = pev ( ent, pev_iuser3 )
new iHealth = pev ( ent, pev_health )
format(szItem, 127, "%d", ent)
format(szItem1, 127, "\wID \r%d \w| уровень \r%d \w[HP \y%d\w]", ent, iLevel, iHealth)
menu_additem( msentry_item, szItem1, szItem, 0)
}
}
menu_setprop(msentry_item, MPROP_EXIT, MEXIT_ALL)
menu_setprop(msentry_item, MPROP_EXITNAME, "\yВыход")
menu_display(id, msentry_item, 0)
return PLUGIN_HANDLED
}
public cl_mendisp(id, menu, item) {
new s_Data[6], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
new i_Key = str_to_num(s_Data)
menu_destroy(menu)
if(i_Key == 0) return 0
if ( !is_valid_ent ( i_Key ) ) return 0
touchdisp[id] = i_Key
disp_menu_func(id)
return 1
}
public disp_menu_func(id)
{
if(g_iPlayerDispenser[id] == 0){
ChatColor ( id, "^4У тебя нет раздатчика")
return HAM_IGNORED
}
new szItem[128];
new szItem1[128];
new ent = touchdisp[id];
if(ent==0) return PLUGIN_HANDLED
new msentry_item = menu_create("\yЧто делать с раздатчиком?!", "cl_mend");
if(pev_valid(ent))
{
new iLevel = pev ( ent, pev_iuser3 )
new iHealth = pev ( ent, pev_health )
format(szItem, 127, "%d", ent)
menu_additem( msentry_item, "\wУничтожить")
//menu_additem( msentry_item, "\wУлучшить до раздатчика денег")
//menu_additem( msentry_item, "\wПоложить в раздатчик 10000$ НДС \r1000\y$")
menu_addblank( msentry_item, 0)
menu_addblank( msentry_item, 0)
menu_addblank( msentry_item, 0)
format(szItem1, 127, "\wID \r%d", ent)
menu_addtext( msentry_item, szItem1)
format(szItem1, 127, "Уровень \r%d", iLevel)
menu_addtext( msentry_item, szItem1)
format(szItem1, 127, "\w[HP \y%d\w]", iHealth)
menu_addtext( msentry_item, szItem1)
}
menu_setprop(msentry_item, MPROP_EXIT, MEXIT_ALL)
menu_setprop(msentry_item, MPROP_EXITNAME, "\yВыход")
menu_display(id, msentry_item, 0)
return PLUGIN_HANDLED
}
public cl_mend(id, menu, item) {
item++
new ent = touchdisp[id]
new iLevel = pev ( ent, pev_iuser3 )
menu_destroy(menu)
if(item == 0) return 0
if(pev_valid(ent)){
switch(item){
case 1:{
if ( !is_valid_ent ( ent ) ) return 0
DeleteEntity( ent )
g_iPlayerDispenser[ id ]--;
if(g_iPlayerDispenser[ id ] == 0)
bDispenserBuild[ id ] = false;
}
case 2:{
if ( !is_valid_ent ( ent ) )
return 0;
if ( iLevel != 4 ){
ChatColor ( id, "^1Только на 4 уровне!");
return 0;
}
if ( pev ( ent, pev_iuser4 ) != _:cs_get_user_team ( id ) )
return 0;
if(cs_get_user_money(id)<moneytraf[1]){
ChatColor ( id, "^1Не достаточно средств! Стоимость %d", moneytraf[1]);
return 0;
}
cs_set_user_money(id,cs_get_user_money(id)-moneytraf[1]);
//set_bankmoney(id,moneytraf[1])
set_pev( ent, pev_health, float(moneytraf[0]) );
set_pev( ent, pev_iuser1, 1 );
}
case 3:{
if(cs_get_user_money(id)<11000)
return 0;
cs_set_user_money(id,cs_get_user_money(id)-11000);
//set_bankmoney(id,11000)
//set_pev( ent, pev_fuser1, 10000.0 );
Disp_balance[ent] = 10000;
}
}
}
return 1
}
public dispstats(id)
{
ChatColor ( id, "^1У вас [ ^4%d ^1] раздатчик(ов)!", g_iPlayerDispenser[id])
}
public client_connect( id )
{
bDispenserBuild[ id ] = false;
g_iPlayerDispenser[id] = 0
}
public client_disconnect( id )
{
BreakAllPlayerDispensers(id)
g_iPlayerDispenser[id] = 0
}
public plugin_precache( )
{
gHealingBeam = precache_model( gHealingSprite );
g_iSPR_Smoke3 = precache_model("sprites/black_smoke4.spr")
precache_model( gDispenserMdl );
precache_sound( gDispenserActive );
gSpr_regeneration = precache_model("sprites/th_jctf_heal.spr")
new i;
for( i = 0; i < sizeof gDamageSounds; i++ )
{
precache_sound( gDamageSounds[ i ] );
}
ExplSpr = precache_model("sprites/gp_1.spr");
// precache_model("models/great_sentries/PFG_BLOCKS.mdl")
// precache_model("models/great_sentries/PFG_SENTRIES_OLD2.mdl")
}
public fw_TraceLine_Post ( Float:v1[3], Float:v2[3], noMonsters, id )
{
if ( !is_valid_player ( id ) || is_user_bot ( id ) || !is_user_alive ( id ) )
return FMRES_IGNORED
new iHitEnt = get_tr ( TR_pHit )
if ( iHitEnt <= gMaxPlayers || !pev_valid ( iHitEnt ) )
return FMRES_IGNORED
new sClassname[32]
pev ( iHitEnt, pev_classname, sClassname, charsmax ( sClassname ) )
if ( !equal ( sClassname, gDispenserClassname ) )
return FMRES_IGNORED
new iTeam = pev ( iHitEnt, pev_iuser4 )
if ( _:cs_get_user_team ( id ) != iTeam )
return FMRES_IGNORED
new iHealth = pev ( iHitEnt, pev_health )
if ( iHealth <= 0 )
return FMRES_IGNORED
new iOwner = pev ( iHitEnt, pev_iuser2 )
if ( !is_user_connected ( iOwner ) )
return FMRES_IGNORED
new sName[33]
get_user_name ( iOwner, sName, charsmax ( sName ) )
new iLevel = pev ( iHitEnt, pev_iuser3 )
set_dhudmessage ( 255, 255, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "Установил: %s^nID %d HP: %d/%d^nLevel: %d Coins:", sName, iHitEnt, iHealth, d_enthp[iLevel-1], iLevel )
set_dhudmessage ( 255, 0, 0, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "^n^n OFF")
/* switch(pev( iHitEnt, pev_iuser1)){
case 0:{
set_dhudmessage ( 255, 255, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "Установил: %s^nID %d HP: %d/%d^nLevel: %d Coins:", sName, iHitEnt, iHealth, d_enthp[iLevel-1], iLevel )
set_dhudmessage ( 255, 0, 0, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "^n^n OFF")
}
case 1:{
set_dhudmessage ( 255, 255, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "Установил: %s^nID %d HP: %d/%d^nLevel: %d Coins:^nОбъем: %d", sName, iHitEnt, iHealth, moneytraf[0], iLevel, Disp_balance[iHitEnt] )
set_dhudmessage ( 0, 0, 255, -1.0, 0.80, 0, 0.0, 0.6, 0.0, 0.0 )
show_dhudmessage ( id, "^n^n ON")
}
} */
return FMRES_IGNORED
}
public bacon_TakeDamagePre( ent, idinflictor, idattacker, Float:damage, damagebits )
{
new szClassname[ 32 ];
pev( ent, pev_classname, szClassname, charsmax( szClassname ) );
if( equal( szClassname, gDispenserClassname ) )
{
if(updatingdisp[ent])
return HAM_SUPERCEDE
new iOwner = pev( ent, pev_iuser2 );
if(!is_user_connected(iOwner) || 1 > iOwner > 32 || !is_user_connected(idattacker) || 1 > idattacker > 32)
return HAM_SUPERCEDE
if(cs_get_user_team(iOwner)==cs_get_user_team(idattacker) && idattacker != iOwner)
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public bacon_TakeDamage( ent, idinflictor, idattacker, Float:damage, damagebits )
{
if ( !pev_valid ( ent ) )
return HAM_IGNORED
new szClassname[ 32 ];
pev( ent, pev_classname, szClassname, charsmax( szClassname ) );
if( equal( szClassname, gDispenserClassname ) )
{
if(updatingdisp[ent])
return HAM_SUPERCEDE
new iOwner = pev( ent, pev_iuser2 );
if(!is_user_connected(iOwner) || 1 > iOwner > 32 || !is_user_connected(idattacker) || 1 > idattacker > 32)
return HAM_SUPERCEDE
if(cs_get_user_team(iOwner)==cs_get_user_team(idattacker) && idattacker != iOwner)
return HAM_SUPERCEDE
if( pev( ent, pev_health ) <= 0.0 )
{
new szName[ 32 ];
get_user_name( idattacker, szName, charsmax( szName ) );
if( idattacker == iOwner )
{
ChatColor ( iOwner, "^3[^4Действие^3]^1 Вы уничтожили собственный раздатчик!")
} else {
ChatColor ( iOwner, "^3[^4Действие^3]^1 %s уничтожил ваш раздатчик!", szName)
ChatColor ( idattacker, "^3[^4Раздатчик^3]^1 Вам начислено 15 бонусов!", szName)
/*код достижения*/
/* if(get_player_type(idattacker) == 1){
if(get_kill_disp(idattacker) == 0){
if(get_player_expmm(idattacker) < 300){
set_player_expmm(idattacker, 1);
if(get_player_expmm(idattacker) >= 300){
set_kill_disp(idattacker, 1);
set_player_type(idattacker, 0)
}
} else if(get_player_expmm(idattacker) >= 300){
set_kill_disp(idattacker, 1);
set_player_type(idattacker, 0)
}
}
} */
/*код достижения*/
}
}
emit_sound( ent, CHAN_STATIC, gDamageSounds[ random_num( 0, charsmax( gDamageSounds ) ) ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}
return HAM_IGNORED
}
stock create_explosion(Float:origin_[3]) {
new origin[3]
FVecIVec(origin_, origin)
message_begin(MSG_ALL,SVC_TEMPENTITY,{0,0,0})
write_byte(TE_SPRITETRAIL) //Спрайт захвата
write_coord((origin[0]))
write_coord((origin[1]))
write_coord((origin[2])+20)
write_coord((origin[0]))
write_coord((origin[1]))
write_coord((origin[2])+80)
write_short(ExplSpr)
write_byte(20)
write_byte(20)
write_byte(4)
write_byte(20)
write_byte(10)
message_end()
}
public CommandDispenserBuild( id )
{
if( !is_user_alive( id ) )
{
return PLUGIN_CONTINUE;
}
if( !( pev( id, pev_flags ) & FL_ONGROUND ) )
{
ChatColor ( id, "^3[^4Информация^3]^1 Вы можете построить раздатчик только на земле!")
return PLUGIN_HANDLED;
}
if ( g_iPlayerDispenser[id] == 2 && get_bariga(id))
{
ChatColor ( id, "^3[^4Информация^3]^1 Вы уже построили 2 раздатчика!")
return PLUGIN_HANDLED;
} else if(!get_bariga(id)){
if( bDispenserBuild[ id ] == true )
{
ChatColor ( id, "^3[^4Информация^3]^1 Вы уже построили раздатчик!")
return PLUGIN_HANDLED;
}
}
new iMoney = cs_get_user_money( id );
if (get_user_flags(id) & ADMIN_LEVEL_B)
{
if( iMoney < d_upgcost_vip[0] )
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost_vip[0] )
return PLUGIN_HANDLED;
}
}
else
{
if( iMoney < d_upgcost[0] )
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost[0] )
return PLUGIN_HANDLED;
}
}
new Float:playerOrigin[3]
entity_get_vector(id, EV_VEC_origin, playerOrigin)
new Float:vNewOrigin[3]
new Float:vTraceDirection[3]
new Float:vTraceEnd[3]
new Float:vTraceResult[3]
velocity_by_aim(id, 64, vTraceDirection) // get a velocity in the directino player is aiming, with a multiplier of 64...
vTraceEnd[0] = vTraceDirection[0] + playerOrigin[0] // find the new max end position
vTraceEnd[1] = vTraceDirection[1] + playerOrigin[1]
vTraceEnd[2] = vTraceDirection[2] + playerOrigin[2]
trace_line(id, playerOrigin, vTraceEnd, vTraceResult) // trace, something can be in the way, use hitpoint from vTraceResult as new origin, if nothing's in the way it should be same as vTraceEnd
vNewOrigin[0] = vTraceResult[0]// just copy the new result position to new origin
vNewOrigin[1] = vTraceResult[1]// just copy the new result position to new origin
vNewOrigin[2] = playerOrigin[2] // always build in the same height as player.
if (CreateDispanser(vNewOrigin, id))
{
if (get_user_flags(id) & ADMIN_LEVEL_B)
{
cs_set_user_money(id, cs_get_user_money(id) - d_upgcost_vip[0])
//set_bankmoney(id,d_upgcost_vip[0])
g_iPlayerDispenser[id]++
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - d_upgcost[0])
//set_bankmoney(id,d_upgcost[0])
g_iPlayerDispenser[id]++
}
}
else
{
ChatColor ( id, "^3[^4Информация^3]^1 Здесь не получается установить раздатчик!")
}
return PLUGIN_HANDLED;
}
stock bool:CreateDispanser(Float:origin[3], creator)
{
if (point_contents(origin) != CONTENTS_EMPTY || TraceCheckCollides(origin, 35.0))
{
return false
}
new Float:hitPoint[3], Float:originDown[3]
originDown = origin
originDown[2] = -5000.0 // dunno the lowest possible height...
trace_line(0, origin, originDown, hitPoint)
new Float:baDistanceFromGround = vector_distance(origin, hitPoint)
new Float:difference = 20.0 - baDistanceFromGround
if (difference < -1 * 20.0 || difference > 20.0) return false
new iEntity = create_entity( "func_breakable" );
if( !pev_valid( iEntity ) )
return false
set_pev( iEntity, pev_classname, gDispenserClassname );
new Float:flAngles[ 3 ];
new Float:flAnglesF[ 3 ];
pev( creator, pev_angles, flAngles );
pev( iEntity, pev_angles, flAnglesF );
flAnglesF[1] = flAngles[1]+90.0
set_pev( iEntity, pev_angles, flAnglesF );
engfunc( EngFunc_SetModel, iEntity, gDispenserMdl );
engfunc( EngFunc_SetSize, iEntity, Float:{ -20.0, -10.0, 0.0 }, Float:{ 20.0, 10.0, 50.0 } );
set_pev( iEntity, pev_origin, origin );
set_pev( iEntity, pev_solid, SOLID_BBOX );
set_pev( iEntity, pev_movetype, MOVETYPE_FLY );
set_pev( iEntity, pev_health, float(d_enthp[0]) );
set_pev( iEntity, pev_takedamage, 2.0 );
set_pev( iEntity, pev_iuser1, 0 );
//set_pev( iEntity, pev_fuser1, float(moneytraf[1]) );
Disp_balance[iEntity] = 1000;
set_pev( iEntity, pev_iuser2, creator );
set_pev( iEntity, pev_iuser3, 1 );
set_pev( iEntity, pev_iuser4, get_user_team(creator) );
set_pev( iEntity, pev_nextthink, get_gametime( ) + 0.1 );
engfunc( EngFunc_DropToFloor, iEntity );
dispFreez[iEntity] = 0
updatingdisp[iEntity] = 0
// gDispenserOrigin[ creator ][ 0 ] = origin[ 0 ];
// gDispenserOrigin[ creator ][ 1 ] = origin[ 1 ];
// gDispenserOrigin[ creator ][ 2 ] = origin[ 2 ];
bDispenserBuild[ creator ] = true;
switch( cs_get_user_team( creator ) )
{
case CS_TEAM_T:
{
gBeamcolor[ creator ][ 0 ] = 0, gBeamcolor[ creator ][ 1 ] = 255, gBeamcolor[ creator ][ 2 ] = 0;
set_pev(iEntity, pev_body, 4);
}
case CS_TEAM_CT:
{
gBeamcolor[ creator ][ 0 ] = 0, gBeamcolor[ creator ][ 1 ] = 255, gBeamcolor[ creator ][ 2 ] = 0;
set_pev(iEntity, pev_body, 0);
}
}
emit_sound( iEntity, CHAN_STATIC, gDispenserActive, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
return true;
}
public DispenserThink( iEnt )
{
if( pev_valid( iEnt ) )
{
static iOwner; iOwner = pev( iEnt, pev_iuser2 )
if(get_user_team(iOwner) != pev( iEnt, pev_iuser4)){
BreakAllPlayerDispensers(iOwner)
return PLUGIN_CONTINUE
}
if ( !is_user_connected ( iOwner ) )
return PLUGIN_CONTINUE
if( pev( iEnt, pev_health ) <= 0.0 )
{
new Float:origin[3]
entity_get_vector(iEnt, EV_VEC_origin, origin)
DeleteEntity( iEnt )
create_explosion(origin)
g_iPlayerDispenser[iOwner]--
client_cmd( iOwner, "speak ^"vox/bizwarn computer destroyed^"" );
if(g_iPlayerDispenser[iOwner]==0)
bDispenserBuild[ iOwner ] = false;
return PLUGIN_CONTINUE
}
new id, iLevel = pev ( iEnt, pev_iuser3 )
new Float:fRadius = d_radius[iLevel-1]
new Float:origin[ 3 ];
pev( iEnt, pev_origin, origin );
if(!dispFreez[iEnt]){
for( id = 1; id <= gMaxPlayers; id++ )
{
if( !is_user_bot(id) && is_user_connected ( id ) && is_user_alive( id ) && cs_get_user_team( id ) == cs_get_user_team( iOwner ))
{
new Float:flOrigin[ 3 ];
pev( id, pev_origin, flOrigin );
if( get_distance_f( origin, flOrigin ) <= floatround(fRadius))
{
//if( UTIL_IsVisible( id, iEnt ) && ((cs_get_user_money(id) < 100000 && iOwner == id && Disp_balance[iEnt]>0) || pev(id, pev_health) < d_hp[iLevel - 1] || pev(id, pev_armorvalue) < d_ap[iLevel - 1]))
if( UTIL_IsVisible( id, iEnt ) && (pev(id, pev_health) < d_hp[iLevel - 1] || pev(id, pev_armorvalue) < d_ap[iLevel - 1]))
{
if( pev(id, pev_health) < d_hp[iLevel - 1] )
{
set_pev(id, pev_health, floatmin(pev(id, pev_health) + d_takehp[iLevel-1], float(d_hp[iLevel - 1])) );
//if(pev( iEnt, pev_iuser1)==1) cs_set_user_money(id, cs_get_user_money(id) - 1 );
}
if( pev(id, pev_armorvalue) < d_ap[iLevel - 1] )
{
set_pev(id, pev_armorvalue, floatmin(pev(id, pev_armorvalue) + d_takeap[iLevel-1], float(d_ap[iLevel - 1])) );
//if(pev( iEnt, pev_iuser1)==1) cs_set_user_money(id, cs_get_user_money(id) - 1 );
}
/* if(cs_get_user_money(id)>0 && pev( iEnt, pev_iuser1)==1 && iOwner != id){
Disp_balance[iEnt]+=1
dips_balanced(id, 1)
} else if( cs_get_user_money(id) < 100000 && Disp_balance[iEnt] > 0 && pev( iEnt, pev_iuser1)==1 && iOwner == id)
{
cs_set_user_money(id, cs_get_user_money(id) + 1 );
//set_pev( iEnt, pev_fuser1, pev( iEnt, pev_fuser1) - 1.0 );
Disp_balance[iEnt]-=1
dips_balanced(id, -1)
} else if( pev(id, pev_health) < d_hp[iLevel - 1] || pev(id, pev_armorvalue) < d_ap[iLevel - 1]){ if(pev( iEnt, pev_iuser1)==1 && iOwner != id) cs_set_user_money(id, cs_get_user_money(id) - 1 );}
*/
//player_healingEffect(id)
new bool:BigBeam = pev(id, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(id, pev_health) < float(d_hp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
}
}
}
new ent = -1, sClassName[32]
while ( ( ent = engfunc ( EngFunc_FindEntityInSphere, ent, origin, fRadius ) ) != 0 ) {
pev ( ent, pev_classname, sClassName, charsmax ( sClassName ) )
if(pev_valid(ent)){
new Float:flOrigin[ 3 ];
pev( ent, pev_origin, flOrigin );
if(equal(sClassName,gDispenserClassname)){
if(get_user_team(iOwner) == pev( ent, pev_iuser4)){
if(ent != iEnt){
flOrigin[2]+=20.0
if( UTIL_IsVisible( ent, iEnt ) && pev(ent, pev_health) < d_enthp[pev(ent, pev_iuser3)-1])
{
set_pev(ent, pev_health, pev(ent, pev_health) + d_takehpabjects[iLevel-1]);
new bool:BigBeam = pev(ent, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(ent, pev_health) < float(d_enthp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
}
}
} /*else if(equal(sClassName,"lasermine")){
if( UTIL_IsVisible( ent, iEnt ) && pev(ent, pev_health) < 400)
{
set_pev(ent, pev_health, pev(ent, pev_health) + d_takehpabjects[iLevel-1]);
new bool:BigBeam = pev(ent, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(ent, pev_health) < float(d_enthp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
} else if(equal(sClassName,"sentry")){
if(cs_get_user_team(iOwner)==get_sentry_team(ent)){
if(pev(ent, pev_health)<g_HEALTHSS[get_SentryLevel(ent)]){
if(UTIL_IsVisible(ent,iEnt))
{
set_pev(ent, pev_health, pev(ent, pev_health) + d_takehpabjects[iLevel-1]);
new bool:BigBeam = pev(ent, pev_armorvalue) < float(d_ap[iLevel - 1]) || pev(ent, pev_health) < float(d_enthp[iLevel - 1]) ? true : false
UTIL_BeamEnts( flOrigin, origin, gBeamcolor[ iOwner ][ 0 ], gBeamcolor[ iOwner ][ 1 ], gBeamcolor[ iOwner ][ 2 ], gHealingBeam, BigBeam ? 60 : 20, BigBeam ? 1 : 11);
}
}
}
} */
}
}
}
new Float:entorigin[3]
pev( iEnt, pev_origin, entorigin )
new HP = pev ( iEnt, pev_health )
if(HP<=600.0){
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_SMOKE)
engfunc(EngFunc_WriteCoord, entorigin[0]+random_float(-8.0, 8.0))
engfunc(EngFunc_WriteCoord, entorigin[1]+random_float(-8.0, 8.0))
engfunc(EngFunc_WriteCoord, entorigin[2]+random_float(25.0, 35.0))
write_short(g_iSPR_Smoke3)
write_byte(random_num(3,7))
write_byte(30)
message_end()
}
if(get_user_team(iOwner) != pev( iEnt, pev_iuser4))
{
BreakAllPlayerDispensers(iOwner);
g_iPlayerDispenser[id] = 0
return PLUGIN_CONTINUE;
}
set_pev( iEnt, pev_nextthink, get_gametime( ) + 0.1 );
}
return PLUGIN_CONTINUE;
}
// updatingdisp[ent]
public fw_DispenserTouch ( ent, id )
{
if(updatingdisp[ent])
return
new iLevel = pev ( ent, pev_iuser3 );
static Float:time;time=get_gametime()
if(flood_disptouch[id] > time)
return
flood_disptouch[id] = time+2.0
if ( !pev_valid ( ent ) )
return
if ( !is_user_connected ( id ) || !is_user_alive ( id ) )
return
if ( pev ( ent, pev_iuser4 ) != _:cs_get_user_team ( id ) )
return
// if ( iLevel == 4 && pev( ent, pev_iuser1) == 0){
// touchdisp[id] = ent
// show_updatemenu(id)
// return
// }
if(iLevel == 4)
return
new iOwner = pev ( ent, pev_iuser2 )
new money = cs_get_user_money ( id )
if (get_user_flags(id) & ADMIN_LEVEL_B && money < d_upgcost_vip[iLevel])
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost_vip[iLevel] )
return;
}
else if( money < d_upgcost[iLevel] )
{
ChatColor ( id, "^3[^4Информация^3]^1 У тебя не хватает денег! (нужно %d$)", d_upgcost[iLevel] )
return;
}
if ( !is_user_connected ( iOwner ) )
return
if (get_user_flags(id) & ADMIN_LEVEL_B)
{
cs_set_user_money(id, money - d_upgcost_vip[iLevel-1])
//set_bankmoney(id,d_upgcost_vip[iLevel-1])
}
else
{
cs_set_user_money(id, money - d_upgcost[iLevel-1])
//set_bankmoney(id,d_upgcost[iLevel-1])
}
new sUpgraderName[32]
get_user_name ( id, sUpgraderName, charsmax ( sUpgraderName ) )
client_print ( iOwner, print_center, "%s прокачал твой раздатчик", sUpgraderName )
set_player_bonus(id, 15)
gBeamcolor[ id ][ 0 ] = 0, gBeamcolor[ id ][ 1 ] = 255, gBeamcolor[ id ][ 2 ] = 0;
/*код достижения*/
/* if(iOwner != id){
if(get_player_type(id) == 2){
if(get_upd_disp(id) == 0){
if(get_player_expmm(id) < 650){
set_player_expmm(id, 1);
if(get_player_expmm(id) >= 650){
set_upd_disp(id, 1);
set_player_type(id, 0)
}
} else if(get_player_expmm(id) >= 650){
set_upd_disp(id, 1);
set_player_type(id, 0)
}
}
}
} */
/*код достижения*/
updatingdisp[ent] = 1
/* new iEntity = create_entity("info_target")
new Float: Origin[3]
entity_get_vector(ent, EV_VEC_origin, Origin)
Origin[0]-=30.0
Origin[1]+=5.0
Origin[2]+=70.0
entity_set_string(iEntity, EV_SZ_classname, "Shield_Ent")
entity_set_vector(iEntity,EV_VEC_origin, Origin)
entity_set_model(iEntity, "models/great_sentries/PFG_SENTRIES_OLD2.mdl")
set_pev(iEntity, pev_solid, SOLID_TRIGGER );
set_pev(iEntity, pev_body, 8);
set_pev(iEntity, pev_sequence, 9)
set_pev(iEntity, pev_framerate, 1.0)
switch( pev ( ent, pev_iuser4 ) )
{
case CS_TEAM_T:
{
set_pev(iEntity, pev_skin, 3);
}
case CS_TEAM_CT:
{
set_pev(iEntity, pev_skin, 2);
}
}
set_pev(ent,pev_euser3,iEntity) */
fw_DispenserTouchTwo(ent+3000)
//set_task ( 3.0, "fw_DispenserTouchTwo",ent+3000)
}
public fw_DispenserTouchTwo (entoff){
new ent = entoff-3000
/* new iceCub = pev(ent,pev_euser3)
if(pev_valid(iceCub)){
remove_entity(iceCub)
set_pev(ent,pev_euser3, 0)
} */
new iLevel = pev ( ent, pev_iuser3 );
iLevel++
set_pev ( ent, pev_iuser3, iLevel )
set_pev ( ent, pev_health, float ( d_enthp[iLevel-1] ) )
engfunc( EngFunc_SetModel, ent, gDispenserMdl )
engfunc( EngFunc_SetSize, ent, Float:{ -20.0, -10.0, 0.0 }, Float:{ 20.0, 10.0, 50.0 } )
emit_sound( ent, CHAN_STATIC, gDispenserActive, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
switch( pev ( ent, pev_iuser4 ) )
{
case CS_TEAM_T:
{
switch(iLevel)
{
case 2: set_pev(ent, pev_body, 5);
case 3: set_pev(ent, pev_body, 6);
case 4: set_pev(ent, pev_body, 7);
}
}
case CS_TEAM_CT:
{
switch(iLevel)
{
case 2: set_pev(ent, pev_body, 1);
case 3: set_pev(ent, pev_body, 2);
case 4: set_pev(ent, pev_body, 3);
}
}
}
updatingdisp[ent] = 0
}
public EVENT_TextMsg( )
{
UTIL_DestroyDispensers( );
}
public LOG_RoundEnd( )
{
UTIL_DestroyDispensers( );
}
stock UTIL_DestroyDispensers( )
{
new iEnt = FM_NULLENT;
while( ( iEnt = find_ent_by_class( iEnt, gDispenserClassname ) ) )
{
if(is_valid_ent ( iEnt )){
new iOwner = pev( iEnt, pev_iuser2 );
bDispenserBuild[ iOwner ] = false;
g_iPlayerDispenser[ iOwner ]--;
DeleteEntity( iEnt )
}
}
}
stock UTIL_BeamEnts( Float:flStart[ 3 ], Float:flEnd[ 3 ], r, g, b, sprite, width, ampl )
{
engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flStart );
write_byte( TE_BEAMPOINTS );
engfunc( EngFunc_WriteCoord, flStart[ 0 ] );
engfunc( EngFunc_WriteCoord, flStart[ 1 ] );
engfunc( EngFunc_WriteCoord, flStart[ 2 ] );
engfunc( EngFunc_WriteCoord, flEnd[ 0 ] );
engfunc( EngFunc_WriteCoord, flEnd[ 1 ] );
engfunc( EngFunc_WriteCoord, flEnd[ 2 ] );
write_short( sprite );
write_byte( 5 );
write_byte( 2 );
write_byte( 1 );
write_byte( width );
write_byte( ampl );
write_byte( r );
write_byte( g );
write_byte( b );
write_byte( 130 );
write_byte( 30 );
message_end( );
}
stock bool:UTIL_IsVisible( index, entity, ignoremonsters = 0 )
{
new Float:flStart[ 3 ], Float:flDest[ 3 ];
pev( index, pev_origin, flStart );
pev( index, pev_view_ofs, flDest );
xs_vec_add( flStart, flDest, flStart );
pev( entity, pev_origin, flDest );
engfunc( EngFunc_TraceLine, flStart, flDest, ignoremonsters, index, 0 );
new Float:flFraction;
get_tr2( 0, TR_flFraction, flFraction );
if( flFraction == 1.0 || get_tr2( 0, TR_pHit) == entity )
{
return true;
}
return false;
}
public BreakAllPlayerDispensers(id)
{
static ent = -1
while ((ent = find_ent_by_class(ent, gDispenserClassname)))
{
if(pev( ent, pev_iuser2 ) != id)
continue
if(pev_valid(ent))
{
DeleteEntity( ent )
//set_pev( ent, pev_flags, pev( ent, pev_flags ) | FL_KILLME );
}
}
bDispenserBuild[ id ] = false;
g_iPlayerDispenser[ id ] = 0;
}
bool:TraceCheckCollides(Float:origin[3], const Float:BOUNDS)
{
new Float:traceEnds[8][3], Float:traceHit[3], hitEnt
traceEnds[0][0] = origin[0] - BOUNDS
traceEnds[0][1] = origin[1] - BOUNDS
traceEnds[0][2] = origin[2] - BOUNDS
traceEnds[1][0] = origin[0] - BOUNDS
traceEnds[1][1] = origin[1] - BOUNDS
traceEnds[1][2] = origin[2] + BOUNDS
traceEnds[2][0] = origin[0] + BOUNDS
traceEnds[2][1] = origin[1] - BOUNDS
traceEnds[2][2] = origin[2] + BOUNDS
traceEnds[3][0] = origin[0] + BOUNDS
traceEnds[3][1] = origin[1] - BOUNDS
traceEnds[3][2] = origin[2] - BOUNDS
traceEnds[4][0] = origin[0] - BOUNDS
traceEnds[4][1] = origin[1] + BOUNDS
traceEnds[4][2] = origin[2] - BOUNDS
traceEnds[5][0] = origin[0] - BOUNDS
traceEnds[5][1] = origin[1] + BOUNDS
traceEnds[5][2] = origin[2] + BOUNDS
traceEnds[6][0] = origin[0] + BOUNDS
traceEnds[6][1] = origin[1] + BOUNDS
traceEnds[6][2] = origin[2] + BOUNDS
traceEnds[7][0] = origin[0] + BOUNDS
traceEnds[7][1] = origin[1] + BOUNDS
traceEnds[7][2] = origin[2] - BOUNDS
for (new i = 0; i < 8; i++)
{
if (point_contents(traceEnds[i]) != CONTENTS_EMPTY)
return true
hitEnt = trace_line(0, origin, traceEnds[i], traceHit)
if (hitEnt != 0)
return true
for (new j = 0; j < 3; j++)
{
if (traceEnds[i][j] != traceHit[j])
return true
}
}
return false
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 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();
}
}
}
}
player_healingEffect(id)
{
new iOrigin[3]
get_user_origin(id, iOrigin)
message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
write_byte(TE_PROJECTILE)
write_coord(iOrigin[x] + random_num(-10, 10))
write_coord(iOrigin[y] + random_num(-10, 10))
write_coord(iOrigin[z] + random_num(0, 30))
write_coord(0)
write_coord(0)
write_coord(15)
write_short(gSpr_regeneration)
write_byte(1)
write_byte(id)
message_end()
}
В этой теме было размещено решение! Перейти к решению.
Download all Attachments
-
36 KB Просмотры: 812
Последнее редактирование модератором: