Zplague
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Zplague Entrar

Seu portal de Zombie Plague no Brasil


description[ZP] 3 Sacos de Areia Empty[ZP] 3 Sacos de Areia

more_horiz
[ZP] 3 Sacos de Areia KH20WId

Descrição: Ao comprar você vai ganhar 3 sacos de areia, pode ser usado como escudo para os zumbis não passar ou fazer uma escada para subir em lugares altos.
--------------------------------------------------------------------------------
Vida: Esses sacos de areia tem um limite para ser quebrado, no qual eu editei para vida dele ser 600.
--------------------------------------------------------------------------------
Quantidade: Eles vieram com 15 Sacos de areia, no qual é muito apelativo, eu editei para ganhar apenas 3 Sacos de Areia.

Download: http://www.mediafire.com/?at0sxq3fvcfn9wg

Créditos: Original (Samurai)
             Atualizado (Larp)
             Alguns edits (Eu)

Bug's? eduardo.struk
Gostou? REP+ ou apenas comente.

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
esse sacos de areia so humanos pasam?

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
Ninguem passa.

Tem que quebrar

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
tem como você aruma isso? tipo mover ou tirar saco ajudaria.

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
Vou tentar, não prometo nada!

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
tem como faser os humanos atravessar os sacos ?

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
Caso algum scripter ajudar ..

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
alguém poderia ajuda tipo perfect

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
Prontinho Testa ai:

Código:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include < xs >
#include <zombieplague>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{  27.340000,  26.629999,  29.020000 }

#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

#define SANDBAGS_CLASS "amxx_pallets"

new pnumplugin, remove_nrnd, maxpallets, phealth, palletscout = 0;
new g_models[][] = { "models/pallet_with_bags2.mdl", "models/pallet_with_bags.mdl" }

new stuck[33], g_bolsas[33], cvar[3]

new const Float:size[][3] = {
{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
{0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
{0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
{0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const g_item_name[] = { "3 Sacos de Areia" }
const g_item_bolsas = 20
new g_itemid_bolsas, ZPSTUCK

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init() 
{
   register_plugin("[ZP] Extra: SandBags", "1.1", "LARP | [P]erfec[T] [S]cr[@]s[H]")
   
   set_task(0.1,"checkstuck",0,"",0,"b")
   
   g_itemid_bolsas = zp_register_extra_item(g_item_name, g_item_bolsas, ZP_TEAM_HUMAN)
   
   ZPSTUCK = register_cvar("zp_pb_stuck","1")
   pnumplugin = register_cvar("zp_pb_enable","1");
   remove_nrnd = register_cvar("zp_pb_nemround","1");
   maxpallets = register_cvar("zp_pb_limit","200"); // max number of pallets with bags
   phealth = register_cvar("zp_pb_health","600"); // set the health to a pallet with bags
   cvar[0] = register_cvar("zp_pb_autounstuck","1")
   cvar[1] = register_cvar("zp_pb_stuckeffects","1")
   cvar[2] = register_cvar("zp_pb_stuckwait","7")
   
   register_event("HLTV","event_newround", "a","1=0", "2=0"); // it's called every on new round

   register_menucmd(register_menuid("\r[\dSacos-De-Areia\r]\w"), 1023, "menu_command" );
   register_clcmd("say /pb","show_the_menu");
   register_clcmd("/pb","show_the_menu");
   
   register_forward(FM_Touch, "fw_Touch")
}


public plugin_precache() for(new i;i < sizeof g_models;i++) engfunc(EngFunc_PrecacheModel,g_models[i]);

public show_the_menu(id,level,cid)
{
   if(!get_pcvar_num(pnumplugin) ||!is_user_alive(id) || zp_get_user_zombie(id)) return PLUGIN_HANDLED;
   
   if (!zp_get_user_zombie(id))
   {      
      new szMenuBody[256], keys;
      
      new nLen = format( szMenuBody, 255, "\r[\dSacos-De-Areia\r]\w Menu Principal:^n^nSaco(s) de Areia Restante(s): \r[\d%i\r]^n", g_bolsas[id] );
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n\r1. \wColocar 1 Saco-De-Areia");
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n\r2. \wRemover um Saco-De-Areia \r[Aponte Com o Mouse]" );
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\r0. \wSair" );
      
      keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
      
      show_menu( id, keys, szMenuBody, -1 );
      return PLUGIN_HANDLED;
   }
   return PLUGIN_HANDLED;
}


public menu_command(id,key,level,cid)
{
   switch( key )
   {
      case 0: 
      {
         if (is_user_alive(id) && !zp_get_user_zombie(id))
         {
            if ( g_bolsas[id] <= 0 ) {
               client_printcolor(id, "!g[ZP]!y Voce Nao Tem Sacos De Areia")
               return PLUGIN_CONTINUE
            }

            g_bolsas[id] -= 1
            place_palletwbags(id);
            show_the_menu(id,level,cid);
            return PLUGIN_CONTINUE   
         }
         return PLUGIN_CONTINUE   
      }
      
      case 1: deleteItem(id), show_the_menu(id,level,cid); // Remover Saco de Areia
   }
   return PLUGIN_HANDLED;
}

public deleteItem(id) 

   new ent, a_body; get_user_aiming(id, ent, a_body) 
   
   if (!is_user_alive(id) || zp_get_user_zombie(id) || !pev_valid(ent))  return PLUGIN_CONTINUE;
   
   if(pev(ent, pev_iuser2) != id) 
   {
      client_printcolor(id, "!g[ZP]!y Este Saco Nao Eh Seu")
      return PLUGIN_CONTINUE;
   }      
   
   new class[32]; pev(ent, pev_classname, class, 31) 
   if (equal(class, SANDBAGS_CLASS))   
   {
      set_pev(ent, pev_flags, FL_KILLME) 
      palletscout--; g_bolsas[id] += 1
      client_printcolor(id, "!g[ZP]!y Voce Removeu !g1!y Saco de Areia Com Sucesso.")
   }
   return PLUGIN_CONTINUE 


public place_palletwbags(id)
{
   if( palletscout == get_pcvar_num(maxpallets) )
   {
      client_printcolor(id, "!g[ZP]!y Por Seguranca so serao Permitidos !g%d!y Sacos de Areia no Servidor.", get_pcvar_num(maxpallets));
      return PLUGIN_HANDLED;
   }
   
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"));
   set_pev(ent,pev_classname,SANDBAGS_CLASS); engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
   static Float:xorigin[3]; get_user_hitpoint(id,xorigin);

   if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
   {
      client_printcolor(id, "!g[ZP]!y Voce Nao Pode Colocar Sacos de Areia No Ceu");
      return PLUGIN_HANDLED;
   }
   
   // set sizes
   static Float:p_mins[3], Float:p_maxs[3];
   p_mins = PALLET_MINS; p_maxs = PALLET_MAXS;
   engfunc(EngFunc_SetSize, ent, p_mins, p_maxs);
   set_pev(ent, pev_mins, p_mins); set_pev(ent, pev_maxs, p_maxs );
   set_pev(ent, pev_absmin, p_mins); set_pev(ent, pev_absmax, p_maxs );
   
   engfunc(EngFunc_SetOrigin, ent, xorigin);
   
   set_pev(ent, pev_iuser2, id) // o kara q plantou o saco
   set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
   set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff

   new Float:p_cvar_health = get_pcvar_float(phealth);
   switch(p_cvar_health)
   {
      case 0.0 : set_pev(ent,pev_takedamage,DAMAGE_NO);
      
      default: {
         set_pev(ent,pev_health,p_cvar_health);
         set_pev(ent,pev_takedamage,DAMAGE_YES);
      }
   }

   static Float:rvec[3]; pev(id,pev_v_angle,rvec);
   rvec[0] = 0.0; set_pev(ent,pev_angles,rvec);

   fm_drop_to_floor(ent);

   palletscout++;
   
   client_printcolor(id, "!g[ZP]!y Voce Colocou !t1!y Saco de Areia. !t%i!y Sacos de Areia Restante(s)", g_bolsas[id])
   return PLUGIN_HANDLED;
}

stock get_user_hitpoint(id, Float:hOrigin[3]) 
{
   if (!is_user_alive(id) || zp_get_user_zombie(id)) return 0;
   
   new Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3], Float:fTemp[3];
   
   pev(id, pev_origin, fOrigin); pev(id, pev_v_angle, fvAngle); pev(id, pev_view_ofs, fvOffset);
   xs_vec_add(fOrigin, fvOffset, fvOrigin);
   
   engfunc(EngFunc_AngleVectors, fvAngle, feOrigin, fTemp, fTemp);
   
   xs_vec_mul_scalar(feOrigin, 9999.9, feOrigin); xs_vec_add(fvOrigin, feOrigin, feOrigin);
   
   engfunc(EngFunc_TraceLine, fvOrigin, feOrigin, 0, id);
   global_get(glb_trace_endpos, hOrigin);
   
   return 1;


public event_newround() if( get_pcvar_num ( remove_nrnd ) == 1) remove_allpalletswbags();

stock remove_allpalletswbags()
{
   new pallets = -1;
   while((pallets = fm_find_ent_by_class(pallets, SANDBAGS_CLASS))) fm_remove_entity(pallets);
   
   palletscout = 0;
}

public checkstuck()
{
   if (get_pcvar_num(ZPSTUCK))
   {
      static players[32], pnum, player; get_players(players, pnum)
      static Float:origin[3], Float:mins[3], hull, Float:vec[3], o, i
      for(i=0; i<pnum; i++)
      {
         player = players[i]
         if (is_user_connected(player) && is_user_alive(player)) 
         {
            pev(player, pev_origin, origin); hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
            
            if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) 
            {
               ++stuck[player]
               if(stuck[player] >= get_pcvar_num(cvar[2])) 
               {
                  pev(player, pev_mins, mins); vec[2] = origin[2]
                  for (o=0; o < sizeof size; ++o) 
                  {
                     vec[0] = origin[0] - mins[0] * size[o][0]
                     vec[1] = origin[1] - mins[1] * size[o][1]
                     vec[2] = origin[2] - mins[2] * size[o][2]
                     if (is_hull_vacant(vec, hull,player)) 
                     {
                        engfunc(EngFunc_SetOrigin, player, vec)
                        effects(player)
                        set_pev(player,pev_velocity,{0.0,0.0,0.0})
                        o = sizeof size
                     }
                  }
               }
            }
            else stuck[player] = 0
         }
      }
      
   }
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) 
{
   static tr; engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
   if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) return true
   
   return false
}

public effects(id) 
{
   if(get_pcvar_num(cvar[1])) 
   {
      set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
      show_hudmessage(id,"Automatic Unstuck!") // HUDMESSAGE
      message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
      write_short(1<<10)   // fade lasts this long duration
      write_short(1<<10)   // fade lasts this long hold time
      write_short(1<<1)   // fade type (in / out)
      write_byte(20)            // fade red
      write_byte(255)    // fade green
      write_byte(255)        // fade blue
      write_byte(255)    // fade alpha
      message_end()
      client_cmd(id,"spk fvox/blip.wav")
   }
}

public zp_extra_item_selected(player, itemid)
{
   if (itemid == g_itemid_bolsas) 
   {
      g_bolsas[player] += 3
      set_task(0.3,"show_the_menu",player);
      client_printcolor(player, "!g[ZP]!y Voce Comprou !t3 Sacos de Areia")
      client_printcolor(player, "!g[ZP]!y Digite !t/pb!y Para Exibir o Menu")
   }
}

// Bang usado para deixar o saco atravessavel (usado na minha famosa lasermine by: [P]erfec[T])
public fw_Touch(toucher, touched) 
{
   if(!is_user_alive(toucher) || zp_get_user_zombie(toucher) || !pev_valid(touched)) return FMRES_IGNORED;
   
   new classname[32]; pev(touched, pev_classname, classname, 31) 
   
   if(equal(classname, SANDBAGS_CLASS)) 
   {
      set_pev(touched, pev_solid, SOLID_NOT)
      set_task(1.0, "solid_again", touched) // Pra deixar solido de novo
   }
   
   return FMRES_IGNORED 
}

public solid_again(i_Ent) 
{
   if(!pev_valid(i_Ent)) return FMRES_IGNORED; // Evitar Erro de Debug

   new clsname[32]; pev( i_Ent, pev_classname, clsname, 31 );
   if(!equali(clsname, SANDBAGS_CLASS)) return FMRES_IGNORED; // Para Nao bugar em outras entidades

   set_pev(i_Ent, pev_solid, SOLID_BBOX) // Pra deixar solido de novo
   
   return FMRES_IGNORED
}

public zp_user_infected_post(id) RemoveAllSandbags(id) // Remover os Sacos de Areia Apos a Infecção

public RemoveAllSandbags(i_Owner)
{
   new iEnt = get_maxplayers() + 1, clsname[32];
   while((iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", SANDBAGS_CLASS)))
   {
      if (i_Owner)
      {
         if(pev(iEnt, pev_iuser2) != i_Owner) continue;

         clsname[0] = '^0'
         pev(iEnt, pev_classname, clsname, sizeof(clsname)-1);
                
         if (equali(clsname, SANDBAGS_CLASS)) set_pev(iEnt, pev_flags, FL_KILLME);
      }
      else set_pev( iEnt, pev_flags, FL_KILLME );
   }
}

// Mensagem Colorida (client_printcolor)
stock client_printcolor(const id, const input[], any:...)
{
   new count = 1, players[32]
   static msg[191]
   vformat(msg, 190, input, 3)
   
   replace_all(msg, 190, "!g", "^4")  // Chat Verde
   replace_all(msg, 190, "!y", "^1")  // Chat Normal
   replace_all(msg, 190, "!t", "^3")  // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
   
   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();
         }
      }
   }
}

stock get_user_noclip(index) return (pev(index, pev_movetype) == MOVETYPE_NOCLIP);


Eu tirei a Include desnecessaria (fun) deixei o saco de areia atravessável para humanos, opção remover um saco de areia e remover os sacos da pessoa quando ela for infectada e corrigi uns bugs.

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
[P]erfec[T] [S]cr[@]s[H] escreveu:
Prontinho Testa ai:

Código:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <  xs >
#include <zombieplague>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{  27.340000,  26.629999,  29.020000 }

#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

#define SANDBAGS_CLASS "amxx_pallets"

new pnumplugin, remove_nrnd, maxpallets, phealth, palletscout = 0;
new g_models[][] = { "models/pallet_with_bags2.mdl", "models/pallet_with_bags.mdl" }

new stuck[33], g_bolsas[33], cvar[3]

new const Float:size[][3] = {
{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
{0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
{0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
{0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const g_item_name[] = { "3 Sacos de Areia" }
const g_item_bolsas = 20
new g_itemid_bolsas, ZPSTUCK

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init() 
{
   register_plugin("[ZP] Extra: SandBags", "1.1", "LARP | [P]erfec[T] [S]cr[@]s[H]")
   
   set_task(0.1,"checkstuck",0,"",0,"b")
   
   g_itemid_bolsas = zp_register_extra_item(g_item_name, g_item_bolsas, ZP_TEAM_HUMAN)
   
   ZPSTUCK = register_cvar("zp_pb_stuck","1")
   pnumplugin = register_cvar("zp_pb_enable","1");
   remove_nrnd = register_cvar("zp_pb_nemround","1");
   maxpallets = register_cvar("zp_pb_limit","200"); // max number of pallets with bags
   phealth = register_cvar("zp_pb_health","600"); // set the health to a pallet with bags
   cvar[0] = register_cvar("zp_pb_autounstuck","1")
   cvar[1] = register_cvar("zp_pb_stuckeffects","1")
   cvar[2] = register_cvar("zp_pb_stuckwait","7")
   
   register_event("HLTV","event_newround", "a","1=0", "2=0"); // it's called every on new round

   register_menucmd(register_menuid("\r[\dSacos-De-Areia\r]\w"), 1023, "menu_command" );
   register_clcmd("say /pb","show_the_menu");
   register_clcmd("/pb","show_the_menu");
   
   register_forward(FM_Touch, "fw_Touch")
}


public plugin_precache() for(new i;i < sizeof g_models;i++) engfunc(EngFunc_PrecacheModel,g_models[i]);

public show_the_menu(id,level,cid)
{
   if(!get_pcvar_num(pnumplugin) ||!is_user_alive(id) || zp_get_user_zombie(id)) return PLUGIN_HANDLED;
   
   if (!zp_get_user_zombie(id))
   {      
      new szMenuBody[256], keys;
      
      new nLen = format( szMenuBody, 255, "\r[\dSacos-De-Areia\r]\w Menu Principal:^n^nSaco(s) de Areia Restante(s): \r[\d%i\r]^n", g_bolsas[id] );
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n\r1. \wColocar 1 Saco-De-Areia");
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n\r2. \wRemover um Saco-De-Areia \r[Aponte Com o Mouse]" );
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\r0. \wSair" );
      
      keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
      
      show_menu( id, keys, szMenuBody, -1 );
      return PLUGIN_HANDLED;
   }
   return PLUGIN_HANDLED;
}


public menu_command(id,key,level,cid)
{
   switch( key )
   {
      case 0: 
      {
         if (is_user_alive(id) && !zp_get_user_zombie(id))
         {
            if ( g_bolsas[id] <= 0 ) {
               client_printcolor(id, "!g[ZP]!y Voce Nao Tem Sacos De Areia")
               return PLUGIN_CONTINUE
            }

            g_bolsas[id] -= 1
            place_palletwbags(id);
            show_the_menu(id,level,cid);
            return PLUGIN_CONTINUE   
         }
         return PLUGIN_CONTINUE   
      }
      
      case 1: deleteItem(id), show_the_menu(id,level,cid); // Remover Saco de Areia
   }
   return PLUGIN_HANDLED;
}

public deleteItem(id) 

   new ent, a_body; get_user_aiming(id, ent, a_body) 
   
   if (!is_user_alive(id) || zp_get_user_zombie(id) || !pev_valid(ent))  return PLUGIN_CONTINUE;
   
   if(pev(ent, pev_iuser2) != id) 
   {
      client_printcolor(id, "!g[ZP]!y Este Saco Nao Eh Seu")
      return PLUGIN_CONTINUE;
   }      
   
   new class[32]; pev(ent, pev_classname, class, 31) 
   if (equal(class, SANDBAGS_CLASS))   
   {
      set_pev(ent, pev_flags, FL_KILLME) 
      palletscout--; g_bolsas[id] += 1
      client_printcolor(id, "!g[ZP]!y Voce Removeu !g1!y Saco de Areia Com Sucesso.")
   }
   return PLUGIN_CONTINUE 


public place_palletwbags(id)
{
   if( palletscout == get_pcvar_num(maxpallets) )
   {
      client_printcolor(id, "!g[ZP]!y Por Seguranca so serao Permitidos !g%d!y Sacos de Areia no Servidor.", get_pcvar_num(maxpallets));
      return PLUGIN_HANDLED;
   }
   
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"));
   set_pev(ent,pev_classname,SANDBAGS_CLASS); engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
   static Float:xorigin[3]; get_user_hitpoint(id,xorigin);

   if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
   {
      client_printcolor(id, "!g[ZP]!y Voce Nao Pode Colocar Sacos de Areia No Ceu");
      return PLUGIN_HANDLED;
   }
   
   // set sizes
   static Float:p_mins[3], Float:p_maxs[3];
   p_mins = PALLET_MINS; p_maxs = PALLET_MAXS;
   engfunc(EngFunc_SetSize, ent, p_mins, p_maxs);
   set_pev(ent, pev_mins, p_mins); set_pev(ent, pev_maxs, p_maxs );
   set_pev(ent, pev_absmin, p_mins); set_pev(ent, pev_absmax, p_maxs );
   
   engfunc(EngFunc_SetOrigin, ent, xorigin);
   
   set_pev(ent, pev_iuser2, id) // o kara q plantou o saco
   set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
   set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff

   new Float:p_cvar_health = get_pcvar_float(phealth);
   switch(p_cvar_health)
   {
      case 0.0 : set_pev(ent,pev_takedamage,DAMAGE_NO);
      
      default: {
         set_pev(ent,pev_health,p_cvar_health);
         set_pev(ent,pev_takedamage,DAMAGE_YES);
      }
   }

   static Float:rvec[3]; pev(id,pev_v_angle,rvec);
   rvec[0] = 0.0; set_pev(ent,pev_angles,rvec);

   fm_drop_to_floor(ent);

   palletscout++;
   
   client_printcolor(id, "!g[ZP]!y Voce Colocou !t1!y Saco de Areia. !t%i!y Sacos de Areia Restante(s)", g_bolsas[id])
   return PLUGIN_HANDLED;
}

stock get_user_hitpoint(id, Float:hOrigin[3]) 
{
   if (!is_user_alive(id) || zp_get_user_zombie(id)) return 0;
   
   new Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3], Float:fTemp[3];
   
   pev(id, pev_origin, fOrigin); pev(id, pev_v_angle, fvAngle); pev(id, pev_view_ofs, fvOffset);
   xs_vec_add(fOrigin, fvOffset, fvOrigin);
   
   engfunc(EngFunc_AngleVectors, fvAngle, feOrigin, fTemp, fTemp);
   
   xs_vec_mul_scalar(feOrigin, 9999.9, feOrigin); xs_vec_add(fvOrigin, feOrigin, feOrigin);
   
   engfunc(EngFunc_TraceLine, fvOrigin, feOrigin, 0, id);
   global_get(glb_trace_endpos, hOrigin);
   
   return 1;


public event_newround() if( get_pcvar_num ( remove_nrnd ) == 1) remove_allpalletswbags();

stock remove_allpalletswbags()
{
   new pallets = -1;
   while((pallets = fm_find_ent_by_class(pallets, SANDBAGS_CLASS))) fm_remove_entity(pallets);
   
   palletscout = 0;
}

public checkstuck()
{
   if (get_pcvar_num(ZPSTUCK))
   {
      static players[32], pnum, player; get_players(players, pnum)
      static Float:origin[3], Float:mins[3], hull, Float:vec[3], o, i
      for(i=0; i<pnum; i++)
      {
         player = players[i]
         if (is_user_connected(player) && is_user_alive(player)) 
         {
            pev(player, pev_origin, origin); hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
            
            if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) 
            {
               ++stuck[player]
               if(stuck[player] >= get_pcvar_num(cvar[2])) 
               {
                  pev(player, pev_mins, mins); vec[2] = origin[2]
                  for (o=0; o < sizeof size; ++o) 
                  {
                     vec[0] = origin[0] - mins[0] * size[o][0]
                     vec[1] = origin[1] - mins[1] * size[o][1]
                     vec[2] = origin[2] - mins[2] * size[o][2]
                     if (is_hull_vacant(vec, hull,player)) 
                     {
                        engfunc(EngFunc_SetOrigin, player, vec)
                        effects(player)
                        set_pev(player,pev_velocity,{0.0,0.0,0.0})
                        o = sizeof size
                     }
                  }
               }
            }
            else stuck[player] = 0
         }
      }
      
   }
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) 
{
   static tr; engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
   if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) return true
   
   return false
}

public effects(id) 
{
   if(get_pcvar_num(cvar[1])) 
   {
      set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
      show_hudmessage(id,"Automatic Unstuck!") // HUDMESSAGE
      message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
      write_short(1<<10)   // fade lasts this long duration
      write_short(1<<10)   // fade lasts this long hold time
      write_short(1<<1)   // fade type (in / out)
      write_byte(20)            // fade red
      write_byte(255)    // fade green
      write_byte(255)        // fade blue
      write_byte(255)    // fade alpha
      message_end()
      client_cmd(id,"spk fvox/blip.wav")
   }
}

public zp_extra_item_selected(player, itemid)
{
   if (itemid == g_itemid_bolsas) 
   {
      g_bolsas[player] += 3
      set_task(0.3,"show_the_menu",player);
      client_printcolor(player, "!g[ZP]!y Voce Comprou !t3 Sacos de Areia")
      client_printcolor(player, "!g[ZP]!y Digite !t/pb!y Para Exibir o Menu")
   }
}

// Bang usado para deixar o saco atravessavel (usado na minha famosa lasermine by: [P]erfec[T])
public fw_Touch(toucher, touched) 
{
   if(!is_user_alive(toucher) || zp_get_user_zombie(toucher) || !pev_valid(touched)) return FMRES_IGNORED;
   
   new classname[32]; pev(touched, pev_classname, classname, 31) 
   
   if(equal(classname, SANDBAGS_CLASS)) 
   {
      set_pev(touched, pev_solid, SOLID_NOT)
      set_task(1.0, "solid_again", touched) // Pra deixar solido de novo
   }
   
   return FMRES_IGNORED 
}

public solid_again(i_Ent) 
{
   if(!pev_valid(i_Ent)) return FMRES_IGNORED; // Evitar Erro de Debug

   new clsname[32]; pev( i_Ent, pev_classname, clsname, 31 );
   if(!equali(clsname, SANDBAGS_CLASS)) return FMRES_IGNORED; // Para Nao bugar em outras entidades

   set_pev(i_Ent, pev_solid, SOLID_BBOX) // Pra deixar solido de novo
   
   return FMRES_IGNORED
}

public zp_user_infected_post(id) RemoveAllSandbags(id) // Remover os Sacos de Areia Apos a Infecção

public RemoveAllSandbags(i_Owner)
{
   new iEnt = get_maxplayers() + 1, clsname[32];
   while((iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", SANDBAGS_CLASS)))
   {
      if (i_Owner)
      {
         if(pev(iEnt, pev_iuser2) != i_Owner) continue;

         clsname[0] = '^0'
         pev(iEnt, pev_classname, clsname, sizeof(clsname)-1);
                
         if (equali(clsname, SANDBAGS_CLASS)) set_pev(iEnt, pev_flags, FL_KILLME);
      }
      else set_pev( iEnt, pev_flags, FL_KILLME );
   }
}

// Mensagem Colorida (client_printcolor)
stock client_printcolor(const id, const input[], any:...)
{
   new count = 1, players[32]
   static msg[191]
   vformat(msg, 190, input, 3)
   
   replace_all(msg, 190, "!g", "^4")  // Chat Verde
   replace_all(msg, 190, "!y", "^1")  // Chat Normal
   replace_all(msg, 190, "!t", "^3")  // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
   
   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();
         }
      }
   }
}

stock get_user_noclip(index) return (pev(index, pev_movetype) == MOVETYPE_NOCLIP);


Eu tirei a Include desnecessaria (fun) deixei o saco de areia atravessável para humanos, opção remover um saco de areia e remover os sacos da pessoa quando ela for infectada e corrigi uns bugs.


 Zplague12

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
vou testa vlw ai perfect

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
[P]erfec[T] [S]cr[@]s[H] escreveu:
Prontinho Testa ai:

Código:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <  xs >
#include <zombieplague>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{  27.340000,  26.629999,  29.020000 }

#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

#define SANDBAGS_CLASS "amxx_pallets"

new pnumplugin, remove_nrnd, maxpallets, phealth, palletscout = 0;
new g_models[][] = { "models/pallet_with_bags2.mdl", "models/pallet_with_bags.mdl" }

new stuck[33], g_bolsas[33], cvar[3]

new const Float:size[][3] = {
{0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
{0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
{0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
{0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
{0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const g_item_name[] = { "3 Sacos de Areia" }
const g_item_bolsas = 20
new g_itemid_bolsas, ZPSTUCK

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init() 
{
   register_plugin("[ZP] Extra: SandBags", "1.1", "LARP | [P]erfec[T] [S]cr[@]s[H]")
   
   set_task(0.1,"checkstuck",0,"",0,"b")
   
   g_itemid_bolsas = zp_register_extra_item(g_item_name, g_item_bolsas, ZP_TEAM_HUMAN)
   
   ZPSTUCK = register_cvar("zp_pb_stuck","1")
   pnumplugin = register_cvar("zp_pb_enable","1");
   remove_nrnd = register_cvar("zp_pb_nemround","1");
   maxpallets = register_cvar("zp_pb_limit","200"); // max number of pallets with bags
   phealth = register_cvar("zp_pb_health","600"); // set the health to a pallet with bags
   cvar[0] = register_cvar("zp_pb_autounstuck","1")
   cvar[1] = register_cvar("zp_pb_stuckeffects","1")
   cvar[2] = register_cvar("zp_pb_stuckwait","7")
   
   register_event("HLTV","event_newround", "a","1=0", "2=0"); // it's called every on new round

   register_menucmd(register_menuid("\r[\dSacos-De-Areia\r]\w"), 1023, "menu_command" );
   register_clcmd("say /pb","show_the_menu");
   register_clcmd("/pb","show_the_menu");
   
   register_forward(FM_Touch, "fw_Touch")
}


public plugin_precache() for(new i;i < sizeof g_models;i++) engfunc(EngFunc_PrecacheModel,g_models[i]);

public show_the_menu(id,level,cid)
{
   if(!get_pcvar_num(pnumplugin) ||!is_user_alive(id) || zp_get_user_zombie(id)) return PLUGIN_HANDLED;
   
   if (!zp_get_user_zombie(id))
   {      
      new szMenuBody[256], keys;
      
      new nLen = format( szMenuBody, 255, "\r[\dSacos-De-Areia\r]\w Menu Principal:^n^nSaco(s) de Areia Restante(s): \r[\d%i\r]^n", g_bolsas[id] );
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n\r1. \wColocar 1 Saco-De-Areia");
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n\r2. \wRemover um Saco-De-Areia \r[Aponte Com o Mouse]" );
      
      nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\r0. \wSair" );
      
      keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
      
      show_menu( id, keys, szMenuBody, -1 );
      return PLUGIN_HANDLED;
   }
   return PLUGIN_HANDLED;
}


public menu_command(id,key,level,cid)
{
   switch( key )
   {
      case 0: 
      {
         if (is_user_alive(id) && !zp_get_user_zombie(id))
         {
            if ( g_bolsas[id] <= 0 ) {
               client_printcolor(id, "!g[ZP]!y Voce Nao Tem Sacos De Areia")
               return PLUGIN_CONTINUE
            }

            g_bolsas[id] -= 1
            place_palletwbags(id);
            show_the_menu(id,level,cid);
            return PLUGIN_CONTINUE   
         }
         return PLUGIN_CONTINUE   
      }
      
      case 1: deleteItem(id), show_the_menu(id,level,cid); // Remover Saco de Areia
   }
   return PLUGIN_HANDLED;
}

public deleteItem(id) 

   new ent, a_body; get_user_aiming(id, ent, a_body) 
   
   if (!is_user_alive(id) || zp_get_user_zombie(id) || !pev_valid(ent))  return PLUGIN_CONTINUE;
   
   if(pev(ent, pev_iuser2) != id) 
   {
      client_printcolor(id, "!g[ZP]!y Este Saco Nao Eh Seu")
      return PLUGIN_CONTINUE;
   }      
   
   new class[32]; pev(ent, pev_classname, class, 31) 
   if (equal(class, SANDBAGS_CLASS))   
   {
      set_pev(ent, pev_flags, FL_KILLME) 
      palletscout--; g_bolsas[id] += 1
      client_printcolor(id, "!g[ZP]!y Voce Removeu !g1!y Saco de Areia Com Sucesso.")
   }
   return PLUGIN_CONTINUE 


public place_palletwbags(id)
{
   if( palletscout == get_pcvar_num(maxpallets) )
   {
      client_printcolor(id, "!g[ZP]!y Por Seguranca so serao Permitidos !g%d!y Sacos de Areia no Servidor.", get_pcvar_num(maxpallets));
      return PLUGIN_HANDLED;
   }
   
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"));
   set_pev(ent,pev_classname,SANDBAGS_CLASS); engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
   static Float:xorigin[3]; get_user_hitpoint(id,xorigin);

   if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
   {
      client_printcolor(id, "!g[ZP]!y Voce Nao Pode Colocar Sacos de Areia No Ceu");
      return PLUGIN_HANDLED;
   }
   
   // set sizes
   static Float:p_mins[3], Float:p_maxs[3];
   p_mins = PALLET_MINS; p_maxs = PALLET_MAXS;
   engfunc(EngFunc_SetSize, ent, p_mins, p_maxs);
   set_pev(ent, pev_mins, p_mins); set_pev(ent, pev_maxs, p_maxs );
   set_pev(ent, pev_absmin, p_mins); set_pev(ent, pev_absmax, p_maxs );
   
   engfunc(EngFunc_SetOrigin, ent, xorigin);
   
   set_pev(ent, pev_iuser2, id) // o kara q plantou o saco
   set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
   set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff

   new Float:p_cvar_health = get_pcvar_float(phealth);
   switch(p_cvar_health)
   {
      case 0.0 : set_pev(ent,pev_takedamage,DAMAGE_NO);
      
      default: {
         set_pev(ent,pev_health,p_cvar_health);
         set_pev(ent,pev_takedamage,DAMAGE_YES);
      }
   }

   static Float:rvec[3]; pev(id,pev_v_angle,rvec);
   rvec[0] = 0.0; set_pev(ent,pev_angles,rvec);

   fm_drop_to_floor(ent);

   palletscout++;
   
   client_printcolor(id, "!g[ZP]!y Voce Colocou !t1!y Saco de Areia. !t%i!y Sacos de Areia Restante(s)", g_bolsas[id])
   return PLUGIN_HANDLED;
}

stock get_user_hitpoint(id, Float:hOrigin[3]) 
{
   if (!is_user_alive(id) || zp_get_user_zombie(id)) return 0;
   
   new Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3], Float:fTemp[3];
   
   pev(id, pev_origin, fOrigin); pev(id, pev_v_angle, fvAngle); pev(id, pev_view_ofs, fvOffset);
   xs_vec_add(fOrigin, fvOffset, fvOrigin);
   
   engfunc(EngFunc_AngleVectors, fvAngle, feOrigin, fTemp, fTemp);
   
   xs_vec_mul_scalar(feOrigin, 9999.9, feOrigin); xs_vec_add(fvOrigin, feOrigin, feOrigin);
   
   engfunc(EngFunc_TraceLine, fvOrigin, feOrigin, 0, id);
   global_get(glb_trace_endpos, hOrigin);
   
   return 1;


public event_newround() if( get_pcvar_num ( remove_nrnd ) == 1) remove_allpalletswbags();

stock remove_allpalletswbags()
{
   new pallets = -1;
   while((pallets = fm_find_ent_by_class(pallets, SANDBAGS_CLASS))) fm_remove_entity(pallets);
   
   palletscout = 0;
}

public checkstuck()
{
   if (get_pcvar_num(ZPSTUCK))
   {
      static players[32], pnum, player; get_players(players, pnum)
      static Float:origin[3], Float:mins[3], hull, Float:vec[3], o, i
      for(i=0; i<pnum; i++)
      {
         player = players[i]
         if (is_user_connected(player) && is_user_alive(player)) 
         {
            pev(player, pev_origin, origin); hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
            
            if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) 
            {
               ++stuck[player]
               if(stuck[player] >= get_pcvar_num(cvar[2])) 
               {
                  pev(player, pev_mins, mins); vec[2] = origin[2]
                  for (o=0; o < sizeof size; ++o) 
                  {
                     vec[0] = origin[0] - mins[0] * size[o][0]
                     vec[1] = origin[1] - mins[1] * size[o][1]
                     vec[2] = origin[2] - mins[2] * size[o][2]
                     if (is_hull_vacant(vec, hull,player)) 
                     {
                        engfunc(EngFunc_SetOrigin, player, vec)
                        effects(player)
                        set_pev(player,pev_velocity,{0.0,0.0,0.0})
                        o = sizeof size
                     }
                  }
               }
            }
            else stuck[player] = 0
         }
      }
      
   }
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) 
{
   static tr; engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
   if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) return true
   
   return false
}

public effects(id) 
{
   if(get_pcvar_num(cvar[1])) 
   {
      set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
      show_hudmessage(id,"Automatic Unstuck!") // HUDMESSAGE
      message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
      write_short(1<<10)   // fade lasts this long duration
      write_short(1<<10)   // fade lasts this long hold time
      write_short(1<<1)   // fade type (in / out)
      write_byte(20)            // fade red
      write_byte(255)    // fade green
      write_byte(255)        // fade blue
      write_byte(255)    // fade alpha
      message_end()
      client_cmd(id,"spk fvox/blip.wav")
   }
}

public zp_extra_item_selected(player, itemid)
{
   if (itemid == g_itemid_bolsas) 
   {
      g_bolsas[player] += 3
      set_task(0.3,"show_the_menu",player);
      client_printcolor(player, "!g[ZP]!y Voce Comprou !t3 Sacos de Areia")
      client_printcolor(player, "!g[ZP]!y Digite !t/pb!y Para Exibir o Menu")
   }
}

// Bang usado para deixar o saco atravessavel (usado na minha famosa lasermine by: [P]erfec[T])
public fw_Touch(toucher, touched) 
{
   if(!is_user_alive(toucher) || zp_get_user_zombie(toucher) || !pev_valid(touched)) return FMRES_IGNORED;
   
   new classname[32]; pev(touched, pev_classname, classname, 31) 
   
   if(equal(classname, SANDBAGS_CLASS)) 
   {
      set_pev(touched, pev_solid, SOLID_NOT)
      set_task(1.0, "solid_again", touched) // Pra deixar solido de novo
   }
   
   return FMRES_IGNORED 
}

public solid_again(i_Ent) 
{
   if(!pev_valid(i_Ent)) return FMRES_IGNORED; // Evitar Erro de Debug

   new clsname[32]; pev( i_Ent, pev_classname, clsname, 31 );
   if(!equali(clsname, SANDBAGS_CLASS)) return FMRES_IGNORED; // Para Nao bugar em outras entidades

   set_pev(i_Ent, pev_solid, SOLID_BBOX) // Pra deixar solido de novo
   
   return FMRES_IGNORED
}

public zp_user_infected_post(id) RemoveAllSandbags(id) // Remover os Sacos de Areia Apos a Infecção

public RemoveAllSandbags(i_Owner)
{
   new iEnt = get_maxplayers() + 1, clsname[32];
   while((iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", SANDBAGS_CLASS)))
   {
      if (i_Owner)
      {
         if(pev(iEnt, pev_iuser2) != i_Owner) continue;

         clsname[0] = '^0'
         pev(iEnt, pev_classname, clsname, sizeof(clsname)-1);
                
         if (equali(clsname, SANDBAGS_CLASS)) set_pev(iEnt, pev_flags, FL_KILLME);
      }
      else set_pev( iEnt, pev_flags, FL_KILLME );
   }
}

// Mensagem Colorida (client_printcolor)
stock client_printcolor(const id, const input[], any:...)
{
   new count = 1, players[32]
   static msg[191]
   vformat(msg, 190, input, 3)
   
   replace_all(msg, 190, "!g", "^4")  // Chat Verde
   replace_all(msg, 190, "!y", "^1")  // Chat Normal
   replace_all(msg, 190, "!t", "^3")  // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
   
   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();
         }
      }
   }
}

stock get_user_noclip(index) return (pev(index, pev_movetype) == MOVETYPE_NOCLIP);


Eu tirei a Include desnecessaria (fun) deixei o saco de areia atravessável para humanos, opção remover um saco de areia e remover os sacos da pessoa quando ela for infectada e corrigi uns bugs.

vlw ai vo pega o cod para criar minha laser mine

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
Zplague12

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
Zplague16

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
alguem pode me ajuda com esse plugin de sb.


descrição:


O SB MUDA DE COR DE ACORDO COM DANO LEVADO

100% HP = VERDE
050% HP = AMARELO
020% HP = VERMELHO



somente que colocou pode atravessar.

description[ZP] 3 Sacos de Areia EmptyRe: [ZP] 3 Sacos de Areia

more_horiz
privacy_tip Permissões neste sub-fórum
Não podes responder a tópicos
power_settings_newInicie sessão para responder