[Duvida] Limitar itens Extras Hitskin_logo Hitskin.com

Isto é uma pré-visualização de um tema em Hitskin.com
Instalar o temaVoltar para a ficha do tema

Zplague

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

Seu portal de Zombie Plague no Brasil

Zumbis Online

Últimos assuntos

» [ANÚNCIO] Alguem vivo ai?
por Eclipse 17/9/2024, 6:39 pm

» The Fen1xS CLan | Zombie Plague | [XP/LEVELS] #2024
por hevy 5/7/2024, 8:28 pm

»
por Eclipse 29/2/2024, 12:30 am

» [Plugin] /vm Com Status
por Isr7 4/6/2023, 3:24 pm

» Alguém pra manter um servidor comigo?
por Isr7 3/6/2023, 4:52 pm

» Alguém querendo criar um servidor de zp? eu pago a host quem quiser deixar o discord ai Isr7#6920
por Isr7 3/6/2023, 3:18 pm

» PEDIDO: Multijump pros VIP
por Madness 15/3/2023, 3:44 pm

» [ZP] Modo padre para 5.0
por XperitosEspetinho123 15/7/2022, 3:31 pm

» [KZ] Servidores de cs 1.6
por [Dk]Serial-Killer 7/5/2022, 4:12 am

» [PLUGIN BY SKVD & WILLIAN] SHOP DE FANTASIAS
por dushowW 23/7/2020, 5:44 pm

Os membros mais ativos da semana

Nenhum usuário

Frases filosóficas Zplague:

....

Google Adsense

Estatísticas

Os nossos membros postaram um total de 38140 mensagens em 6680 assuntos

Temos 2796 usuários registrados

O último membro registrado é zmplugins - Henrique


4 participantes

    [Duvida] Limitar itens Extras

    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 12:49 am

    Alguem poderia limitar esses intens pra mim, ou fazer um tutorial.


    Esse daqui para comprarem somente 4 vezes
    Código:
    /*
    [ZP] Extra Item: Golden Ak 47
    Team: Humans

    Description: This plugin adds a new weapon for Human Teams.
    Weapon Cost: 30

    Features:
    - This weapon do more damage
    - This weapon has zoom
    - Launch Lasers
    - This weapon has unlimited bullets

    Credits:

    KaOs - For his Dual MP5 mod

    Cvars:


    - zp_goldenak_dmg_multiplier <4> - Damage Multiplier for Golden Ak 47
    - zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
    - zp_goldenak_custom_model <1|0> - Golden ak Custom Model
    - zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip

    */



    #include <amxmodx>
    #include <fakemeta>
    #include <  fun >
    #include <hamsandwich>
    #include <cstrike>
    #include <zombieplague>
    #include <colorchat>


    #define is_valid_player(%1) (1 <= %1 <= 32)

    new AK_V_MODEL[64] = "models/zombie_plague/v_dynamicak_dp.mdl"
    new AK_P_MODEL[64] = "models/zombie_plague/p_dynamicak_dp.mdl"

    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip, cvar_limit

    // Item ID
    new g_itemid

    new bool:g_HasAk[33]
    new g_hasZoom[ 33 ]
    new bullets[ 33 ]

    // Sprite
    new m_spriteTexture

    const Wep_ak47 = ((1<<CSW_AK47))

    public plugin_init()
    {
       
       /* CVARS */
       cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "3.5")
       cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
       cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
       cvar_uclip = register_cvar("zp_goldenak_unlimited_clip", "1")
             cvar_limit = register_cvar("zp_goldenak_limit", "4")
       
       // Register The Plugin
       register_plugin("[ZP] Extra: Golden Ak 47", "1.1", "AlejandroSk")
       // Register Zombie Plague extra item
       g_itemid = zp_register_extra_item("Dynamic AK-47", 60, ZP_TEAM_HUMAN)
       // Death Msg
       register_event("DeathMsg", "Death", "a")
       // Weapon Pick Up
       register_event("WeapPickup","checkModel","b","1=19")
       // Current Weapon Event
       register_event("CurWeapon","checkWeapon","be","1=1")
       register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
       // Ham TakeDamage
       RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
       register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
       register_forward( FM_CmdStart, "fw_CmdStart" )
       RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
       
    }


    public client_connect(id)
    {
       g_HasAk[id] = false
    }

    public client_disconnect(id)
    {
       g_HasAk[id] = false
    }

    public Death()
    {
       g_HasAk[read_data(2)] = false
    }

    public fwHamPlayerSpawnPost(id)
    {
       g_HasAk[id] = false
    }

    public plugin_precache()
    {
       precache_model(AK_V_MODEL)
       precache_model(AK_P_MODEL)
       m_spriteTexture = precache_model("sprites/dot.spr")
       precache_sound("weapons/zoom.wav")
    }

    public zp_user_infected_post(id)
    {
       if (zp_get_user_zombie(id))
       {
          g_HasAk[id] = false
       }
    }

    public checkModel(id)
    {
       if ( zp_get_user_zombie(id) )
          return PLUGIN_HANDLED
       
       new szWeapID = read_data(2)
       
       if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
       {
          set_pev(id, pev_viewmodel2, AK_V_MODEL)
          set_pev(id, pev_weaponmodel2, AK_P_MODEL)
       }
       return PLUGIN_HANDLED
    }

    public checkWeapon(id)
    {
       new plrClip, plrAmmo, plrWeap[32]
       new plrWeapId
       
       plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
       
       if (plrWeapId == CSW_AK47 && g_HasAk[id])
       {
          checkModel(id)
       }
       else
       {
          return PLUGIN_CONTINUE
       }
       
       if (plrClip == 0 && get_pcvar_num(cvar_uclip))
       {
          // If the user is out of ammo..
          get_weaponname(plrWeapId, plrWeap, 31)
          // Get the name of their weapon
          give_item(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
       }
       return PLUGIN_HANDLED
    }



    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
        if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
        {
            SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
        }
    }

    public fw_CmdStart( id, uc_handle, seed )
    {
       if( !is_user_alive( id ) )
          return PLUGIN_HANDLED
       
       if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
       {
          new szClip, szAmmo
          new szWeapID = get_user_weapon( id, szClip, szAmmo )
          
          if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
          {
             g_hasZoom[id] = true
             cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
             emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
          }
          
          else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
          {
             g_hasZoom[ id ] = false
             cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
             
          }
          
       }
       return PLUGIN_HANDLED
    }


    public make_tracer(id)
    {
       if (get_pcvar_num(cvar_goldbullets))
       {
          new clip,ammo
          new wpnid = get_user_weapon(id,clip,ammo)
          new pteam[16]
          
          get_user_team(id, pteam, 15)
          
          if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
          {
             new vec1[3], vec2[3]
             get_user_origin(id, vec1, 1) // origin; your camera point.
             get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
             
             
             //BEAMENTPOINTS
             message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
             write_byte (0)     //TE_BEAMENTPOINTS 0
             write_coord(vec1[0])
             write_coord(vec1[1])
             write_coord(vec1[2])
             write_coord(vec2[0])
             write_coord(vec2[1])
             write_coord(vec2[2])
             write_short( m_spriteTexture )
             write_byte(1) // framestart
             write_byte(5) // framerate
             write_byte(2) // life
             write_byte(10) // width
             write_byte(0) // noise
             write_byte( 0 )     // r, g, b
             write_byte( 206 )       // r, g, b
             write_byte( 209 )       // r, g, b
             write_byte(200) // brightness
             write_byte(150) // speed
             message_end()
          }
       
          bullets[id] = clip
       }
       
    }

    public zp_extra_item_selected(player, itemid)
    {
       if ( itemid == g_itemid )
       {
          if ( user_has_weapon(player, CSW_AK47) )
          {
             drop_prim(player)
          }
          
          else if (limit_count() > get_pcvar_num(cvar_limit))
          {
             client_print(player, print_chat, "!g[ZP] !yJa existem muitas !tDynamic AK-47");
             return ZP_PLUGIN_HANDLED;
          }
          
          give_item(player, "weapon_ak47")
          client_print(player, print_chat, "!g[ZP] !yVoce comprou a !tDynamic AK-47 !g[Dano x3]")
          g_HasAk[player] = true;
       }
       return PLUGIN_CONTINUE
    }


    stock drop_prim(id)
    {
       new weapons[32], num
       get_user_weapons(id, weapons, num)
       for (new i = 0; i < num; i++) {
          if (Wep_ak47 & (1<<weapons[i]))
          {
             static wname[32]
             get_weaponname(weapons[i], wname, sizeof wname - 1)
             engclient_cmd(id, "drop", wname)
    }
    }
    }

    limit_count()
    {
    new i, count = 0;

    for(i = 1; i < 33; i++)
    {
       if(g_HasAk[i])
          count++;
       }
      return count;
     }


    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")  // 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
       replace_all(msg, 190, "!t2", "^0") // 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();
          }
       }
       /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
    */
    }
    /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
    */


    2- nao achei é um plugin de vida com limite.


    3- Limitar para comprarem somente 8 vezes

    Código:
    #include <amxmodx>
    #include <fakemeta>
    #include <zombieplague>

    new const g_item_name[] = { "Municao Infinita" }
    const g_item_cost = 30

    #if cellbits == 32
    const OFFSET_CLIPAMMO = 51
    #else
    const OFFSET_CLIPAMMO = 65
    #endif
    const OFFSET_LINUX_WEAPONS = 4


    new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
             10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

    new g_itemid_infammo, g_has_unlimited_clip[33]
     

    public plugin_init()
    {
       register_plugin("[ZP] Extra: Municao infinita", "1.0", "MeRcyLeZZ")
       
       g_itemid_infammo = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)   
       
       register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
       register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    }

    // Player buys our upgrade, set the unlimited ammo flag
    public zp_extra_item_selected(player, itemid)
    {
       if (itemid == g_itemid_infammo)
          g_has_unlimited_clip[player] = true
    }

    // Reset flags for all players on newround
    public event_round_start()
    {
       for (new id; id <= 32; id++) g_has_unlimited_clip[id] = false;
    }

    // Unlimited clip code
    public message_cur_weapon(msg_id, msg_dest, msg_entity)
    {
       // Player doesn't have the unlimited clip upgrade
       if (!g_has_unlimited_clip[msg_entity])
          return;
       
       // Player not alive or not an active weapon
       if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
          return;
       
       static weapon, clip
       weapon = get_msg_arg_int(2) // get weapon ID
       clip = get_msg_arg_int(3) // get weapon clip
       
       // Unlimited Clip Ammo
       if (MAXCLIP[weapon] > 2) // skip grenades
       {
          set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
          
          if (clip < 2) // refill when clip is nearly empty
          {
             // Get the weapon entity
             static wname[32], weapon_ent
             get_weaponname(weapon, wname, sizeof wname - 1)
             weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
             
             // Set max clip on weapon
             fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
          }
       }
    }

    // Find entity by its owner (from fakemeta_util)
    stock fm_find_ent_by_owner(entity, const classname[], owner)
    {
       while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
       
       return entity;
    }

    // Set Weapon Clip Ammo
    stock fm_set_weapon_ammo(entity, amount)
    {
       set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
    }

    4- Knife blink, Limitar para comprarem somente 7 vezes

    Código:
    #include <amxmodx>
    #include <fakemeta>
    #include <zombieplague>
    #include <chr_engine>
    #include <colorchat>

    #define MIN_DISTANCE 50

    /*================================================================================
     [Plugin Customization]
    =================================================================================*/

    new const g_item_name[] = { "Knife Blink" }
    const g_item_cost = 15
    const g_iMaxDistance = 300;

    /*============================================================================*/

    new Float:g_fSpeed = 1000.0;
    new Float:g_fDelay = 1.0;

    new g_iMaxPlayers;
    new g_iEnemy[33];
    new g_iInBlink[33];
    new Float:g_fLastSlash[33];
    new g_iCanceled[33];
    new g_iSlash[33];
    new g_iBlinks[33];
    new g_itemid_blink;
    new bought_limit[33], cvar_limit_bought

    public plugin_init(){
       
       register_plugin("[ZP] Extra Item: Knife Blink", "1.2", "pharse");
            cvar_limit_bought = register_cvar("zp_knife_limit", "6")
       
       g_iMaxPlayers = get_maxplayers();
       
       g_itemid_blink = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE);
       
       register_forward(FM_TraceLine, "FW_TraceLine_Post", 1);
       register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
       
       register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0")
    }

    // ================================================== //
    //          FORWARDS / EVENTS
    // ================================================== //

    public FW_TraceLine_Post(Float:start[3], Float:end[3], conditions, id, trace){
       
       if (!CHECK_ValidPlayer(id))
          return FMRES_IGNORED;
       
       new iWeaponID = get_user_weapon(id);
       
       if ( iWeaponID != CSW_KNIFE ){
          
          OP_Cancel(id);
          return FMRES_IGNORED;
       }
       
       new enemy = g_iEnemy[id];
       
       if (!enemy){
          
          enemy = get_tr2(trace, TR_pHit);
          
          if ( !CHECK_ValidPlayer(enemy) || zp_get_user_zombie(enemy) ){
             
             OP_Cancel(id);
             return FMRES_IGNORED;
          }
          
          g_iEnemy[id] = enemy;
       }
       
       return FMRES_IGNORED;
    }

    public FW_PlayerPreThink(id){
       
       if (!CHECK_ValidPlayer(id))
          return FMRES_IGNORED;
       
       new iWeaponID = get_user_weapon(id);
       
       if ( iWeaponID != CSW_KNIFE || !zp_get_user_zombie(id) ){
          
          OP_Cancel(id);
          return FMRES_IGNORED;
       }
       
       if ( g_iBlinks[id] == 0 )
          return FMRES_IGNORED;
       
       new button = pev(id,pev_button);
       
       if ( !(button & IN_ATTACK) && !(button & IN_ATTACK2) ){
          
          OP_Cancel(id)
          return FMRES_IGNORED;
       }
       
       if (g_iSlash[id])
          g_iSlash[id] = 0;
       
       OP_NearEnemy(id);
       
       if( g_iInBlink[id] ){
          
          OP_SetBlink(id);
          OP_Blink(id);
          g_iCanceled[id] = 0;
       }

       return FMRES_IGNORED;
    }

    // Player buys our upgrade, add one blink
    public zp_extra_item_selected(player, itemid)
    {
       if (itemid == g_itemid_blink)
       {
          
          g_iBlinks[player] += 1;
          bought_limit[player]++
          client_print(player, print_chat, "[!gZP!y] !yVoce tem agora !g%d !yKnife Blinks", g_iBlinks[player]);
       }
               if(bought_limit[player] >= get_pcvar_num(cvar_limit_bought))
            {
          
             client_print(player, print_chat, "[ZP] Ja compraram muitas knife blinks")
             zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + item_cost)
             return;
       }
    }


    // Reset blinks for all players on newround
    public EVENT_round_start()
    {
       for (new id; id <= 32; id++) g_iBlinks[id] = 0;
    }

    for(new id = 1; id <= get_maxplayers(); id++)
    {
    g_has[id] = false
    bought_limit[id] = 0
    }

    // ================================================== //
    //          OPERATIONS
    // ================================================== //

    public OP_NearEnemy(id){
       
       new enemy = g_iEnemy[id];
       new Float:time = get_gametime();
       
       if (!enemy || g_fLastSlash[id]+g_fDelay>time){
          
          g_iInBlink[id] = 0;
          return;
       }
       
       new origin[3], origin_enemy[3];
       
       get_user_origin(id, origin, 0);
       get_user_origin(enemy, origin_enemy, 0);
       
       new distance = get_distance(origin, origin_enemy);
       
       if ( MIN_DISTANCE<=distance<=g_iMaxDistance){
          
          g_iInBlink[id] = 1;
          return;
          
       }else if (MIN_DISTANCE>distance && g_iInBlink[id])
       {
          OP_Slash(id);
       }
       OP_Cancel(id);
    }

    public OP_Blink(id){
       
       new Float:new_velocity[3];
       new enemy = g_iEnemy[id];
       new Float:origin_enemy[3];
       
       pev(enemy, pev_origin, origin_enemy);
       entity_set_aim(id, origin_enemy);
       
       get_speed_vector2(id, enemy, g_fSpeed, new_velocity)
       set_pev(id, pev_velocity, new_velocity);
    }

    public OP_Cancel(id){
       
       g_iInBlink[id] = 0;
       g_iEnemy[id] = 0;
       if (!g_iCanceled[id]){
          
          OP_SetBlink(id);
          g_iCanceled[id] = 1;
       }
    }

    public OP_Slash(id){
       
       set_pev(id, pev_velocity, {0.0,0.0,0.0});      // stop player's blink
       
       new weaponID = get_user_weapon(id, _, _);
       
       if(weaponID == CSW_KNIFE){
          
          new weapon[32]
          
          get_weaponname(weaponID,weapon,31)
          
          new ent = fm_find_ent_by_owner(-1,weapon,id)
          
          if(ent){
             
             set_pdata_float(ent,46, 0.0);
             set_pdata_float(ent,47, 0.0);
             g_iSlash[id] = 1;
             g_fLastSlash[id] = get_gametime();
             g_iBlinks[id] -= 1;
             new name[32];
             get_user_name(id,name,31)
             client_print(0, print_chat, "[!gZP!y] !g%s !yUsou Knife Blink!", name);
             client_print(id, print_chat, "[!gZP!y] !g%d Knife Blinks restante.", g_iBlinks[id]);
          }
       }  
    }

    public OP_SetBlink(id){
       
       new blink = g_iInBlink[id];
       
       if (blink>1)
          return;
       
       if (blink)
          g_iInBlink[id] += 1;
    }

    // ================================================== //
    //          CHECKS
    // ================================================== //

    public CHECK_ValidPlayer(id){
       
       if (1<=id<=g_iMaxPlayers && is_user_alive(id))
          return 1;
       
       return 0;
    }

    // from fakemeta_util.inc
    stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
       new strtype[11] = "classname", ent = index;
       switch (jghgtype) {
          case 1: strtype = "target";
          case 2: strtype = "targetname";
       }

       while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}

       return ent;
    }


    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")  // 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
       replace_all(msg, 190, "!t2", "^0") // 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();
          }
       }
       /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
    */
    }



    5- Granada de alucinação, limitar para comprarem somente 7 vezes

    Código:
    #include <amxmodx>
    #include <fakemeta>
    #include <    fun >
    #include <hamsandwich>
    #include <cstrike>
    #include <zombieplague>

    #define is_valid_player(%1) (1 <= %1 <= 32)
    #define ITEM_COST 50

    new AK_V_MODEL[64] = "models/zombie_plague/v_golden_ak47.mdl"
    new AK_P_MODEL[64] = "models/zombie_plague/p_golden_ak47.mdl"

    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip, cvar_limit

    // Item ID
    new g_itemid

    new bool:g_HasAk[33]

    new g_hasZoom[ 33 ]
    new bullets[ 33 ]

    // Sprite
    new m_spriteTexture

    const Wep_ak47 = ((1<<CSW_AK47))

    public plugin_init()
    {
      
       /* CVARS */
       cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "12")
       cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
       cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
       cvar_uclip = register_cvar("zp_goldenak_unlimited_clip", "1")
       cvar_limit = register_cvar("zp_goldenak_limit", "4")
      
       // Register The Plugin
       register_plugin("[ZP] Extra: Golden Ak 47 ", "1.1", "AlejandroSk")
       // Register Zombie Plague extra item
       g_itemid = zp_register_extra_item("Dynamic AK-47", ITEM_COST, ZP_TEAM_HUMAN)
       // Death Msg
       register_event("DeathMsg", "Death", "a")
       // Weapon Pick Up
       register_event("WeapPickup","checkModel","b","1=19")
       // Current Weapon Event
       register_event("CurWeapon","checkWeapon","be","1=1")
       register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
       // Ham TakeDamage
       RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
       register_forward( FM_CmdStart, "fw_CmdStart" )
       RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
      
    }

    public client_connect(id)
    {
       g_HasAk[id] = false
    }

    public client_disconnect(id)
    {
       g_HasAk[id] = false
    }

    public Death()
    {
       g_HasAk[read_data(2)] = false
    }

    public fwHamPlayerSpawnPost(id)
    {
       g_HasAk[id] = false
    }

    public plugin_precache()
    {
       precache_model(AK_V_MODEL)
       precache_model(AK_P_MODEL)
       m_spriteTexture = precache_model("sprites/dot.spr")
       precache_sound("weapons/zoom.wav")
    }

    public zp_user_infected_post(id)
    {
       if (zp_get_user_zombie(id))
       {
          g_HasAk[id] = false
       }
    }

    public checkModel(id)
    {
       if ( zp_get_user_zombie(id) )
          return PLUGIN_HANDLED
      
       new szWeapID = read_data(2)
      
       if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
       {
          set_pev(id, pev_viewmodel2, AK_V_MODEL)
          set_pev(id, pev_weaponmodel2, AK_P_MODEL)
       }
       return PLUGIN_HANDLED
    }

    public checkWeapon(id)
    {
       new plrClip, plrAmmo, plrWeap[32]
       new plrWeapId
      
       plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
      
       if (plrWeapId == CSW_AK47 && g_HasAk[id])
       {
          checkModel(id)
       }
       else
       {
          return PLUGIN_CONTINUE
       }
      
       if (plrClip == 0 && get_pcvar_num(cvar_uclip))
       {
          // If the user is out of ammo..
          get_weaponname(plrWeapId, plrWeap, 31)
          // Get the name of their weapon
          give_item(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
       }
       return PLUGIN_HANDLED
    }



    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
        if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
        {
            SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
        }
    }

    public fw_CmdStart( id, uc_handle, seed )
    {
       if( !is_user_alive( id ) )
          return PLUGIN_HANDLED
      
       if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
       {
          new szClip, szAmmo
          new szWeapID = get_user_weapon( id, szClip, szAmmo )
          
          if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
          {
             g_hasZoom[id] = true
             cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
             emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
          }
          
          else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
          {
             g_hasZoom[ id ] = false
             cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
            
          }
          
       }
       return PLUGIN_HANDLED
    }


    public make_tracer(id)
    {
       if (get_pcvar_num(cvar_goldbullets))
       {
          new clip,ammo
          new wpnid = get_user_weapon(id,clip,ammo)
          new pteam[16]
          
          get_user_team(id, pteam, 15)
          
          if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
          {
             new vec1[3], vec2[3]
             get_user_origin(id, vec1, 1) // origin; your camera point.
             get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
            
            
             //BEAMENTPOINTS
             message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
             write_byte (0)    
             write_coord(vec1[0])
             write_coord(vec1[1])
             write_coord(vec1[2])
             write_coord(vec2[0])
             write_coord(vec2[1])
             write_coord(vec2[2])
             write_short( m_spriteTexture )
             write_byte(1) // framestart
             write_byte(5) // framerate
             write_byte(2) // life
             write_byte(10) // width
             write_byte(0) // noise
             write_byte( 0 )     // r, g, b
             write_byte( 206 )       // r, g, b
             write_byte( 209 )       // r, g, b
             write_byte(200) // brightness
             write_byte(150) // speed
             message_end()
          }
      
          bullets[id] = clip
       }
      
    }

    public zp_extra_item_selected(player, itemid)
    {
       if ( itemid == g_itemid )
       {
          if ( user_has_weapon(player, CSW_AK47) )
          {
             drop_prim(player)
          }
          else if (limit_count() > get_pcvar_num(cvar_limit))
          {
             client_print(player, print_chat, "!g[ZP] !yJa existem muitas !tDynamic-AK47");
             return ZP_PLUGIN_HANDLED;
          }
          give_item(player, "weapon_ak47")
          client_print(player, print_chat, "!g[ZP] !yVoce comprou uma !tDynamic AK 47 New !g[Dano x3]")
          g_HasAk[player] = true;
       }
       return PLUGIN_CONTINUE
    }

    stock drop_prim(id)
    {
       new weapons[32], num
       get_user_weapons(id, weapons, num)
       for (new i = 0; i < num; i++) {
          if (Wep_ak47 & (1<<weapons[i]))
          {
             static wname[32]
             get_weaponname(weapons[i], wname, sizeof wname - 1)
             engclient_cmd(id, "drop", wname)
          }
       }
    }

    limit_count()
    {
    new i, count = 0;

    for(i = 1; i < 33; i++)
    {
       if(g_HasAk[i])
          count++;
         }
        
         }
      
    Leozinho
    Leozinho
    Administrador


    Masculino Número de Mensagens : 2865
    Ammo Packs : 5412
    Honra : 75
    Data de inscrição : 20/11/2011

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Leozinho 2/1/2014, 2:33 am

    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 6:53 am

    Tem alguns plugins que não se acha o has.
    Ate agora nenhum foi ...
    waLLzyk
    waLLzyk
    Designer


    Nick : zetequila
    Masculino Número de Mensagens : 484
    Ammo Packs : 4482
    Honra : 56
    Data de inscrição : 22/05/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por waLLzyk 2/1/2014, 12:57 pm

    Knife blink que editei, ta com limite de compra de 8 vezes por player link: 
    [url=Blog Bloqueado.com.br/2013/10/zp-knife-blink_3.html]http://goo.gl/k65LkP[/url]


    Vida Extra tenho achei uma que o perfect edito: 
    Código:
    #include <amxmodx>
    #include <    fun >
    #include <zombieplague>
    #include <cstrike>

    #define ITEM_COST 20

    new const item_name[] = "Vida extra"
    new g_itemid_buyhp
    new hpamount_z, hpamount_h, cvar_maxhp_h, cvar_maxhp_z

    new g_fire
    new const heal_effect[] = "cso/zm_heal.wav"
    new const human_buy[] = "cso/hm_heal.wav"

    public plugin_precache()
    {
       g_fire = precache_model("sprites/vida_sprits.spr")
       precache_sound(heal_effect)
       precache_sound(human_buy)
    }

    public plugin_init()
    {
       register_plugin("[ZP] Extra Item: Vida extra", "1.0", "[P]erfec[T] [S]cr[@]s[H] | Extra Vida")
       hpamount_z = register_cvar("zp_buyhp_zombie", "5000")
       hpamount_h = register_cvar("zp_buyhp_human", "700")
       cvar_maxhp_h = register_cvar("zp_hp_human_limit", "1400")
       cvar_maxhp_z = register_cvar("zp_hp_zombie_limit", "10000")
       g_itemid_buyhp = zp_register_extra_item(item_name, ITEM_COST, ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
    }

    public onHealth()
    {
       new victim=read_data(2)
      
      new CsTeams:team=cs_get_user_team(victim)
       if(team==CS_TEAM_T)
       {
          set_task(3.0,"fire",victim)
      }
    }

    fire_zombie(origin[3])
    {
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    write_byte(TE_SPRITE)
    write_coord(origin[0])
    write_coord(origin[1])
    write_coord(origin[2]+=30)
    write_short(g_fire)
    write_byte(8)
    write_byte(255)
    message_end()
    }

    public fire(victim)
    {
    new origin[3]
    get_user_origin(victim,origin)

    fire_zombie(origin)
    }

    public zp_extra_item_selected(id,itemid)
    {
       //if (!is_user_alive(id))
       //return PLUGIN_HANDLED;
      
      if (itemid==g_itemid_buyhp)
       {
          if (zp_get_user_zombie(id))
          {
             if(get_user_health(id) >= get_pcvar_num(cvar_maxhp_z))
             {
                client_printcolor(id, "!g[ZP]!t Voce nao pode ter mais de !g%d!t de HP", get_pcvar_num(cvar_maxhp_z))
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ITEM_COST)
                return;
             }
             else
             {
                set_user_health(id, get_user_health(id) + get_pcvar_num(hpamount_z));
                client_printcolor(id,"!g[ZP]!t Voce comprou !g%d!t de HP!", get_pcvar_num(hpamount_z) );
                emit_sound(id, CHAN_ITEM, heal_effect, 0.6, ATTN_NORM, 0, PITCH_NORM)
                fire(id);
             }
          }
          if (!zp_get_user_zombie(id))
          {
             if(get_user_health(id) >= get_pcvar_num(cvar_maxhp_h))
             {
                client_printcolor(id, "!g[ZP]!t Voce nao pode ter mais de !g%d!t de HP", get_pcvar_num(cvar_maxhp_h))
                zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ITEM_COST)
                return;
             }
             else
             {
                set_user_health(id, get_user_health(id) + get_pcvar_num(hpamount_h));
                client_printcolor(id,"!g[ZP]!t Voce comprou !g%d!t de HP!", get_pcvar_num(hpamount_h))
                emit_sound(id, CHAN_ITEM, human_buy, 0.6, ATTN_NORM, 0, PITCH_NORM)
             }
          }
       }
    }

    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") // Green Color
       replace_all(msg, 190, "!y", "^1") // Default Color
       replace_all(msg, 190, "!t", "^3") // Team Color
       replace_all(msg, 190, "!t2", "^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();
             }
          }
       }
    }
    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 2:11 pm

    Esse blog ai ta bloqueado.
    waLLzyk
    waLLzyk
    Designer


    Nick : zetequila
    Masculino Número de Mensagens : 484
    Ammo Packs : 4482
    Honra : 56
    Data de inscrição : 22/05/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por waLLzyk 2/1/2014, 4:49 pm

    [D]etonado[R] escreveu:Esse blog ai ta bloqueado.

    Aqui: http://www.mediafire.com/download/dqcs17bslybqd54/Knife_blink.rar
    Leozinho
    Leozinho
    Administrador


    Masculino Número de Mensagens : 2865
    Ammo Packs : 5412
    Honra : 75
    Data de inscrição : 20/11/2011

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Leozinho 2/1/2014, 5:03 pm

    Aqui a munição infinita. A granada de alucinação posta ela ai, ali esta a ak47 golden

    Código:
    #include <amxmodx>
    #include <fakemeta>
    #include <zombieplague>

    new const g_item_name[] = { "Municao Infinita" }
    const g_item_cost = 30

    #if cellbits == 32
    const OFFSET_CLIPAMMO = 51
    #else
    const OFFSET_CLIPAMMO = 65
    #endif
    const OFFSET_LINUX_WEAPONS = 4


    new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
             10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

    new g_itemid_infammo, g_has_unlimited_clip[33]
    new g_compras = 0
     

    public plugin_init()
    {
       register_plugin("[ZP] Extra: Municao infinita", "1.0", "MeRcyLeZZ")
      
      g_itemid_infammo = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)  
     
      register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
       register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
    }

    // Player buys our upgrade, set the unlimited ammo flag
    public zp_extra_item_selected(player, itemid)
    {
     if(g_compras >= 8)
     {
     client_print(player, print_chat, "Ja compraram muitas vezes nesse round.")
     
    return PLUGIN_HANDLED
     }
     else if (itemid == g_itemid_infammo)
     {
     g_has_unlimited_clip[player] = true
     g_compras++
     }
     return PLUGIN_CONTINUE
    }

    // Reset flags for all players on newround
    public event_round_start()
    {
     for (new id; id <= 32; id++)
     {
     g_has_unlimited_clip[id] = false;
     g_compras = 0
     }
    }

    // Unlimited clip code
    public message_cur_weapon(msg_id, msg_dest, msg_entity)
    {
       // Player doesn't have the unlimited clip upgrade
       if (!g_has_unlimited_clip[msg_entity])
          return;
      
      // Player not alive or not an active weapon
       if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
          return;
      
      static weapon, clip
       weapon = get_msg_arg_int(2) // get weapon ID
       clip = get_msg_arg_int(3) // get weapon clip
      
      // Unlimited Clip Ammo
       if (MAXCLIP[weapon] > 2) // skip grenades
       {
          set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
          
          if (clip < 2) // refill when clip is nearly empty
          {
             // Get the weapon entity
             static wname[32], weapon_ent
             get_weaponname(weapon, wname, sizeof wname - 1)
             weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
            
            // Set max clip on weapon
             fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
          }
       }
    }

    // Find entity by its owner (from fakemeta_util)
    stock fm_find_ent_by_owner(entity, const classname[], owner)
    {
       while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
      
      return entity;
    }

    // Set Weapon Clip Ammo
    stock fm_set_weapon_ammo(entity, amount)
    {
       set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
    }

    Knife Blink
    Código:
    #include <amxmodx>
    #include <fakemeta>
    #include <zombieplague>
    #include <chr_engine>
    #include <colorchat>

    #define MIN_DISTANCE 50

    /*================================================================================
     [Plugin Customization]
    =================================================================================*/

    new const g_item_name[] = { "Knife Blink" }
    const g_item_cost = 15
    const g_iMaxDistance = 300;

    /*============================================================================*/

    new Float:g_fSpeed = 1000.0;
    new Float:g_fDelay = 1.0;

    new g_iMaxPlayers;
    new g_iEnemy[33];
    new g_iInBlink[33];
    new Float:g_fLastSlash[33];
    new g_iCanceled[33];
    new g_iSlash[33];
    new g_iBlinks[33];
    new g_itemid_blink;
    new bought_limit, cvar_limit_bought

    public plugin_init()
    {  
    register_plugin("[ZP] Extra Item: Knife Blink", "1.2", "pharse");
     
    cvar_limit_bought = register_cvar("zp_knife_limit", "6")
      
    g_iMaxPlayers = get_maxplayers();
      
    g_itemid_blink = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE);
      
    register_forward(FM_TraceLine, "FW_TraceLine_Post", 1);
     register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
      
    register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0")
    }

    // ================================================== //
    //          FORWARDS / EVENTS
    // ================================================== //

    public FW_TraceLine_Post(Float:start[3], Float:end[3], conditions, id, trace){
      
      if (!CHECK_ValidPlayer(id))
          return FMRES_IGNORED;
      
      new iWeaponID = get_user_weapon(id);
      
      if ( iWeaponID != CSW_KNIFE ){
          
          OP_Cancel(id);
          return FMRES_IGNORED;
       }
      
      new enemy = g_iEnemy[id];
      
      if (!enemy){
          
          enemy = get_tr2(trace, TR_pHit);
          
          if ( !CHECK_ValidPlayer(enemy) || zp_get_user_zombie(enemy) ){
            
            OP_Cancel(id);
             return FMRES_IGNORED;
          }
          
          g_iEnemy[id] = enemy;
       }
      
      return FMRES_IGNORED;
    }

    public FW_PlayerPreThink(id){
      
      if (!CHECK_ValidPlayer(id))
          return FMRES_IGNORED;
      
      new iWeaponID = get_user_weapon(id);
      
      if ( iWeaponID != CSW_KNIFE || !zp_get_user_zombie(id) ){
          
          OP_Cancel(id);
          return FMRES_IGNORED;
       }
      
      if ( g_iBlinks[id] == 0 )
          return FMRES_IGNORED;
      
      new button = pev(id,pev_button);
      
      if ( !(button & IN_ATTACK) && !(button & IN_ATTACK2) ){
          
          OP_Cancel(id)
          return FMRES_IGNORED;
       }
      
      if (g_iSlash[id])
          g_iSlash[id] = 0;
      
      OP_NearEnemy(id);
      
      if( g_iInBlink[id] ){
          
          OP_SetBlink(id);
          OP_Blink(id);
          g_iCanceled[id] = 0;
       }

       return FMRES_IGNORED;
    }

    // Player buys our upgrade, add one blink
    public zp_extra_item_selected(player, itemid)
    {
     if (itemid == g_itemid_blink)
     {
     g_iBlinks[player] += 1;
     bought_limit++
     client_print(player, print_chat, "[!gZP!y] !yVoce tem agora !g%d !yKnife Blinks", g_iBlinks[player]);
     }
             else if(bought_limit >= get_pcvar_num(cvar_limit_bought))
     {
     client_print(player, print_chat, "[ZP] Ja compraram muitas knife blinks")
     //zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + g_item_cost)
     return PLUGIN_HANDLED
     }
     return PLUGIN_CONTINUE
    }


    // Reset blinks for all players on newround
    public EVENT_round_start()
    {
     for (new id; id <= get_maxplayers(); id++)
    {
     g_iBlinks[id] = 0;
     bought_limit = 0
     }
    }
    // ================================================== //
    //          OPERATIONS
    // ================================================== //

    public OP_NearEnemy(id){
      
      new enemy = g_iEnemy[id];
       new Float:time = get_gametime();
      
      if (!enemy || g_fLastSlash[id]+g_fDelay>time){
          
          g_iInBlink[id] = 0;
          return;
       }
      
      new origin[3], origin_enemy[3];
      
      get_user_origin(id, origin, 0);
       get_user_origin(enemy, origin_enemy, 0);
      
      new distance = get_distance(origin, origin_enemy);
      
      if ( MIN_DISTANCE<=distance<=g_iMaxDistance){
          
          g_iInBlink[id] = 1;
          return;
          
       }else if (MIN_DISTANCE>distance && g_iInBlink[id])
       {
          OP_Slash(id);
       }
       OP_Cancel(id);
    }

    public OP_Blink(id){
      
      new Float:new_velocity[3];
       new enemy = g_iEnemy[id];
       new Float:origin_enemy[3];
      
      pev(enemy, pev_origin, origin_enemy);
       entity_set_aim(id, origin_enemy);
      
      get_speed_vector2(id, enemy, g_fSpeed, new_velocity)
       set_pev(id, pev_velocity, new_velocity);
    }

    public OP_Cancel(id){
      
      g_iInBlink[id] = 0;
       g_iEnemy[id] = 0;
       if (!g_iCanceled[id]){
          
          OP_SetBlink(id);
          g_iCanceled[id] = 1;
       }
    }

    public OP_Slash(id){
      
      set_pev(id, pev_velocity, {0.0,0.0,0.0});      // stop player's blink
      
      new weaponID = get_user_weapon(id, _, _);
      
      if(weaponID == CSW_KNIFE){
          
          new weapon[32]
          
          get_weaponname(weaponID,weapon,31)
          
          new ent = fm_find_ent_by_owner(-1,weapon,id)
          
          if(ent){
            
            set_pdata_float(ent,46, 0.0);
             set_pdata_float(ent,47, 0.0);
             g_iSlash[id] = 1;
             g_fLastSlash[id] = get_gametime();
             g_iBlinks[id] -= 1;
             new name[32];
             get_user_name(id,name,31)
             client_print(0, print_chat, "[!gZP!y] !g%s !yUsou Knife Blink!", name);
             client_print(id, print_chat, "[!gZP!y] !g%d Knife Blinks restante.", g_iBlinks[id]);
          }
       }  
    }

    public OP_SetBlink(id){
      
      new blink = g_iInBlink[id];
      
      if (blink>1)
          return;
      
      if (blink)
          g_iInBlink[id] += 1;
    }

    // ================================================== //
    //          CHECKS
    // ================================================== //

    public CHECK_ValidPlayer(id){
      
      if (1<=id<=g_iMaxPlayers && is_user_alive(id))
          return 1;
      
      return 0;
    }

    // from fakemeta_util.inc
    stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
       new strtype[11] = "classname", ent = index;
       switch (jghgtype) {
          case 1: strtype = "target";
          case 2: strtype = "targetname";
       }

       while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}

       return ent;
    }


    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")  // 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
       replace_all(msg, 190, "!t2", "^0") // 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();
          }
       }
       /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
    */
    }
    Lucasx2020
    Lucasx2020
    Humano


    Masculino Número de Mensagens : 13
    Ammo Packs : 3976
    Honra : -3
    Data de inscrição : 01/01/2014

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Lucasx2020 2/1/2014, 6:05 pm

    Tá ai a granada de alucinaçao com limite

    Código:
    #include <   amxmodx >
    #include <   fakemeta >
    #include <   hamsandwich >
    #include <   fun >
    #include <   zombieplague >

    // Plugin version
    #define VERSION "1.4"

    // Defines
    #define MAXPLAYERS 32
    #define FCVAR_FLAGS ( FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED )
    #define OFFSET_PLAYER 41
    #define OFFSET_ACTIVE 373
    #define LINUX_DIFF 5
    #define NADE_TYPE_CONC 7000
    #define FFADE_IN 0x0000
    #define REPEAT 0.2 // Time when next screen fade/shake message is being sent
    #define TASK_AFFECT 666
    #define ID_AFFECT ( taskid - TASK_AFFECT )
    #define OFFSET_FLAMMO 387

    // Grenade cost
    #define GRENADE_COST 70

    // Grenade models
    new const grenade_model_p [ ] = "models/p_grenade_conc.mdl"
    new const grenade_model [ ] = "models/v_grenade_conc.mdl"
    new const grenade_model_w [ ] = "models/w_grenade_conc.mdl"

    new bought_limit[33], cvar_limit_bought

    // Sounds
    new const explosion_sound [ ] = "zombie_plague/concgren_blast1.wav"
    new const purchase_sound [ ] = "items/gunpickup2.wav"
    new const purchase_sound2 [ ] = "items/9mmclip1.wav"

    // Cached sprite indexes
    new m_iTrail, m_iRing

    // Item ID
    new g_conc

    // Player variables
    new g_NadeCount [ MAXPLAYERS+1 ]

    // Message ID's
    new g_msgScreenFade, g_msgScreenShake, g_msgAmmoPickup

    // CVAR pointers
    new cvar_nade_radius, cvar_duration

    // Precache
    public plugin_precache ( )
    {
     // Precache grenade models
     precache_model ( grenade_model_p )
     precache_model ( grenade_model )
     precache_model ( grenade_model_w )
     
    // Precache sounds
     precache_sound ( explosion_sound )
     precache_sound ( purchase_sound )
     precache_sound ( purchase_sound2 )
     
    // Precache sprites
     m_iRing = precache_model ( "sprites/shockwave.spr" )
     m_iTrail = precache_model ( "sprites/laserbeam.spr" )
    }

    // Plugin initialization
    public plugin_init ( )
    {
     // New plugin
     register_plugin ( "[ZP] Extra Item: Concussion Grenade", VERSION, "NiHiLaNTh" )
     
    // Add cvar to detect servers with this plugin
     register_cvar ( "zp_concgren_version", VERSION, FCVAR_FLAGS )
     
    // New extra item
     g_conc = zp_register_extra_item ( "Granada de Alucinacao", GRENADE_COST, ZP_TEAM_ZOMBIE )
     
    // Events
     register_event ( "HLTV", "Event_NewRound", "a", "1=0", "2=0" )
     register_event ( "DeathMsg", "Event_DeathMsg", "a" )
     register_event ( "CurWeapon", "Event_CurrentWeapon", "be", "1=1", "2=25" )
     
    // Forwards
     register_forward ( FM_SetModel, "fw_SetModel" )
     RegisterHam ( Ham_Think, "grenade", "fw_ThinkGrenade" )
     register_forward ( FM_CmdStart, "fw_CmdStart" )
     

    // CVARs
     cvar_nade_radius = register_cvar ( "zp_conc_nade_radius", "500" )
     cvar_duration = register_cvar ( "zp_conc_nade_duration", "7" )
     cvar_limit_bought = register_cvar("zp_alucinacao_bomb_limit", "6")
     
    // Messages
     g_msgScreenShake = get_user_msgid ( "ScreenShake" )
     g_msgScreenFade = get_user_msgid ( "ScreenFade" )
     g_msgAmmoPickup = get_user_msgid ( "AmmoPickup" )
    }

    // Someone decided to buy our an extra item
    public zp_extra_item_selected ( Player, Item )
    {
     if(bought_limit[ Player ] >= get_pcvar_num(cvar_limit_bought))
     {
     client_print( Player, print_chat, "[ZP] Ja tacaram muitas bombas antidotos e nao podera atacar mais")                                   
     zp_set_user_ammo_packs( Player, zp_get_user_ammo_packs( Player) + GRENADE_COST)
     
    }
     // This is our grenade
     if ( Item == g_conc )
     {
     // Player already have it
     if ( g_NadeCount [ Player ] >= 1 )
     {
     // Increase nade count
     g_NadeCount [ Player ]++
     
    // Increase bp ammo
     set_pdata_int ( Player, OFFSET_FLAMMO, get_pdata_int ( Player, OFFSET_FLAMMO, LINUX_DIFF )+1, LINUX_DIFF )
     
    // Ammo pickup
     message_begin ( MSG_ONE, g_msgAmmoPickup, _, Player )
     write_byte ( 11 ) // Ammo ID
     write_byte ( 1 ) // Ammo amount
     message_end ( )
     
    // Emit sound
     emit_sound ( Player, CHAN_WEAPON, purchase_sound2, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
     }
     else // 0 grenades
     {
     // Increase nade count
     g_NadeCount [ Player ] = 1
     bought_limit[ Player ]++
     // Give him flashbang
     give_item ( Player, "weapon_flashbang" )
     
    // Play purchase sound
     client_cmd ( Player, "spk %s", purchase_sound )
    }
     }
     return PLUGIN_CONTINUE
    }
     
    // Someone was infected
    public zp_user_infected_post ( Player, Infector )
    {
     // We were affected by concussion grenade
     if ( task_exists ( Player+TASK_AFFECT ) )
     remove_task ( Player+TASK_AFFECT )
    }

    // Someone were turned back to human
    public zp_user_humanized_post ( Player, Survivor )
    {
     // We dont' have nade anymore
     if ( g_NadeCount [ Player ] )
     {
     g_NadeCount [ Player ] = 0
     }
    }

    // New round started
    public Event_NewRound ( )
    {
     // Reset nade count
     arrayset ( g_NadeCount, false, 33 )
     
    // And they aren't affected by conc.grenade
     remove_task ( TASK_AFFECT )
    }

    // Someone died
    public Event_DeathMsg ( )
    {
     // Get victim
     new victim = read_data ( 2 )
     
    // Some people had error without this check
     if ( !is_user_connected ( victim ) )
     return 
     
    // Remove hallucinations
     remove_task ( victim+TASK_AFFECT )
     
    // Reset nade count
    g_NadeCount [ victim ] = 0
    }

    // Current weapon player is holding
    public Event_CurrentWeapon ( Player )
    {
     // Dead or not zombie or don't have conc. grenade
     if ( !is_user_alive ( Player ) || !zp_get_user_zombie ( Player ) || g_NadeCount [ Player ] <= 0 )
     return PLUGIN_CONTINUE
     
    // Replace flashbang model with our ones
     set_pev ( Player, pev_viewmodel2, grenade_model )
     set_pev ( Player, pev_weaponmodel2, grenade_model_p )
     
    return PLUGIN_CONTINUE
    }

    // Set model
    public fw_SetModel ( Entity, const Model [ ] )
    {
     // Prevent invalid ent messages
     if ( !pev_valid ( Entity ) )
     return FMRES_IGNORED
     
    // Grenade not thrown yet
    if ( pev ( Entity, pev_dmgtime ) == 0.0 )
     return FMRES_IGNORED
     
    // We are throwing concussion grenade
    if ( g_NadeCount [ pev ( Entity, pev_owner ) ] >= 1 && equal ( Model [7 ], "w_fl", 4 ) )
     {
     //Draw trail
     message_begin ( MSG_BROADCAST, SVC_TEMPENTITY )
     write_byte ( TE_BEAMFOLLOW ) // Temp entity ID
     write_short ( Entity ) // Entity to follow
     write_short ( m_iTrail ) // Sprite index
     write_byte ( 10 ) // Life
     write_byte ( 10 ) // Line width
     write_byte ( 255 ) // Red amount
     write_byte ( 255 ) // Blue amount
     write_byte ( 0 ) // Blue amount
     write_byte ( 255 ) // Alpha
     message_end ( )
     
    // Set grenade entity
     set_pev ( Entity, pev_flTimeStepSound, NADE_TYPE_CONC )
     
    // Decrease nade count
     g_NadeCount [ pev ( Entity, pev_owner ) ]--
     
    // Set world model
     engfunc ( EngFunc_SetModel, Entity, grenade_model_w )
     return FMRES_SUPERCEDE
     }
     return FMRES_IGNORED
    }

    // Grenade is getting to explode
    public fw_ThinkGrenade ( Entity )
    {
     // Prevent invalid ent messages
     if ( !pev_valid ( Entity ) )
     return HAM_IGNORED
     
    // Get damage time
     static Float:dmg_time
     pev ( Entity, pev_dmgtime, dmg_time )
     
    // maybe it is time to go off
     if ( dmg_time > get_gametime ( ) )
     return HAM_IGNORED
     
    // Our grenade
    if ( pev ( Entity, pev_flTimeStepSound ) == NADE_TYPE_CONC )
     {
     // Force to explode
     concussion_explode ( Entity )
     return HAM_SUPERCEDE
     }
     return HAM_IGNORED
    }

    // Command start
    public fw_CmdStart ( Player, UC_Handle, Seed )
    {
     // Dead, zombie or not affected
     if ( !is_user_alive ( Player ) || zp_get_user_zombie ( Player ) || !task_exists ( Player+TASK_AFFECT ) )
     return FMRES_IGNORED
     
    // Get buttons
     new buttons = get_uc ( UC_Handle, UC_Buttons )
     
    // We are firing
     if ( buttons & IN_ATTACK )
     {
     // We are holding an active weapon
     if ( get_pdata_cbase ( Player, OFFSET_ACTIVE, LINUX_DIFF ) )
     {
     // New recoil
     set_pev ( Player, pev_punchangle, Float:{3.0, 3.0, 4.0} )
     }
     }
     return FMRES_HANDLED
    }
     

    // Grenade explode
    public concussion_explode ( Entity )
    {
     // Invalid entity ?
     if ( !pev_valid ( Entity  ) )
     return
     
    // Get entities origin
     static Float:origin [ 3 ]
     pev ( Entity, pev_origin, origin )
     
    // Draw ring
     UTIL_DrawRing (origin )
     
    // Explosion sound
     emit_sound ( Entity, CHAN_WEAPON, explosion_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
     
    // Collisions
     static victim 
     victim = -1
     
    // Find radius
     static Float:radius
     radius = get_pcvar_float ( cvar_nade_radius )
     
    // Find all players in a radius
     while ( ( victim = engfunc ( EngFunc_FindEntityInSphere, victim, origin, radius ) ) != 0 )
     {
     // Dead or zombie
     if ( !is_user_alive ( victim ) || zp_get_user_zombie ( victim ) )
     continue
     
    // Victim isn't affected yet
    if ( !task_exists ( victim+TASK_AFFECT ) ) 
     {
     // Get duration
     new duration = get_pcvar_num ( cvar_duration )
     
    // Calculate affect times
     new affect_count = floatround ( duration / REPEAT )
     
    // Continiously affect them
     set_task ( REPEAT, "affect_victim", victim+TASK_AFFECT, _, _, "a", affect_count )
     }
     }
     
    // Remove entity from ground
     engfunc ( EngFunc_RemoveEntity, Entity )
    }

    // We are going to affect you
    public affect_victim ( taskid )
    {
     // Dead
     if ( !is_user_alive ( ID_AFFECT ) )
     return
     
    // Make a screen fade
     message_begin ( MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, ID_AFFECT )
     write_short ( 1<<13 ) // Duration
     write_short ( 1<<14 ) // Hold Time
     write_short ( FFADE_IN ) // Fade type
     write_byte ( random_num ( 50, 200 ) ) // Red amount
     write_byte ( random_num ( 50, 200 ) ) // Green amount
     write_byte ( random_num ( 50, 200 ) ) // Blue amount
     write_byte ( random_num ( 50, 200 ) ) // Alpha
     message_end ( )
     
    // Make a screen shake
     message_begin ( MSG_ONE_UNRELIABLE, g_msgScreenShake, {0,0,0}, ID_AFFECT )
     write_short ( 0xFFFF ) // Amplitude
     write_short ( 1<<13 ) // Duration
     write_short ( 0xFFFF ) // Frequency
     message_end ( )
     
    // Remove task after all
     remove_task ( ID_AFFECT )
    }

    // Draw explosion ring ( from zombie_plague40.sma )
    stock UTIL_DrawRing ( const Float:origin [ 3 ] )
    {
     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
     write_byte(TE_BEAMCYLINDER) // TE id
     engfunc(EngFunc_WriteCoord, origin[0]) // x
     engfunc(EngFunc_WriteCoord, origin[1]) // y
     engfunc(EngFunc_WriteCoord, origin[2]) // z
     engfunc(EngFunc_WriteCoord, origin[0]) // x axis
     engfunc(EngFunc_WriteCoord, origin[1]) // y axis
     engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis
     write_short( m_iRing ) // sprite
     write_byte(0) // startframe
     write_byte(0) // framerate
     write_byte(4) // life
     write_byte(60) // width
     write_byte(0) // noise
     write_byte(200) // red
     write_byte(200) // green
     write_byte(200) // blue
     write_byte(200) // brightness
     write_byte(0) // speed
     message_end()
    }
    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 7:09 pm

    Todos pegaram, menos a gold ea granada de alucinação.
    Lucasx2020
    Lucasx2020
    Humano


    Masculino Número de Mensagens : 13
    Ammo Packs : 3976
    Honra : -3
    Data de inscrição : 01/01/2014

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Lucasx2020 2/1/2014, 7:58 pm

    Opa mals ai tenta esse ai >

    esqueci de um return mais testa ai

    Código:
    #include <    amxmodx >
    #include <    fakemeta >
    #include <    hamsandwich >
    #include <    fun >
    #include <    zombieplague >

    // Plugin version
    #define VERSION "1.4"

    // Defines
    #define MAXPLAYERS 32
    #define FCVAR_FLAGS ( FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED )
    #define OFFSET_PLAYER 41
    #define OFFSET_ACTIVE 373
    #define LINUX_DIFF 5
    #define NADE_TYPE_CONC 7000
    #define FFADE_IN 0x0000
    #define REPEAT 0.2 // Time when next screen fade/shake message is being sent
    #define TASK_AFFECT 666
    #define ID_AFFECT ( taskid - TASK_AFFECT )
    #define OFFSET_FLAMMO 387

    // Grenade cost
    #define GRENADE_COST 70

    // Grenade models
    new const grenade_model_p [ ] = "models/p_grenade_conc.mdl"
    new const grenade_model [ ] = "models/v_grenade_conc.mdl"
    new const grenade_model_w [ ] = "models/w_grenade_conc.mdl"

    new bought_limit[33], cvar_limit_bought

    // Sounds
    new const explosion_sound [ ] = "zombie_plague/concgren_blast1.wav"
    new const purchase_sound [ ] = "items/gunpickup2.wav"
    new const purchase_sound2 [ ] = "items/9mmclip1.wav"

    // Cached sprite indexes
    new m_iTrail, m_iRing

    // Item ID
    new g_conc

    // Player variables
    new g_NadeCount [ MAXPLAYERS+1 ]

    // Message ID's
    new g_msgScreenFade, g_msgScreenShake, g_msgAmmoPickup

    // CVAR pointers
    new cvar_nade_radius, cvar_duration

    // Precache
    public plugin_precache ( )
    {
       // Precache grenade models
       precache_model ( grenade_model_p )
       precache_model ( grenade_model )
       precache_model ( grenade_model_w )
       
       // Precache sounds
       precache_sound ( explosion_sound )
       precache_sound ( purchase_sound )
       precache_sound ( purchase_sound2 )
       
       // Precache sprites
       m_iRing = precache_model ( "sprites/shockwave.spr" )
       m_iTrail = precache_model ( "sprites/laserbeam.spr" )
    }

    // Plugin initialization
    public plugin_init ( )
    {
       // New plugin
       register_plugin ( "[ZP] Extra Item: Concussion Grenade", VERSION, "NiHiLaNTh" )
       
       // Add cvar to detect servers with this plugin
       register_cvar ( "zp_concgren_version", VERSION, FCVAR_FLAGS )
       
       // New extra item
       g_conc = zp_register_extra_item ( "Granada de Alucinacao", GRENADE_COST, ZP_TEAM_ZOMBIE )
       
       // Events
       register_event ( "HLTV", "Event_NewRound", "a", "1=0", "2=0" )
       register_event ( "DeathMsg", "Event_DeathMsg", "a" )
       register_event ( "CurWeapon", "Event_CurrentWeapon", "be", "1=1", "2=25" )
       
       // Forwards
       register_forward ( FM_SetModel, "fw_SetModel" )
       RegisterHam ( Ham_Think, "grenade", "fw_ThinkGrenade" )
       register_forward ( FM_CmdStart, "fw_CmdStart" )
       
       
       // CVARs
       cvar_nade_radius = register_cvar ( "zp_conc_nade_radius", "500" )
       cvar_duration = register_cvar ( "zp_conc_nade_duration", "7" )
       cvar_limit_bought = register_cvar("zp_alucinacao_bomb_limit", "6")
       
       // Messages
       g_msgScreenShake = get_user_msgid ( "ScreenShake" )
       g_msgScreenFade = get_user_msgid ( "ScreenFade" )
       g_msgAmmoPickup = get_user_msgid ( "AmmoPickup" )
    }

    // Someone decided to buy our an extra item
    public zp_extra_item_selected ( Player, Item )
    {
       // This is our grenade
       if (Item == g_conc)
       {
          // Player already have it
          if ( g_NadeCount [ Player ] >= 1 )
          {
             // Increase nade count
             g_NadeCount [ Player ]++
             
             // Increase bp ammo
             set_pdata_int ( Player, OFFSET_FLAMMO, get_pdata_int ( Player, OFFSET_FLAMMO, LINUX_DIFF )+1, LINUX_DIFF )
             
             // Ammo pickup
             message_begin ( MSG_ONE, g_msgAmmoPickup, _, Player )
             write_byte ( 11 ) // Ammo ID
             write_byte ( 1 ) // Ammo amount
             message_end ( )
             
             // Emit sound
             emit_sound ( Player, CHAN_WEAPON, purchase_sound2, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
          }
          else // 0 grenades
          {
             // Increase nade count
             g_NadeCount [ Player ] = 1
             bought_limit[ Player ]++
             // Give him flashbang
             give_item ( Player, "weapon_flashbang" )
             
             // Play purchase sound
             client_cmd ( Player, "spk %s", purchase_sound ) 
          }
          if(bought_limit[ Player ] >= get_pcvar_num(cvar_limit_bought))
       {
          client_print( Player, print_chat, "[ZP] Ja tacaram muitas bombas antidotos e nao podera atacar mais")                                   
          zp_set_user_ammo_packs( Player, zp_get_user_ammo_packs( Player) + GRENADE_COST)
       }
          return PLUGIN_HANDLED;
       }
       return PLUGIN_CONTINUE
    }

    // Someone was infected 
    public zp_user_infected_post ( Player, Infector )
    {
       // We were affected by concussion grenade
       if ( task_exists ( Player+TASK_AFFECT ) )
          remove_task ( Player+TASK_AFFECT )


    // Someone were turned back to human
    public zp_user_humanized_post ( Player, Survivor )
    {
       // We dont' have nade anymore
       if ( g_NadeCount [ Player ] )
       {
          g_NadeCount [ Player ] = 0
       }
    }

    // New round started
    public Event_NewRound ( )
    {
       // Reset nade count
       arrayset ( g_NadeCount, false, 33 )
       
       // And they aren't affected by conc.grenade
       remove_task ( TASK_AFFECT ) 
    }

    // Someone died
    public Event_DeathMsg ( )
    {
       // Get victim
       new victim = read_data ( 2 )
       
       // Some people had error without this check
       if ( !is_user_connected ( victim ) )
          return 
       
       // Remove hallucinations
       remove_task ( victim+TASK_AFFECT )
       
       // Reset nade count 
       g_NadeCount [ victim ] = 0
    }

    // Current weapon player is holding
    public Event_CurrentWeapon ( Player )
    {
       // Dead or not zombie or don't have conc. grenade
       if ( !is_user_alive ( Player ) || !zp_get_user_zombie ( Player ) || g_NadeCount [ Player ] <= 0 )
          return PLUGIN_CONTINUE
       
       // Replace flashbang model with our ones
       set_pev ( Player, pev_viewmodel2, grenade_model )
       set_pev ( Player, pev_weaponmodel2, grenade_model_p )
       
       return PLUGIN_CONTINUE
    }

    // Set model
    public fw_SetModel ( Entity, const Model [ ] )
    {
       // Prevent invalid ent messages
       if ( !pev_valid ( Entity ) )
          return FMRES_IGNORED
       
       // Grenade not thrown yet 
       if ( pev ( Entity, pev_dmgtime ) == 0.0 )
          return FMRES_IGNORED
       
       // We are throwing concussion grenade 
       if ( g_NadeCount [ pev ( Entity, pev_owner ) ] >= 1 && equal ( Model [7 ], "w_fl", 4 ) )
       {
          //Draw trail
          message_begin ( MSG_BROADCAST, SVC_TEMPENTITY )
          write_byte ( TE_BEAMFOLLOW ) // Temp entity ID
          write_short ( Entity ) // Entity to follow
          write_short ( m_iTrail ) // Sprite index
          write_byte ( 10 ) // Life
          write_byte ( 10 ) // Line width
          write_byte ( 255 ) // Red amount
          write_byte ( 255 ) // Blue amount
          write_byte ( 0 ) // Blue amount
          write_byte ( 255 ) // Alpha
          message_end ( )
          
          // Set grenade entity
          set_pev ( Entity, pev_flTimeStepSound, NADE_TYPE_CONC )
          
          // Decrease nade count
          g_NadeCount [ pev ( Entity, pev_owner ) ]--
          
          // Set world model
          engfunc ( EngFunc_SetModel, Entity, grenade_model_w )
          return FMRES_SUPERCEDE
       }
       return FMRES_IGNORED
    }

    // Grenade is getting to explode
    public fw_ThinkGrenade ( Entity )
    {
       // Prevent invalid ent messages
       if ( !pev_valid ( Entity ) )
          return HAM_IGNORED
       
       // Get damage time
       static Float:dmg_time
       pev ( Entity, pev_dmgtime, dmg_time )
       
       // maybe it is time to go off
       if ( dmg_time > get_gametime ( ) )
          return HAM_IGNORED
       
       // Our grenade 
       if ( pev ( Entity, pev_flTimeStepSound ) == NADE_TYPE_CONC )
       {
          // Force to explode
          concussion_explode ( Entity )
          return HAM_SUPERCEDE
       }
       return HAM_IGNORED
    }

    // Command start
    public fw_CmdStart ( Player, UC_Handle, Seed )
    {
       // Dead, zombie or not affected
       if ( !is_user_alive ( Player ) || zp_get_user_zombie ( Player ) || !task_exists ( Player+TASK_AFFECT ) )
          return FMRES_IGNORED
       
       // Get buttons
       new buttons = get_uc ( UC_Handle, UC_Buttons )
       
       // We are firing
       if ( buttons & IN_ATTACK )
       {
          // We are holding an active weapon
          if ( get_pdata_cbase ( Player, OFFSET_ACTIVE, LINUX_DIFF ) )
          {
             // New recoil
             set_pev ( Player, pev_punchangle, Float:{3.0, 3.0, 4.0} )
          }
       }
       return FMRES_HANDLED
    }


    // Grenade explode
    public concussion_explode ( Entity )
    {
       // Invalid entity ?
       if ( !pev_valid ( Entity  ) )
          return
       
       // Get entities origin
       static Float:origin [ 3 ]
       pev ( Entity, pev_origin, origin )
       
       // Draw ring
       UTIL_DrawRing (origin )
       
       // Explosion sound
       emit_sound ( Entity, CHAN_WEAPON, explosion_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
       
       // Collisions
       static victim 
       victim = -1
       
       // Find radius
       static Float:radius
       radius = get_pcvar_float ( cvar_nade_radius )
       
       // Find all players in a radius
       while ( ( victim = engfunc ( EngFunc_FindEntityInSphere, victim, origin, radius ) ) != 0 )
       {
          // Dead or zombie
          if ( !is_user_alive ( victim ) || zp_get_user_zombie ( victim ) )
             continue
          
          // Victim isn't affected yet 
          if ( !task_exists ( victim+TASK_AFFECT ) ) 
          {
             // Get duration
             new duration = get_pcvar_num ( cvar_duration )
             
             // Calculate affect times
             new affect_count = floatround ( duration / REPEAT )
             
             // Continiously affect them
             set_task ( REPEAT, "affect_victim", victim+TASK_AFFECT, _, _, "a", affect_count )
          }
       }
       
       // Remove entity from ground
       engfunc ( EngFunc_RemoveEntity, Entity )
    }

    // We are going to affect you
    public affect_victim ( taskid )
    {
       // Dead
       if ( !is_user_alive ( ID_AFFECT ) )
          return
       
       // Make a screen fade
       message_begin ( MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, ID_AFFECT )
       write_short ( 1<<13 ) // Duration
       write_short ( 1<<14 ) // Hold Time
       write_short ( FFADE_IN ) // Fade type
       write_byte ( random_num ( 50, 200 ) ) // Red amount
       write_byte ( random_num ( 50, 200 ) ) // Green amount
       write_byte ( random_num ( 50, 200 ) ) // Blue amount
       write_byte ( random_num ( 50, 200 ) ) // Alpha
       message_end ( )
       
       // Make a screen shake
       message_begin ( MSG_ONE_UNRELIABLE, g_msgScreenShake, {0,0,0}, ID_AFFECT )
       write_short ( 0xFFFF ) // Amplitude
       write_short ( 1<<13 ) // Duration
       write_short ( 0xFFFF ) // Frequency
       message_end ( )
       
       // Remove task after all
       remove_task ( ID_AFFECT )
    }

    // Draw explosion ring ( from zombie_plague40.sma )
    stock UTIL_DrawRing ( const Float:origin [ 3 ] )
    {
       engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
       write_byte(TE_BEAMCYLINDER) // TE id
       engfunc(EngFunc_WriteCoord, origin[0]) // x
       engfunc(EngFunc_WriteCoord, origin[1]) // y
       engfunc(EngFunc_WriteCoord, origin[2]) // z
       engfunc(EngFunc_WriteCoord, origin[0]) // x axis
       engfunc(EngFunc_WriteCoord, origin[1]) // y axis
       engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis
       write_short( m_iRing ) // sprite
       write_byte(0) // startframe
       write_byte(0) // framerate
       write_byte(4) // life
       write_byte(60) // width
       write_byte(0) // noise
       write_byte(200) // red
       write_byte(200) // green
       write_byte(200) // blue
       write_byte(200) // brightness
       write_byte(0) // speed
       message_end()
    }
    Leozinho
    Leozinho
    Administrador


    Masculino Número de Mensagens : 2865
    Ammo Packs : 5412
    Honra : 75
    Data de inscrição : 20/11/2011

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Leozinho 2/1/2014, 8:02 pm

    Vê se vai

    Código:
    /*
    [ZP] Extra Item: Golden Ak 47
    Team: Humans

    Description: This plugin adds a new weapon for Human Teams.
    Weapon Cost: 30

    Features:
    - This weapon do more damage
    - This weapon has zoom
    - Launch Lasers
    - This weapon has unlimited bullets

    Credits:

    KaOs - For his Dual MP5 mod

    Cvars:


    - zp_goldenak_dmg_multiplier <4> - Damage Multiplier for Golden Ak 47
    - zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
    - zp_goldenak_custom_model <1|0> - Golden ak Custom Model
    - zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip

    */



    #include <amxmodx>
    #include <fakemeta>
    #include <  fun >
    #include <hamsandwich>
    #include <cstrike>
    #include <zombieplague>
    #include <colorchat>


    #define is_valid_player(%1) (1 <= %1 <= 32)

    new AK_V_MODEL[64] = "models/zombie_plague/v_dynamicak_dp.mdl"
    new AK_P_MODEL[64] = "models/zombie_plague/p_dynamicak_dp.mdl"

    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip, cvar_limit

    // Item ID
    new g_itemid

    new bool:g_HasAk[33]
    new g_hasZoom[ 33 ]
    new bullets[ 33 ]

    // Sprite
    new m_spriteTexture

    const Wep_ak47 = ((1<<CSW_AK47))

    new g_compra = 0

    public plugin_init()
    {
       
       /* CVARS */
       cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "3.5")
       cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
       cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
       cvar_uclip = register_cvar("zp_goldenak_unlimited_clip", "1")
       cvar_limit = register_cvar("zp_goldenak_limit", "4")
       
       // Register The Plugin
       register_plugin("[ZP] Extra: Golden Ak 47", "1.1", "AlejandroSk")
       // Register Zombie Plague extra item
       g_itemid = zp_register_extra_item("Dynamic AK-47", 60, ZP_TEAM_HUMAN)
       // Death Msg
       register_event("DeathMsg", "Death", "a")
       // Weapon Pick Up
       register_event("WeapPickup","checkModel","b","1=19")
       // Current Weapon Event
       register_event("CurWeapon","checkWeapon","be","1=1")
       register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
       // Ham TakeDamage
       RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
       register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
       register_forward( FM_CmdStart, "fw_CmdStart" )
       RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
       
    }


    public client_connect(id)
    {
       g_HasAk[id] = false
    }

    public client_disconnect(id)
    {
       g_HasAk[id] = false
    }

    public Death()
    {
       g_HasAk[read_data(2)] = false
    }

    public fwHamPlayerSpawnPost(id)
    {
       g_HasAk[id] = false
    }

    public plugin_precache()
    {
       precache_model(AK_V_MODEL)
       precache_model(AK_P_MODEL)
       m_spriteTexture = precache_model("sprites/dot.spr")
       precache_sound("weapons/zoom.wav")
    }

    public zp_user_infected_post(id)
    {
       if (zp_get_user_zombie(id))
       {
          g_HasAk[id] = false
       }
    }

    public checkModel(id)
    {
       if ( zp_get_user_zombie(id) )
          return PLUGIN_HANDLED
       
       new szWeapID = read_data(2)
       
       if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
       {
          set_pev(id, pev_viewmodel2, AK_V_MODEL)
          set_pev(id, pev_weaponmodel2, AK_P_MODEL)
       }
       return PLUGIN_HANDLED
    }

    public checkWeapon(id)
    {
       new plrClip, plrAmmo, plrWeap[32]
       new plrWeapId
       
       plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
       
       if (plrWeapId == CSW_AK47 && g_HasAk[id])
       {
          checkModel(id)
       }
       else
       {
          return PLUGIN_CONTINUE
       }
       
       if (plrClip == 0 && get_pcvar_num(cvar_uclip))
       {
          // If the user is out of ammo..
          get_weaponname(plrWeapId, plrWeap, 31)
          // Get the name of their weapon
          give_item(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
       }
       return PLUGIN_HANDLED
    }



    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
       if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
       {
          SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
       }
    }

    public fw_CmdStart( id, uc_handle, seed )
    {
       if( !is_user_alive( id ) )
          return PLUGIN_HANDLED
       
       if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
       {
          new szClip, szAmmo
          new szWeapID = get_user_weapon( id, szClip, szAmmo )
          
          if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
          {
             g_hasZoom[id] = true
             cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
             emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
          }
          
          else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
          {
             g_hasZoom[ id ] = false
             cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
             g_compra = 0
             
          }
          
       }
       return PLUGIN_HANDLED
    }


    public make_tracer(id)
    {
       if (get_pcvar_num(cvar_goldbullets))
       {
          new clip,ammo
          new wpnid = get_user_weapon(id,clip,ammo)
          new pteam[16]
          
          get_user_team(id, pteam, 15)
          
          if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
          {
             new vec1[3], vec2[3]
             get_user_origin(id, vec1, 1) // origin; your camera point.
             get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
             
             
             //BEAMENTPOINTS
             message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
             write_byte (0)    //TE_BEAMENTPOINTS 0
             write_coord(vec1[0])
             write_coord(vec1[1])
             write_coord(vec1[2])
             write_coord(vec2[0])
             write_coord(vec2[1])
             write_coord(vec2[2])
             write_short( m_spriteTexture )
             write_byte(1) // framestart
             write_byte(5) // framerate
             write_byte(2) // life
             write_byte(10) // width
             write_byte(0) // noise
             write_byte( 0 )    // r, g, b
             write_byte( 206 )      // r, g, b
             write_byte( 209 )      // r, g, b
             write_byte(200) // brightness
             write_byte(150) // speed
             message_end()
          }
          
          bullets[id] = clip
       }
       
    }

    public zp_extra_item_selected(player, itemid)
    {
       if ( itemid == g_itemid )
       {
          if ( user_has_weapon(player, CSW_AK47) )
          {
             drop_prim(player)
          }
          
          else if (g_compra >= get_pcvar_num(cvar_limit))
          {
             client_print(player, print_chat, "!g[ZP] !yJa existem muitas !tDynamic AK-47");
             return ZP_PLUGIN_HANDLED;
          }
          
          give_item(player, "weapon_ak47")
          client_print(player, print_chat, "!g[ZP] !yVoce comprou a !tDynamic AK-47 !g[Dano x3]")
          g_HasAk[player] = true;
          g_compra++
       }
       return PLUGIN_CONTINUE
    }


    stock drop_prim(id)
    {
       new weapons[32], num
       get_user_weapons(id, weapons, num)
       for (new i = 0; i < num; i++) {
          if (Wep_ak47 & (1<<weapons[i]))
          {
             static wname[32]
             get_weaponname(weapons[i], wname, sizeof wname - 1)
             engclient_cmd(id, "drop", wname)
          }
       }
    }



    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")  // 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
       replace_all(msg, 190, "!t2", "^0") // 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();
          }
       }
       /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
       *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
       */
    }
    /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
    */
    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 8:23 pm

    Não pegou leo
    Leozinho
    Leozinho
    Administrador


    Masculino Número de Mensagens : 2865
    Ammo Packs : 5412
    Honra : 75
    Data de inscrição : 20/11/2011

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Leozinho 2/1/2014, 8:28 pm

    Vê agora

    Código:
    /*
    [ZP] Extra Item: Golden Ak 47
    Team: Humans

    Description: This plugin adds a new weapon for Human Teams.
    Weapon Cost: 30

    Features:
    - This weapon do more damage
    - This weapon has zoom
    - Launch Lasers
    - This weapon has unlimited bullets

    Credits:

    KaOs - For his Dual MP5 mod

    Cvars:


    - zp_goldenak_dmg_multiplier <4> - Damage Multiplier for Golden Ak 47
    - zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
    - zp_goldenak_custom_model <1|0> - Golden ak Custom Model
    - zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip

    */



    #include <amxmodx>
    #include <fakemeta>
    #include <  fun >
    #include <hamsandwich>
    #include <cstrike>
    #include <zombieplague>
    #include <colorchat>


    #define is_valid_player(%1) (1 <= %1 <= 32)

    new AK_V_MODEL[64] = "models/zombie_plague/v_dynamicak_dp.mdl"
    new AK_P_MODEL[64] = "models/zombie_plague/p_dynamicak_dp.mdl"

    /* Pcvars */
    new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip, cvar_limit

    // Item ID
    new g_itemid

    new bool:g_HasAk[33]
    new g_hasZoom[ 33 ]
    new bullets[ 33 ]

    // Sprite
    new m_spriteTexture

    const Wep_ak47 = ((1<<CSW_AK47))

    new g_compra = 0

    public plugin_init()
    {
       
       /* CVARS */
       cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "3.5")
       cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
       cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
       cvar_uclip = register_cvar("zp_goldenak_unlimited_clip", "1")
       cvar_limit = register_cvar("zp_goldenak_limit", "4")
       
       // Register The Plugin
       register_plugin("[ZP] Extra: Golden Ak 47", "1.1", "AlejandroSk")
       // Register Zombie Plague extra item
       g_itemid = zp_register_extra_item("Dynamic AK-47", 60, ZP_TEAM_HUMAN)
       // Death Msg
       register_event("DeathMsg", "Death", "a")
       // Weapon Pick Up
       register_event("WeapPickup","checkModel","b","1=19")
       // Current Weapon Event
       register_event("CurWeapon","checkWeapon","be","1=1")
       register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
       // Ham TakeDamage
       RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
       register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
       register_forward( FM_CmdStart, "fw_CmdStart" )
       RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
       
    }


    public client_connect(id)
    {
       g_HasAk[id] = false
    }

    public client_disconnect(id)
    {
       g_HasAk[id] = false
    }

    public Death()
    {
       g_HasAk[read_data(2)] = false
    }

    public fwHamPlayerSpawnPost(id)
    {
       g_HasAk[id] = false
    }

    public plugin_precache()
    {
       precache_model(AK_V_MODEL)
       precache_model(AK_P_MODEL)
       m_spriteTexture = precache_model("sprites/dot.spr")
       precache_sound("weapons/zoom.wav")
    }

    public zp_user_infected_post(id)
    {
       if (zp_get_user_zombie(id))
       {
          g_HasAk[id] = false
       }
    }

    public checkModel(id)
    {
       if ( zp_get_user_zombie(id) )
          return PLUGIN_HANDLED
       
       new szWeapID = read_data(2)
       
       if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
       {
          set_pev(id, pev_viewmodel2, AK_V_MODEL)
          set_pev(id, pev_weaponmodel2, AK_P_MODEL)
       }
       return PLUGIN_HANDLED
    }

    public checkWeapon(id)
    {
       new plrClip, plrAmmo, plrWeap[32]
       new plrWeapId
       
       plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
       
       if (plrWeapId == CSW_AK47 && g_HasAk[id])
       {
          checkModel(id)
       }
       else
       {
          return PLUGIN_CONTINUE
       }
       
       if (plrClip == 0 && get_pcvar_num(cvar_uclip))
       {
          // If the user is out of ammo..
          get_weaponname(plrWeapId, plrWeap, 31)
          // Get the name of their weapon
          give_item(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
          engclient_cmd(id, plrWeap)
       }
       return PLUGIN_HANDLED
    }



    public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    {
       if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
       {
          SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
       }
    }

    public fw_CmdStart( id, uc_handle, seed )
    {
       if( !is_user_alive( id ) )
          return PLUGIN_HANDLED
       
       if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
       {
          new szClip, szAmmo
          new szWeapID = get_user_weapon( id, szClip, szAmmo )
          
          if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
          {
             g_hasZoom[id] = true
             cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
             emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
          }
          
          else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
          {
             g_hasZoom[ id ] = false
             cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
             g_compra = 0
             
          }
          
       }
       return PLUGIN_HANDLED
    }


    public make_tracer(id)
    {
       if (get_pcvar_num(cvar_goldbullets))
       {
          new clip,ammo
          new wpnid = get_user_weapon(id,clip,ammo)
          new pteam[16]
          
          get_user_team(id, pteam, 15)
          
          if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
          {
             new vec1[3], vec2[3]
             get_user_origin(id, vec1, 1) // origin; your camera point.
             get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
             
             
             //BEAMENTPOINTS
             message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
             write_byte (0)    //TE_BEAMENTPOINTS 0
             write_coord(vec1[0])
             write_coord(vec1[1])
             write_coord(vec1[2])
             write_coord(vec2[0])
             write_coord(vec2[1])
             write_coord(vec2[2])
             write_short( m_spriteTexture )
             write_byte(1) // framestart
             write_byte(5) // framerate
             write_byte(2) // life
             write_byte(10) // width
             write_byte(0) // noise
             write_byte( 0 )    // r, g, b
             write_byte( 206 )      // r, g, b
             write_byte( 209 )      // r, g, b
             write_byte(200) // brightness
             write_byte(150) // speed
             message_end()
          }
          
          bullets[id] = clip
       }
       
    }

    public zp_extra_item_selected(player, itemid)
    {
       if ( itemid == g_itemid )
       {
          if (g_compra >= get_pcvar_num(cvar_limit))
          {
             client_print(player, print_chat, "!g[ZP] !yJa existem muitas !tDynamic AK-47");
             return ZP_PLUGIN_HANDLED;
          }
          else
          {
             if ( user_has_weapon(player, CSW_AK47) )
             {
                drop_prim(player)
             }
             give_item(player, "weapon_ak47")
             client_print(player, print_chat, "!g[ZP] !yVoce comprou a !tDynamic AK-47 !g[Dano x3]")
             g_HasAk[player] = true;
             g_compra++
          }
       }
       return PLUGIN_CONTINUE
    }


    stock drop_prim(id)
    {
       new weapons[32], num
       get_user_weapons(id, weapons, num)
       for (new i = 0; i < num; i++) {
          if (Wep_ak47 & (1<<weapons[i]))
          {
             static wname[32]
             get_weaponname(weapons[i], wname, sizeof wname - 1)
             engclient_cmd(id, "drop", wname)
          }
       }
    }



    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")  // 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
       replace_all(msg, 190, "!t2", "^0") // 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();
          }
       }
       /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
       *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
       */
    }
    /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
    *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
    */
    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 8:35 pm

    Em ultimo pode ver essa ? 

    Código:
    #include <amxmodx>
    #include <engine>
    #include <fakemeta>
    #include <cstrike>
    #include <hamsandwich>
    #include < xs >
    #include <zombieplague>
    #include < fun >

    #define PLUGIN "[ZP] Extra Item: Illusion Bomb"
    #define VERSION "1.0"
    #define AUTHOR "Dias"

    // Define
    #define MAX_ZOMBIE_ENT 4
    #define ZOMBIE_ENT_CLASSNAME "illusion_zombie"
    #define CLASSNAME_FAKE_PLAYER "fake_zombie"

    #define TASK_REMOVE_ILLUSION 24001

    // Config
    new const confused_sound[2][] =
    {
       "zombie_plague/zombi_bomb_exp.wav",
       "zombie_plague/zombi_banshee_confusion_keep.wav"
    }

    new const confused_model[4][] =
    {
       "models/zombie_plague/v_zombibomb.mdl",
       "models/zombie_plague/p_zombibomb.mdl",
       "models/zombie_plague/w_zombibomb.mdl",
       "sprites/zombie_plague/zb_confuse.spr"
    }

    new const exp_spr[] = "sprites/zombie_plague/zombiebomb_exp.spr"

    #define pev_nade_type        pev_flTimeStepSound
    #define NADE_TYPE_ILLUSION    121315
    new has_illusion_bomb[33]
    new g_exploSpr

    new g_illusion_bomb

    // Hard Code
    const pev_type = pev_iuser1
    new g_zombie_ent[33][MAX_ZOMBIE_ENT], g_illusing[33]

    new g_fake_player[33], g_random_model[128], g_confused_icon[33], g_stop_frame[33]
    // Cvarr
    new cvar_illusion_time, cvar_radius

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

       register_event("CurWeapon", "EV_CurWeapon", "be", "1=1", "2=9")
       register_event("HLTV", "event_newround", "a", "1=0", "2=0")
       
       register_forward(FM_SetModel, "fw_SetModel")
       RegisterHam(Ham_Think, "grenade", "fw_GrenadeThink")
       RegisterHam(Ham_Touch, "grenade", "fw_GrenadeTouch")   
       
       register_event("DeathMsg", "event_death", "a")
       RegisterHam(Ham_Spawn, "player", "fw_spaw_post", 1)
       
       register_think(ZOMBIE_ENT_CLASSNAME, "fw_ent_think")
       register_forward(FM_AddToFullPack, "fw_addtofullpack_post", 1)
       
       cvar_illusion_time = register_cvar("zp_illusion_time", "10.0")
       cvar_radius = register_cvar("zp_illusion_radius", "250.0")

       g_illusion_bomb = zp_register_extra_item("Illusion Bomb", 25, ZP_TEAM_ZOMBIE)

       // This thing will make the bot throw bomb ^^!
       //register_clcmd("switch_to_smoke", "switch_to_smoke") // Make the bot switch to smokegrenade
       //register_clcmd("set_weapon_shoot", "set_weapon_shoot") // Make the bot throw bomb
    }

    /*
    new g_id[33]

    public switch_to_smoke(id)
    {
       static body, target
       get_user_aiming(id, target, body, 999999)
       
       if(is_user_alive(target))
       {
          g_id[id] = target
       }
    }

    public set_weapon_shoot(id)
    {
       if(is_user_alive(g_id[id]))
       {
          illusion_bomb_exp(g_id[id], g_id[id])
       }
    }*/

    public plugin_precache()
    {
       new i
       
       for(i = 0; i < sizeof(confused_model); i++)
          precache_model(confused_model[i])
       for(i = 0; i < sizeof(confused_sound); i++)
          precache_sound(confused_sound[i])   
          
       g_exploSpr = engfunc(EngFunc_PrecacheModel, exp_spr)
    }

    public client_disconnect(id)
    {
       remove_fake_player(id)
    }

    public event_newround()
    {
       for(new i = 0; i < get_maxplayers(); i++)
       {
          if(is_user_alive(i))
          {
             remove_illusion(i)
          }
       }
    }

    public zp_extra_item_selected(id, item)
    {
       if(item == g_illusion_bomb)
       {
          has_illusion_bomb[id] = true
          give_item(id, "weapon_smokegrenade")
          
          client_print(id, print_chat, "[ZP] You bought Illusion Bomb. That can make victim crazy by fake zombie !!!")
       }
    }

    public EV_CurWeapon(id)
    {
       if (!is_user_alive ( id ) || !zp_get_user_zombie(id))
          return PLUGIN_CONTINUE
       
       if (has_illusion_bomb[id] && get_user_weapon(id) == CSW_SMOKEGRENADE)
       {
          set_pev(id, pev_viewmodel2, confused_model[0])
          set_pev(id, pev_weaponmodel2, confused_model[1])
       }
       
       return PLUGIN_CONTINUE
    }

    public fw_SetModel(ent, const Model[])
    {
       if (ent < 0)
          return FMRES_IGNORED
       
       if (pev(ent, pev_dmgtime) == 0.0)
          return FMRES_IGNORED
       
       new iOwner = pev(ent, pev_owner)
       
       if (has_illusion_bomb[iOwner] && equal(Model[7], "w_sm", 4))
       {
          entity_set_model(ent, confused_model[2])
          
          // Reset any other nade
          set_pev(ent, pev_nade_type, 0)
          set_pev(ent, pev_nade_type, NADE_TYPE_ILLUSION)
       
          return FMRES_SUPERCEDE
       }
       return FMRES_IGNORED
    }

    public fw_GrenadeThink(ent)
    {
       if(!pev_valid(ent))
          return HAM_IGNORED
       
       static Float:dmg_time
       pev(ent, pev_dmgtime, dmg_time)
       
       if(dmg_time > get_gametime())
          return HAM_IGNORED
       
       static id
       id = pev(ent, pev_owner)
       
       if(pev(ent, pev_nade_type) == NADE_TYPE_ILLUSION)
       {
          if(has_illusion_bomb[id])
          {
             has_illusion_bomb[id] = false
             illusion_bomb_exp(ent, id)
             
             engfunc(EngFunc_RemoveEntity, ent)
             
             return HAM_SUPERCEDE
          }
       }

       return HAM_HANDLED
    }

    public fw_GrenadeTouch(bomb)
    {
       if(!pev_valid(bomb))
          return HAM_IGNORED
       
       static id
       id = pev(bomb, pev_owner)
       
       if(zp_get_user_zombie(id) && pev(bomb, pev_nade_type) == NADE_TYPE_ILLUSION)
       {
          if(has_illusion_bomb[id])
          {
             set_pev(bomb, pev_dmgtime, 0.0)
          }
       }

       return HAM_HANDLED   
    }

    public illusion_bomb_exp(ent, id)
    {
       static Float:Origin[3]
       pev(ent, pev_origin, Origin)
       
       engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
       write_byte(TE_EXPLOSION); // TE_EXPLOSION
       engfunc(EngFunc_WriteCoord, Origin[0]); // origin x
       engfunc(EngFunc_WriteCoord, Origin[1]); // origin y
       engfunc(EngFunc_WriteCoord, Origin[2]); // origin z
       write_short(g_exploSpr); // sprites
       write_byte(40); // scale in 0.1's
       write_byte(30); // framerate
       write_byte(14); // flags
       message_end(); // message end
       
       emit_sound(ent, CHAN_VOICE, confused_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
       
       // Make Hit Human
       static victim = -1
       while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, Origin, get_pcvar_float(cvar_radius))) != 0)
       {
          if(!is_user_alive(victim) || g_illusing[victim] || zp_get_user_zombie(victim))
             continue
          
          client_print(victim, print_center, "You are in Illusion-Dimenson !!!")
          make_illusion(victim, id)
       }   
    }

    public make_illusion(id, attacker)
    {
       // Remove Old Illusion
       remove_illusion(id)   
       
       // Set Player to Illusion Dimenson
       g_illusing[id] = 1
       
       // Play Effect Sound
       emit_sound(id, CHAN_ITEM, confused_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
       
       static ModelName2[128]
       
       // Make Fake Zombie if not
       for(new i = 0; i < MAX_ZOMBIE_ENT; i++)
       {
          if(!pev_valid(g_zombie_ent[id][i]))
          {
             g_zombie_ent[id][i] = create_entity("info_target")
          }
          
          static Float:Origin[3], ent, Float:VicOrigin[3]
          ent = g_zombie_ent[id][i]
          
          if(i == 0)
          {
             get_position(id, 100.0, 0.0, 0.0, Origin)
          } else if(i == 1) {
             get_position(id, 50.0, 100.0, 0.0, Origin)
          } else if(i == 2) {
             get_position(id, -100.0, 0.0, 0.0, Origin)
          } else if(i == 3) {
             get_position(id, -50.0, -100.0, 0.0, Origin)
          }
          
          entity_set_origin(ent, Origin)
          
          pev(id, pev_origin, VicOrigin)
          npc_turntotarget(ent, Origin, VicOrigin)
          
          static ModelName[128]
          cs_get_user_model(attacker, ModelName, sizeof(ModelName))
          
          formatex(ModelName2, sizeof(ModelName2), "models/player/%s/%s.mdl", ModelName, ModelName)
          formatex(g_random_model, sizeof(g_random_model), "models/player/%s/%s.mdl", ModelName, ModelName)
          
          entity_set_string(ent, EV_SZ_classname, ZOMBIE_ENT_CLASSNAME)
          entity_set_model(ent, ModelName2)
          entity_set_int(ent, EV_INT_solid, SOLID_NOT)
          entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
          
          static Float:mins[3], Float:maxs[3]
          
          mins[0] = -16.0
          mins[1] = -16.0
          mins[2] = -36.0
          
          maxs[0] = 16.0
          maxs[1] = 16.0
          maxs[2] = 36.0
          
          set_pev(ent, pev_mins, mins)
          set_pev(ent, pev_maxs, maxs)
          
          set_pev(ent, pev_renderfx, kRenderFxGlowShell)
          set_pev(ent, pev_rendermode, kRenderTransAlpha)
          set_pev(ent, pev_renderamt, 0.0)
          
          set_pev(ent, pev_owner, id)
          set_pev(ent, pev_type, i)
          
          set_entity_anim(ent, 4)
          
          drop_to_floor(ent)
          
          set_pev(ent, pev_nextthink, halflife_time() + 0.01)
       }
       
       // Make Crazy Screen
       static Float:PunchAngles[3]
       
       PunchAngles[0] = random_float(-25.0, 25.0)
       PunchAngles[1] = random_float(-25.0, 25.0)
       PunchAngles[2] = random_float(-25.0, 25.0)
       
       set_pev(id, pev_punchangle, PunchAngles)
       
       // Make ScreenFade
       message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id)
       write_short(10)
       write_short(10)
       write_short(0x0000)
       write_byte(100)
       write_byte(100)
       write_byte(100)
       write_byte(255)
       message_end()   

       // Make Illusion Icon
       make_confused_icon(id)
       
       // Remove Illusion
       remove_task(id+TASK_REMOVE_ILLUSION)
       set_task(get_pcvar_float(cvar_illusion_time), "do_remove_illusion", id+TASK_REMOVE_ILLUSION)
    }

    public make_confused_icon(id)
    {
       // Already haves a sprite on his hud
       if (g_confused_icon[id])
       {
          // Invalid entity ?
          if (!pev_valid(g_confused_icon[id]))
             return PLUGIN_HANDLED   
          
          // Set the rendering on the entity
          set_pev(g_confused_icon[id], pev_rendermode, kRenderTransAdd)
          set_pev(g_confused_icon[id], pev_renderamt, 255.0)
          
          return PLUGIN_HANDLED
       }

       // Create an entity for the player
       g_confused_icon[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
       
       // Invalid entity ?
       if (!pev_valid(g_confused_icon[id]))
          return PLUGIN_HANDLED
       
       // Set some basic properties
       set_pev(g_confused_icon[id], pev_takedamage, 0.0)
       set_pev(g_confused_icon[id], pev_solid, SOLID_NOT)
       set_pev(g_confused_icon[id], pev_movetype, MOVETYPE_NONE)
       set_pev(g_confused_icon[id], pev_classname, "confusing")
       
       // Set the sprite model
       engfunc(EngFunc_SetModel, g_confused_icon[id], confused_model[3])
       
       // Set the rendering on the entity
       set_pev(g_confused_icon[id], pev_rendermode, kRenderTransAdd)
       set_pev(g_confused_icon[id], pev_renderamt, 255.0)
       
       // Set the sprite size
       set_pev(g_confused_icon[id], pev_scale, 1.0)
       set_pev(g_confused_icon[id], pev_owner, id)
       
       // Update sprite's stopping frame
       g_stop_frame[id] = 6
       
       // Allow animation of sprite ?
       if (g_stop_frame[id] && 1.0 > 0.0)
       {
          // Set the sprites animation time, framerate and stop frame
          set_pev(g_confused_icon[id], pev_animtime, get_gametime())
          set_pev(g_confused_icon[id], pev_framerate, 10.0)
          
          // Spawn the sprite entity (necessary to play the sprite animations)
          set_pev(g_confused_icon[id], pev_spawnflags, SF_SPRITE_STARTON)
          dllfunc(DLLFunc_Spawn, g_confused_icon[id])
       }

       return g_confused_icon[id]
    }   

    public client_PostThink(id)
    {
       if(!is_user_alive(id))
          return
          
       if(!g_illusing[id])
          return
          
       if(!pev_valid(g_confused_icon[id]))
          return
          
       static Float:Origin[3]
       
       // Retrieve player's origin
       pev(id, pev_origin, Origin)
       
       Origin[2] += 40.0
       
       engfunc(EngFunc_SetOrigin, g_confused_icon[id], Origin)
       
       // Stop the animation at the desired frame
       if (pev(g_confused_icon[id], pev_frame) == g_stop_frame[id])
       {
          set_pev(g_confused_icon[id], pev_framerate, 2.0)
          set_pev(g_confused_icon[id], pev_frame, 0.1)
          
          g_stop_frame[id] = 6
       }
    }

    public do_remove_illusion(id)
    {
       id -= TASK_REMOVE_ILLUSION
       
       if(is_user_alive(id))
          remove_illusion(id)
    }

    public remove_illusion(id)
    {
       g_illusing[id] = 0
       remove_task(id+TASK_REMOVE_ILLUSION)
       
       for(new ent = 0; ent < MAX_ZOMBIE_ENT; ent++)
       {
          if(pev_valid(g_zombie_ent[id][ent]))
          {
             set_pev(g_zombie_ent[id][ent], pev_rendermode, kRenderTransAdd)
             set_pev(g_zombie_ent[id][ent], pev_renderamt, 0.0)
          }
       }   
       
       if(pev_valid(g_confused_icon[id]))
       {
          set_pev(g_confused_icon[id], pev_rendermode, kRenderTransAdd)
          set_pev(g_confused_icon[id], pev_renderamt, 0.0)
       }
    }

    public event_death()
    {
       static victim
       victim = read_data(2)
       
       remove_illusion(victim)
    }

    public zp_user_infected_post(id)
    {
       remove_illusion(id)
    }

    public fw_spaw_post(id)
    {
       remove_illusion(id)
    }

    public fw_ent_think(ent)
    {
       if(!pev_valid(ent))
          return
       static id
       id = pev(ent, pev_owner)
       
       if(!is_user_alive(id) || !g_illusing[id])
          return

       hook_ent(ent, id, 150.0)
          
       set_pev(ent, pev_nextthink, halflife_time() + 0.01)
    }

    public fw_addtofullpack_post(es_handle, e, ent, host, hostflags, player, pset)
    {
       if(!is_user_alive(host) || !pev_valid(ent))
          return FMRES_IGNORED
       if(!g_illusing[host] || zp_get_user_zombie(host))
          return FMRES_IGNORED
          
       static Classname[32]
       pev(ent, pev_classname, Classname, sizeof(Classname))
       
       // Fake Zombie
       if(equal(Classname, ZOMBIE_ENT_CLASSNAME) && pev(ent, pev_owner) == host)
       {
          set_es(es_handle, ES_RenderAmt, 255.0)
          
          /*
          static id, type, Float:Origin[3]
          
          id = pev(ent, pev_owner)
          type = pev(ent, pev_type)
          
          if(type == 0)
          {
             get_position(id, 100.0, 0.0, 0.0, Origin)
          } else if(type == 1) {
             get_position(id, 75.0, 35.0, 0.0, Origin)
          } else if(type == 2) {
             get_position(id, 75.0, -35.0, 0.0, Origin)
          }
          
          set_es(es_handle, ES_Origin, Origin)*/
          
          static Float:newAngle[3], Float:VicOrigin[3], Float:EntOrigin[3]
          
          entity_get_vector(ent, EV_VEC_angles, newAngle)
          pev(host, pev_origin, VicOrigin)
          pev(ent, pev_origin, EntOrigin)
          
          new Float:x = VicOrigin[0] - EntOrigin[0]
          new Float:z = VicOrigin[1] - EntOrigin[1]
       
          new Float:radians = floatatan(z/x, radian)
          newAngle[1] = radians * (180 / 3.14)
          if (VicOrigin[0] < EntOrigin[0])
             newAngle[1] -= 180.0   
             
          set_es(es_handle, ES_Angles, newAngle)
       } else if(equal(Classname, CLASSNAME_FAKE_PLAYER)) {
          static ent_owner
          ent_owner = pev(ent, pev_owner)
          
          if(is_user_alive(ent_owner) && !zp_get_user_zombie(ent_owner))
          {
             set_es(es_handle, ES_RenderMode, kRenderNormal)
             set_es(es_handle, ES_RenderAmt, 255.0)
             
             engfunc(EngFunc_SetModel, ent, g_random_model)
          }
       }
       
       if(is_user_alive(ent) && !zp_get_user_zombie(ent))
       {
          set_es(es_handle, ES_RenderMode, kRenderTransAlpha)
          set_es(es_handle, ES_RenderAmt, 0.0)
          
          new iEntFake = find_ent_by_owner(-1, CLASSNAME_FAKE_PLAYER, ent)
          if(!iEntFake || !pev_valid(ent))
          {
             iEntFake = create_fake_player(ent)
          }
          
          g_fake_player[ent] = iEntFake   
       }
       
       return FMRES_HANDLED
    }

    stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
    {
       new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
       
       pev(ent, pev_origin, vOrigin)
       pev(ent, pev_view_ofs,vUp) //for player
       xs_vec_add(vOrigin,vUp,vOrigin)
       pev(ent, pev_v_angle, vAngle) // if normal entity ,use pev_angles
       
       vAngle[0] = 0.0
       
       angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward) //or use EngFunc_AngleVectors
       angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
       angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
       
       vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
       vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
       vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
    }

    stock set_entity_anim(ent, anim)
    {
       entity_set_float(ent, EV_FL_animtime, get_gametime())
       entity_set_float(ent, EV_FL_framerate, 1.0)
       entity_set_float(ent, EV_FL_frame, 0.0)
       entity_set_int(ent, EV_INT_sequence, anim)   
    }

    public npc_turntotarget(ent, Float:Ent_Origin[3], Float:Vic_Origin[3])
    {
       if(!pev_valid(ent))
          return
       
       new Float:newAngle[3]
       entity_get_vector(ent, EV_VEC_angles, newAngle)
       new Float:x = Vic_Origin[0] - Ent_Origin[0]
       new Float:z = Vic_Origin[1] - Ent_Origin[1]

       new Float:radians = floatatan(z/x, radian)
       newAngle[1] = radians * (180 / 3.14)
       if (Vic_Origin[0] < Ent_Origin[0])
          newAngle[1] -= 180.0

       entity_set_vector(ent, EV_VEC_v_angle, newAngle)
       entity_set_vector(ent, EV_VEC_angles, newAngle)
    }

    public hook_ent(ent, victim, Float:speed)
    {
       static Float:fl_Velocity[3]
       static Float:VicOrigin[3], Float:EntOrigin[3]

       pev(ent, pev_origin, EntOrigin)
       pev(victim, pev_origin, VicOrigin)
       
       static Float:distance_f
       distance_f = get_distance_f(EntOrigin, VicOrigin)

       if (distance_f > 60.0)
       {
          new Float:fl_Time = distance_f / speed

          fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
          fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
          fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
       } else
       {
          fl_Velocity[0] = 0.0
          fl_Velocity[1] = 0.0
          fl_Velocity[2] = 0.0
       }

       entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
    }

    public create_fake_player(id)
    {
       new iEntFake = create_entity("info_target")
       
       set_pev(iEntFake, pev_classname, CLASSNAME_FAKE_PLAYER)
       //set_pev(iEntFake, pev_modelindex, pev(id, pev_modelindex))
       set_pev(iEntFake, pev_movetype, MOVETYPE_FOLLOW)
       set_pev(iEntFake, pev_solid, SOLID_NOT)
       set_pev(iEntFake, pev_aiment, id)
       set_pev(iEntFake, pev_owner, id)

       set_pev(iEntFake, pev_renderfx, kRenderFxGlowShell)
       set_pev(iEntFake, pev_rendermode, kRenderTransAlpha)
       set_pev(iEntFake, pev_renderamt, 255.0)

       return iEntFake
    }

    public remove_fake_player(id)
    {
       if(pev_valid(g_fake_player[id]))
          remove_entity(g_fake_player[id])
    }
    Leozinho
    Leozinho
    Administrador


    Masculino Número de Mensagens : 2865
    Ammo Packs : 5412
    Honra : 75
    Data de inscrição : 20/11/2011

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Leozinho 2/1/2014, 9:00 pm

    Teste ai.

    Código:
    #include <amxmodx>
    #include <engine>
    #include <fakemeta>
    #include <cstrike>
    #include <hamsandwich>
    #include <  xs >
    #include <zombieplague>
    #include <  fun >

    #define PLUGIN "[ZP] Extra Item: Illusion Bomb"
    #define VERSION "1.0"
    #define AUTHOR "Dias"

    // Define
    #define MAX_ZOMBIE_ENT 4
    #define ZOMBIE_ENT_CLASSNAME "illusion_zombie"
    #define CLASSNAME_FAKE_PLAYER "fake_zombie"

    #define TASK_REMOVE_ILLUSION 24001

    // Config
    new const confused_sound[2][] =
    {
    "zombie_plague/zombi_bomb_exp.wav",
    "zombie_plague/zombi_banshee_confusion_keep.wav"
    }

    new const confused_model[4][] =
    {
    "models/zombie_plague/v_zombibomb.mdl",
    "models/zombie_plague/p_zombibomb.mdl",
    "models/zombie_plague/w_zombibomb.mdl",
    "sprites/zombie_plague/zb_confuse.spr"
    }

    new const exp_spr[] = "sprites/zombie_plague/zombiebomb_exp.spr"

    #define pev_nade_type        pev_flTimeStepSound
    #define NADE_TYPE_ILLUSION    121315
    new has_illusion_bomb[33]
    new g_exploSpr

    new g_illusion_bomb

    // Hard Code
    const pev_type = pev_iuser1
    new g_zombie_ent[33][MAX_ZOMBIE_ENT], g_illusing[33]

    new g_fake_player[33], g_random_model[128], g_confused_icon[33], g_stop_frame[33]
    // Cvarr
    new cvar_illusion_time, cvar_radius

    new g_compras = 0

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

       register_event("CurWeapon", "EV_CurWeapon", "be", "1=1", "2=9")
       register_event("HLTV", "event_newround", "a", "1=0", "2=0")

       register_forward(FM_SetModel, "fw_SetModel")
       RegisterHam(Ham_Think, "grenade", "fw_GrenadeThink")
       RegisterHam(Ham_Touch, "grenade", "fw_GrenadeTouch") 

       register_event("DeathMsg", "event_death", "a")
       RegisterHam(Ham_Spawn, "player", "fw_spaw_post", 1)

       register_think(ZOMBIE_ENT_CLASSNAME, "fw_ent_think")
       register_forward(FM_AddToFullPack, "fw_addtofullpack_post", 1)
       
       cvar_illusion_time = register_cvar("zp_illusion_time", "10.0")
       cvar_radius = register_cvar("zp_illusion_radius", "250.0")

       g_illusion_bomb = zp_register_extra_item("Illusion Bomb", 25, ZP_TEAM_ZOMBIE)

       // This thing will make the bot throw bomb ^^!
       //register_clcmd("switch_to_smoke", "switch_to_smoke") // Make the bot switch to smokegrenade
       //register_clcmd("set_weapon_shoot", "set_weapon_shoot") // Make the bot throw bomb
    }

    /*
    new g_id[33]

    public switch_to_smoke(id)
    {
    static body, target
    get_user_aiming(id, target, body, 999999)

    if(is_user_alive(target))
    {
    g_id[id] = target
    }
    }

    public set_weapon_shoot(id)
    {
    if(is_user_alive(g_id[id]))
    {
    illusion_bomb_exp(g_id[id], g_id[id])
    }
    }*/

    public plugin_precache()
    {
       new i

       for(i = 0; i < sizeof(confused_model); i++)
          precache_model(confused_model[i])
       for(i = 0; i < sizeof(confused_sound); i++)
          precache_sound(confused_sound[i]) 
       
       g_exploSpr = engfunc(EngFunc_PrecacheModel, exp_spr)
    }

    public client_disconnect(id)
    {
       remove_fake_player(id)
    }

    public event_newround()
    {
       for(new i = 0; i < get_maxplayers(); i++)
       {
          if(is_user_alive(i))
          {
             remove_illusion(i)
             g_compras = 0
          }
       }
    }

    public zp_extra_item_selected(id, item)
    {
       if(item == g_illusion_bomb)
       {
          if(g_compras >= 6)
          {
             client_print(id, print_chat, "Ja compraram muitas illusion bomb.")
             return PLUGIN_HANDLED
          }
          else
          {
             has_illusion_bomb[id] = true
             give_item(id, "weapon_smokegrenade")
             
             client_print(id, print_chat, "[ZP] You bought Illusion Bomb. That can make victim crazy by fake zombie !!!")
             g_compras++
          }
       }
       return PLUGIN_CONTINUE
    }

    public EV_CurWeapon(id)
    {
       if (!is_user_alive ( id ) || !zp_get_user_zombie(id))
          return PLUGIN_CONTINUE
       
       if (has_illusion_bomb[id] && get_user_weapon(id) == CSW_SMOKEGRENADE)
       {
          set_pev(id, pev_viewmodel2, confused_model[0])
          set_pev(id, pev_weaponmodel2, confused_model[1])
       }
       
       return PLUGIN_CONTINUE
    }

    public fw_SetModel(ent, const Model[])
    {
       if (ent < 0)
          return FMRES_IGNORED
       
       if (pev(ent, pev_dmgtime) == 0.0)
          return FMRES_IGNORED
       
       new iOwner = pev(ent, pev_owner)
       
       if (has_illusion_bomb[iOwner] && equal(Model[7], "w_sm", 4))
       {
          entity_set_model(ent, confused_model[2])
          
          // Reset any other nade
          set_pev(ent, pev_nade_type, 0)
          set_pev(ent, pev_nade_type, NADE_TYPE_ILLUSION)
          
          return FMRES_SUPERCEDE
       }
       return FMRES_IGNORED
    }

    public fw_GrenadeThink(ent)
    {
       if(!pev_valid(ent))
          return HAM_IGNORED
       
       static Float:dmg_time
       pev(ent, pev_dmgtime, dmg_time)
       
       if(dmg_time > get_gametime())
          return HAM_IGNORED
       
       static id
       id = pev(ent, pev_owner)
       
       if(pev(ent, pev_nade_type) == NADE_TYPE_ILLUSION)
       {
          if(has_illusion_bomb[id])
          {
             has_illusion_bomb[id] = false
             illusion_bomb_exp(ent, id)
             
             engfunc(EngFunc_RemoveEntity, ent)
             
             return HAM_SUPERCEDE
          }
       }
       
       return HAM_HANDLED
    }

    public fw_GrenadeTouch(bomb)
    {
       if(!pev_valid(bomb))
          return HAM_IGNORED
       
       static id
       id = pev(bomb, pev_owner)
       
       if(zp_get_user_zombie(id) && pev(bomb, pev_nade_type) == NADE_TYPE_ILLUSION)
       {
          if(has_illusion_bomb[id])
          {
             set_pev(bomb, pev_dmgtime, 0.0)
          }
       }
       
       return HAM_HANDLED 
    }

    public illusion_bomb_exp(ent, id)
    {
       static Float:Origin[3]
       pev(ent, pev_origin, Origin)
       
       engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
       write_byte(TE_EXPLOSION); // TE_EXPLOSION
       engfunc(EngFunc_WriteCoord, Origin[0]); // origin x
       engfunc(EngFunc_WriteCoord, Origin[1]); // origin y
       engfunc(EngFunc_WriteCoord, Origin[2]); // origin z
       write_short(g_exploSpr); // sprites
       write_byte(40); // scale in 0.1's
       write_byte(30); // framerate
       write_byte(14); // flags
       message_end(); // message end
       
       emit_sound(ent, CHAN_VOICE, confused_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
       
       // Make Hit Human
       static victim = -1
       while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, Origin, get_pcvar_float(cvar_radius))) != 0)
       {
          if(!is_user_alive(victim) || g_illusing[victim] || zp_get_user_zombie(victim))
             continue
          
          client_print(victim, print_center, "You are in Illusion-Dimenson !!!")
          make_illusion(victim, id)
       } 
    }

    public make_illusion(id, attacker)
    {
       // Remove Old Illusion
       remove_illusion(id) 
       
       // Set Player to Illusion Dimenson
       g_illusing[id] = 1
       
       // Play Effect Sound
       emit_sound(id, CHAN_ITEM, confused_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
       
       static ModelName2[128]
       
       // Make Fake Zombie if not
       for(new i = 0; i < MAX_ZOMBIE_ENT; i++)
       {
          if(!pev_valid(g_zombie_ent[id][i]))
          {
             g_zombie_ent[id][i] = create_entity("info_target")
          }
          
          static Float:Origin[3], ent, Float:VicOrigin[3]
          ent = g_zombie_ent[id][i]
          
          if(i == 0)
          {
             get_position(id, 100.0, 0.0, 0.0, Origin)
             } else if(i == 1) {
             get_position(id, 50.0, 100.0, 0.0, Origin)
             } else if(i == 2) {
             get_position(id, -100.0, 0.0, 0.0, Origin)
             } else if(i == 3) {
             get_position(id, -50.0, -100.0, 0.0, Origin)
          }
          
          entity_set_origin(ent, Origin)
          
          pev(id, pev_origin, VicOrigin)
          npc_turntotarget(ent, Origin, VicOrigin)
          
          static ModelName[128]
          cs_get_user_model(attacker, ModelName, sizeof(ModelName))
          
          formatex(ModelName2, sizeof(ModelName2), "models/player/%s/%s.mdl", ModelName, ModelName)
          formatex(g_random_model, sizeof(g_random_model), "models/player/%s/%s.mdl", ModelName, ModelName)
          
          entity_set_string(ent, EV_SZ_classname, ZOMBIE_ENT_CLASSNAME)
          entity_set_model(ent, ModelName2)
          entity_set_int(ent, EV_INT_solid, SOLID_NOT)
          entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
          
          static Float:mins[3], Float:maxs[3]
          
          mins[0] = -16.0
          mins[1] = -16.0
          mins[2] = -36.0
          
          maxs[0] = 16.0
          maxs[1] = 16.0
          maxs[2] = 36.0
          
          set_pev(ent, pev_mins, mins)
          set_pev(ent, pev_maxs, maxs)
          
          set_pev(ent, pev_renderfx, kRenderFxGlowShell)
          set_pev(ent, pev_rendermode, kRenderTransAlpha)
          set_pev(ent, pev_renderamt, 0.0)
          
          set_pev(ent, pev_owner, id)
          set_pev(ent, pev_type, i)
          
          set_entity_anim(ent, 4)
          
          drop_to_floor(ent)
          
          set_pev(ent, pev_nextthink, halflife_time() + 0.01)
       }
       
       // Make Crazy Screen
       static Float:PunchAngles[3]
       
       PunchAngles[0] = random_float(-25.0, 25.0)
       PunchAngles[1] = random_float(-25.0, 25.0)
       PunchAngles[2] = random_float(-25.0, 25.0)
       
       set_pev(id, pev_punchangle, PunchAngles)
       
       // Make ScreenFade
       message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id)
       write_short(10)
       write_short(10)
       write_short(0x0000)
       write_byte(100)
       write_byte(100)
       write_byte(100)
       write_byte(255)
       message_end() 
       
       // Make Illusion Icon
       make_confused_icon(id)
       
       // Remove Illusion
       remove_task(id+TASK_REMOVE_ILLUSION)
       set_task(get_pcvar_float(cvar_illusion_time), "do_remove_illusion", id+TASK_REMOVE_ILLUSION)
    }

    public make_confused_icon(id)
    {
       // Already haves a sprite on his hud
       if (g_confused_icon[id])
       {
          // Invalid entity ?
          if (!pev_valid(g_confused_icon[id]))
             return PLUGIN_HANDLED 
          
          // Set the rendering on the entity
          set_pev(g_confused_icon[id], pev_rendermode, kRenderTransAdd)
          set_pev(g_confused_icon[id], pev_renderamt, 255.0)
          
          return PLUGIN_HANDLED
       }
       
       // Create an entity for the player
       g_confused_icon[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
       
       // Invalid entity ?
       if (!pev_valid(g_confused_icon[id]))
          return PLUGIN_HANDLED
       
       // Set some basic properties
       set_pev(g_confused_icon[id], pev_takedamage, 0.0)
       set_pev(g_confused_icon[id], pev_solid, SOLID_NOT)
       set_pev(g_confused_icon[id], pev_movetype, MOVETYPE_NONE)
       set_pev(g_confused_icon[id], pev_classname, "confusing")
       
       // Set the sprite model
       engfunc(EngFunc_SetModel, g_confused_icon[id], confused_model[3])
       
       // Set the rendering on the entity
       set_pev(g_confused_icon[id], pev_rendermode, kRenderTransAdd)
       set_pev(g_confused_icon[id], pev_renderamt, 255.0)
       
       // Set the sprite size
       set_pev(g_confused_icon[id], pev_scale, 1.0)
       set_pev(g_confused_icon[id], pev_owner, id)
       
       // Update sprite's stopping frame
       g_stop_frame[id] = 6
       
       // Allow animation of sprite ?
       if (g_stop_frame[id] && 1.0 > 0.0)
       {
          // Set the sprites animation time, framerate and stop frame
          set_pev(g_confused_icon[id], pev_animtime, get_gametime())
          set_pev(g_confused_icon[id], pev_framerate, 10.0)
          
          // Spawn the sprite entity (necessary to play the sprite animations)
          set_pev(g_confused_icon[id], pev_spawnflags, SF_SPRITE_STARTON)
          dllfunc(DLLFunc_Spawn, g_confused_icon[id])
       }
       
       return g_confused_icon[id]


    public client_PostThink(id)
    {
       if(!is_user_alive(id))
          return
       
       if(!g_illusing[id])
          return
       
       if(!pev_valid(g_confused_icon[id]))
          return
       
       static Float:Origin[3]
       
       // Retrieve player's origin
       pev(id, pev_origin, Origin)
       
       Origin[2] += 40.0
       
       engfunc(EngFunc_SetOrigin, g_confused_icon[id], Origin)
       
       // Stop the animation at the desired frame
       if (pev(g_confused_icon[id], pev_frame) == g_stop_frame[id])
       {
          set_pev(g_confused_icon[id], pev_framerate, 2.0)
          set_pev(g_confused_icon[id], pev_frame, 0.1)
          
          g_stop_frame[id] = 6
       }
    }

    public do_remove_illusion(id)
    {
       id -= TASK_REMOVE_ILLUSION
       
       if(is_user_alive(id))
          remove_illusion(id)
    }

    public remove_illusion(id)
    {
       g_illusing[id] = 0
       remove_task(id+TASK_REMOVE_ILLUSION)
       
       for(new ent = 0; ent < MAX_ZOMBIE_ENT; ent++)
       {
          if(pev_valid(g_zombie_ent[id][ent]))
          {
             set_pev(g_zombie_ent[id][ent], pev_rendermode, kRenderTransAdd)
             set_pev(g_zombie_ent[id][ent], pev_renderamt, 0.0)
          }
       } 
       
       if(pev_valid(g_confused_icon[id]))
       {
          set_pev(g_confused_icon[id], pev_rendermode, kRenderTransAdd)
          set_pev(g_confused_icon[id], pev_renderamt, 0.0)
       }
    }

    public event_death()
    {
       static victim
       victim = read_data(2)
       
       remove_illusion(victim)
    }

    public zp_user_infected_post(id)
    {
       remove_illusion(id)
    }

    public fw_spaw_post(id)
    {
       remove_illusion(id)
    }

    public fw_ent_think(ent)
    {
       if(!pev_valid(ent))
          return
       static id
       id = pev(ent, pev_owner)
       
       if(!is_user_alive(id) || !g_illusing[id])
          return
       
       hook_ent(ent, id, 150.0)
       
       set_pev(ent, pev_nextthink, halflife_time() + 0.01)
    }

    public fw_addtofullpack_post(es_handle, e, ent, host, hostflags, player, pset)
    {
       if(!is_user_alive(host) || !pev_valid(ent))
          return FMRES_IGNORED
       if(!g_illusing[host] || zp_get_user_zombie(host))
          return FMRES_IGNORED
       
       static Classname[32]
       pev(ent, pev_classname, Classname, sizeof(Classname))
       
       // Fake Zombie
       if(equal(Classname, ZOMBIE_ENT_CLASSNAME) && pev(ent, pev_owner) == host)
       {
          set_es(es_handle, ES_RenderAmt, 255.0)
          
          /*
          static id, type, Float:Origin[3]
          
          id = pev(ent, pev_owner)
          type = pev(ent, pev_type)
          
          if(type == 0)
          {
             get_position(id, 100.0, 0.0, 0.0, Origin)
             } else if(type == 1) {
             get_position(id, 75.0, 35.0, 0.0, Origin)
             } else if(type == 2) {
             get_position(id, 75.0, -35.0, 0.0, Origin)
          }
          
          set_es(es_handle, ES_Origin, Origin)*/
          
          static Float:newAngle[3], Float:VicOrigin[3], Float:EntOrigin[3]
          
          entity_get_vector(ent, EV_VEC_angles, newAngle)
          pev(host, pev_origin, VicOrigin)
          pev(ent, pev_origin, EntOrigin)
          
          new Float:x = VicOrigin[0] - EntOrigin[0]
          new Float:z = VicOrigin[1] - EntOrigin[1]
          
          new Float:radians = floatatan(z/x, radian)
          newAngle[1] = radians * (180 / 3.14)
          if (VicOrigin[0] < EntOrigin[0])
             newAngle[1] -= 180.0 
          
          set_es(es_handle, ES_Angles, newAngle)
          } else if(equal(Classname, CLASSNAME_FAKE_PLAYER)) {
          static ent_owner
          ent_owner = pev(ent, pev_owner)
          
          if(is_user_alive(ent_owner) && !zp_get_user_zombie(ent_owner))
          {
             set_es(es_handle, ES_RenderMode, kRenderNormal)
             set_es(es_handle, ES_RenderAmt, 255.0)
             
             engfunc(EngFunc_SetModel, ent, g_random_model)
          }
       }
       
       if(is_user_alive(ent) && !zp_get_user_zombie(ent))
       {
          set_es(es_handle, ES_RenderMode, kRenderTransAlpha)
          set_es(es_handle, ES_RenderAmt, 0.0)
          
          new iEntFake = find_ent_by_owner(-1, CLASSNAME_FAKE_PLAYER, ent)
          if(!iEntFake || !pev_valid(ent))
          {
             iEntFake = create_fake_player(ent)
          }
          
          g_fake_player[ent] = iEntFake 
       }
       
       return FMRES_HANDLED
    }

    stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
    {
       new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
       
       pev(ent, pev_origin, vOrigin)
       pev(ent, pev_view_ofs,vUp) //for player
       xs_vec_add(vOrigin,vUp,vOrigin)
       pev(ent, pev_v_angle, vAngle) // if normal entity ,use pev_angles
       
       vAngle[0] = 0.0
       
       angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward) //or use EngFunc_AngleVectors
       angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
       angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
       
       vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
       vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
       vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
    }

    stock set_entity_anim(ent, anim)
    {
       entity_set_float(ent, EV_FL_animtime, get_gametime())
       entity_set_float(ent, EV_FL_framerate, 1.0)
       entity_set_float(ent, EV_FL_frame, 0.0)
       entity_set_int(ent, EV_INT_sequence, anim) 
    }

    public npc_turntotarget(ent, Float:Ent_Origin[3], Float:Vic_Origin[3])
    {
       if(!pev_valid(ent))
          return
       
       new Float:newAngle[3]
       entity_get_vector(ent, EV_VEC_angles, newAngle)
       new Float:x = Vic_Origin[0] - Ent_Origin[0]
       new Float:z = Vic_Origin[1] - Ent_Origin[1]
       
       new Float:radians = floatatan(z/x, radian)
       newAngle[1] = radians * (180 / 3.14)
       if (Vic_Origin[0] < Ent_Origin[0])
          newAngle[1] -= 180.0
       
       entity_set_vector(ent, EV_VEC_v_angle, newAngle)
       entity_set_vector(ent, EV_VEC_angles, newAngle)
    }

    public hook_ent(ent, victim, Float:speed)
    {
       static Float:fl_Velocity[3]
       static Float:VicOrigin[3], Float:EntOrigin[3]
       
       pev(ent, pev_origin, EntOrigin)
       pev(victim, pev_origin, VicOrigin)
       
       static Float:distance_f
       distance_f = get_distance_f(EntOrigin, VicOrigin)
       
       if (distance_f > 60.0)
       {
          new Float:fl_Time = distance_f / speed
          
          fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
          fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
          fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
       }
       else
       {
          fl_Velocity[0] = 0.0
          fl_Velocity[1] = 0.0
          fl_Velocity[2] = 0.0
       }

       entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
    }

    public create_fake_player(id)
    {
       new iEntFake = create_entity("info_target")

       set_pev(iEntFake, pev_classname, CLASSNAME_FAKE_PLAYER)
       //set_pev(iEntFake, pev_modelindex, pev(id, pev_modelindex))
       set_pev(iEntFake, pev_movetype, MOVETYPE_FOLLOW)
       set_pev(iEntFake, pev_solid, SOLID_NOT)
       set_pev(iEntFake, pev_aiment, id)
       set_pev(iEntFake, pev_owner, id)

       set_pev(iEntFake, pev_renderfx, kRenderFxGlowShell)
       set_pev(iEntFake, pev_rendermode, kRenderTransAlpha)
       set_pev(iEntFake, pev_renderamt, 255.0)

       return iEntFake
    }

    public remove_fake_player(id)
    {
       if(pev_valid(g_fake_player[id]))
          remove_entity(g_fake_player[id])
    }
    [D]etonado[R]
    [D]etonado[R]
    Humano


    Nick : [D]etonado[R]
    Masculino Número de Mensagens : 625
    Ammo Packs : 4244
    Honra : 20
    Data de inscrição : 17/10/2013

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por [D]etonado[R] 2/1/2014, 9:07 pm

    Tudo certo pode fechar
    Leozinho
    Leozinho
    Administrador


    Masculino Número de Mensagens : 2865
    Ammo Packs : 5412
    Honra : 75
    Data de inscrição : 20/11/2011

    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Leozinho 2/1/2014, 9:13 pm

    Closed.

    Conteúdo patrocinado


    [Duvida] Limitar itens Extras Empty Re: [Duvida] Limitar itens Extras

    Mensagem por Conteúdo patrocinado


      Data/hora atual: 23/11/2024, 8:33 am