Raised This Month: $51 Target: $400
 12% 

Suggestion / Subplugin Request [REQ] Item Limiter Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
M@RSH@L
Member
Join Date: Jan 2012
Old 05-13-2013 , 16:12   [REQ] Item Limiter Plugin
Reply With Quote #1

Hello
I need a plugin that can add limit to some extra items like knife blink , armor ...
anyone can create this ?
__________________

Last edited by M@RSH@L; 05-13-2013 at 16:16.
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-14-2013 , 01:11   Re: [REQ] Item Limiter Plugin
Reply With Quote #2

Plzz dont post half info .... For wichever items u want limit just post their sma here... i'll try to do it....
Catastrophe is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 05-15-2013 , 14:30   Re: [REQ] Item Limiter Plugin
Reply With Quote #3

Sorry

For this time these 4 plugins is enough

Tanks for your reply.
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_human_armor.sma - 612 views - 1.6 KB)
File Type: sma Get Plugin or Get Source (zp_extra_molotov_cocktail.sma - 592 views - 23.4 KB)
File Type: sma Get Plugin or Get Source (force_shield_grenade.sma - 166 views - 7.5 KB)
File Type: sma Get Plugin or Get Source (zp_extra_knife_blink.sma - 557 views - 5.8 KB)
__________________

Last edited by M@RSH@L; 05-15-2013 at 14:33.
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-16-2013 , 01:00   Re: [REQ] Item Limiter Plugin
Reply With Quote #4

Try and tell if this works..... Then i'll also make others.....

PHP Code:
/*================================================================================
    
    -------------------------------------------
    -*- [ZP] Extra Item: Knife Blink 1.2 -*-
    -------------------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This item/upgrade gives zombies the possibility to move rapidly towards a human over a short distance, when aiming at him and holding down the attack button.
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <chr_engine>

#define MIN_DISTANCE 50

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

new const g_item_name[] = { "Knife Blink (once)" }
const 
g_item_cost 5
const g_iMaxDistance 300;
new 
g_limit[33], cvar_limit_kb

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

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;

public 
plugin_init(){
    
    
register_plugin("[ZP] Extra Item: Knife Blink""1.2""pharse");
    
    
g_iMaxPlayers get_maxplayers();
    
    
g_itemid_blink zp_register_extra_item(g_item_nameg_item_costZP_TEAM_ZOMBIE);

        
cvar_limit_kb register_cvar("zp_limit_kb","3")  
    
    
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], conditionsidtrace){
    
    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(traceTR_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] == )
        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(playeritemid)
{
    if (
itemid == g_itemid_blink )
        {
 
          if (
g_limit[player] <= get_pcvar_num(cvar_limit_kb))
          {
        
        
g_iBlinks[player] += 1;
                
g_limit[player] += 1
        
client_print(playerprint_chat"[ZP] You have now %d Knife Blinks"g_iBlinks[player]);
          }

          else
          {
        
          
client_print(playerprint_chat"[ZP] Max Knife Blinks Reached !!!")



          } 



    }

        

}

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

// ================================================== //
//             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(idorigin0);
    
get_user_origin(enemyorigin_enemy0);
    
    new 
distance get_distance(originorigin_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(enemypev_originorigin_enemy);
    
entity_set_aim(idorigin_enemy);
    
    
get_speed_vector2(idenemyg_fSpeednew_velocity)
    
set_pev(idpev_velocitynew_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(idpev_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,460.0);
            
set_pdata_float(ent,470.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(0print_chat"[ZP] %s just used a Knife Blink!"name);
            
client_print(idprint_chat"[ZP] %d Knife Blinks remaining"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[], ownerjghgtype 0) {
    new 
strtype[11] = "classname"ent index;
    switch (
jghgtype) {
        case 
1strtype "target";
        case 
2strtype "targetname";
    }

    while ((
ent engfunc(EngFunc_FindEntityByStringentstrtypeclassname)) && pev(entpev_owner) != owner) {}

    return 
ent;

Catastrophe is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 05-16-2013 , 13:42   Re: [REQ] Item Limiter Plugin
Reply With Quote #5

yes it works fine , but when compiling sma give 4 warnings .
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-17-2013 , 00:40   Re: [REQ] Item Limiter Plugin
Reply With Quote #6

Post the warnings plzzz..
Catastrophe is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 05-17-2013 , 05:26   Re: [REQ] Item Limiter Plugin
Reply With Quote #7

<53> : Warning 217: Loose indentation
<55> : Warning 217: Loose indentation
<145> : Warning 217: Loose indentation
<146> : Warning 217: Loose indentation
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-17-2013 , 10:59   Re: [REQ] Item Limiter Plugin
Reply With Quote #8

Ohk lol that .... i thoought whtever warnings u were getting xD.... W8 i'll allso convert other plugins and fix this one ....
Catastrophe is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 05-17-2013 , 12:28   Re: [REQ] Item Limiter Plugin
Reply With Quote #9

All done ...
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_human_armor.sma - 509 views - 2.2 KB)
File Type: sma Get Plugin or Get Source (zp_extra_molotov.sma - 583 views - 23.8 KB)
File Type: sma Get Plugin or Get Source (zp_extra_knife_blink.sma - 633 views - 7.1 KB)
File Type: sma Get Plugin or Get Source (force_shield_grenade.sma - 165 views - 8.0 KB)
Catastrophe is offline
M@RSH@L
Member
Join Date: Jan 2012
Old 05-17-2013 , 12:56   Re: [REQ] Item Limiter Plugin
Reply With Quote #10

GJ Catastrophe

it's Great

can u make a main plugin that can add limit to extra items ?
__________________
M@RSH@L is offline
Send a message via Yahoo to M@RSH@L Send a message via Skype™ to M@RSH@L
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode