Raised This Month: $ Target: $400
 0% 

[Solved] Zp Human Armor


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-12-2014 , 03:19   [Solved] Zp Human Armor
Reply With Quote #1

i modified original source from mercylez Zp Anti-Infection Armor to Buy 100 & 200 Armor Items , but when i want to buy 200 Armor its Giving only 100 !!! and when i reach limit of armor, i try to buy more
its taking all my ammo packs left only 1 ammo pack.. anyone some help pls ?

modified source
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

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

new const g_item_name1[] = "Armor \y(100ap)"
new const g_item_name2[] = "Armor \y(200ap)"
new const g_sound_buyarmor[] = "items/ammopickup2.wav"
const g_item_cost 5
const g_item2_cost 10

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

// Item IDs
new g_itemid_humanarmor1
new g_itemid_humanarmor2

new g_maxplayersg_msgSayTextcvar_armor_amount1cvar_armor_amount2cvar_armor_limit
new g_MsgSync;
public 
plugin_init()
{
    
register_plugin("[ZP] Extra Item: Anti-Infection Armor""1.1""MeRcyLeZZ, 93()|29!/<")
    
    
g_itemid_humanarmor1 zp_register_extra_item(g_item_name1g_item_costZP_TEAM_HUMAN)
    
g_itemid_humanarmor2 zp_register_extra_item(g_item_name2g_item2_costZP_TEAM_HUMAN)
    
    
cvar_armor_amount1 register_cvar("zp_armor_amount1""100")
    
cvar_armor_amount2 register_cvar("zp_armor_amount2""200")
    
cvar_armor_limit register_cvar("zp_armor_limit""235")
    
    
g_msgSayText get_user_msgid("SayText")
    
g_maxplayers get_maxplayers()
    
g_MsgSync CreateHudSyncObj();
}

public 
plugin_precache()
{
    
precache_sound(g_sound_buyarmor)
}

// Human buys our upgrade, give him some armor
public zp_extra_item_selected(iditemid)
{
    if (
itemid != g_itemid_humanarmor1 && itemid != g_itemid_humanarmor2)
        return;
    
    if ((
pev(idpev_armorvalue)) >= get_pcvar_num(cvar_armor_limit))
    {
        
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + g_item_cost && g_item2_cost)
        
zp_colored_print(id"^x04[ZP]^x01 You Already Have^x04One")
        
        return;
    }
    new 
name532 ]
    
get_user_nameidname531 )    
    if (
itemid == g_itemid_humanarmor1)
    {
    
set_pev(idpev_armorvaluefloat(min(pev(idpev_armorvalue) + get_pcvar_num(cvar_armor_amount1), get_pcvar_num(cvar_armor_limit))))
    
engfunc(EngFunc_EmitSoundidCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM)    
    
zp_colored_print(id,"^x04[ZP] %s^x01 bought^x04 Armor (100ap)^x01 !"name5)
    
set_hudmessage2551450, -1.00.710.05.01.01.0, -)
    
ShowSyncHudMsg0g_MsgSync"%s has been equiped with 100 AP!"name5 )
    }

    if (
itemid == g_itemid_humanarmor2)
    {
    
set_pev(idpev_armorvaluefloat(min(pev(idpev_armorvalue) + get_pcvar_num(cvar_armor_amount2), get_pcvar_num(cvar_armor_limit))))
    
engfunc(EngFunc_EmitSoundidCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM)    
    
zp_colored_print(id,"^x04[ZP] %s^x01 bought^x04 Armor (200ap)^x01 !"name5)
    
set_hudmessage2551450, -1.00.710.05.01.01.0, -)
    
ShowSyncHudMsg0g_MsgSync"%s has been equiped with 200 AP!"name5 )
    }    
}

// Colored chat print
zp_colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

original source
PHP Code:
/*================================================================================
    
    -------------------------------------------------
    -*- [ZP] Extra Item: Anti-Infection Armor 1.1 -*-
    -------------------------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This item gives humans some armor that offers protection
    against zombie injuries.
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplaguenew>

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

new const g_item_name[] = "Armura Anti-Infectie"
new const g_sound_buyarmor[] = "items/ammopickup2.wav"
const g_item_cost 15

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

// Item IDs
new g_itemid_humanarmor

new g_maxplayersg_msgSayTextcvar_armor_amountcvar_armor_limit

public plugin_init()
{
    
register_plugin("[ZP] Extra Item: Anti-Infection Armor""1.1""MeRcyLeZZ, 93()|29!/<")
    
    
g_itemid_humanarmor zp_register_extra_item(g_item_nameg_item_costZP_TEAM_HUMAN)
    
    
cvar_armor_amount register_cvar("zp_armor_amount""150")
    
cvar_armor_limit register_cvar("zp_armor_limit""750")
    
    
g_msgSayText get_user_msgid("SayText")
    
g_maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    
precache_sound(g_sound_buyarmor)
}

// Human buys our upgrade, give him some armor
public zp_extra_item_selected(iditemid)
{
    if (
itemid != g_itemid_humanarmor)
        return;
    
    if ((
pev(idpev_armorvalue)) >= get_pcvar_num(cvar_armor_limit))
    {
        
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + g_item_cost)
        
zp_colored_print(id"^x04[ZP]^x01 Aveti deja cantitatea maxima de armura")
        
        return;
    }
    
    
set_pev(idpev_armorvaluefloat(min(pev(idpev_armorvalue) + get_pcvar_num(cvar_armor_amount), get_pcvar_num(cvar_armor_limit))))
    
engfunc(EngFunc_EmitSoundidCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM)
}

// Colored chat print
zp_colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

__________________

Last edited by ghost95v; 09-12-2014 at 12:08.
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 09-12-2014 , 04:54   Re: [Sloved] Zp Human Armor
Reply With Quote #2

Just use below plugin:

Buy Armor v2 (Now, you can buy 2 different value of armor. There is also hud message that displayed who has bought the armor)
zmd94 is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-12-2014 , 09:07   Re: [Sloved] Zp Human Armor
Reply With Quote #3

Quote:
Originally Posted by zmd94 View Post
Just use below plugin:

Buy Armor v2 (Now, you can buy 2 different value of armor. There is also hud message that displayed who has bought the armor)
Thank you i already sloved
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
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:13.


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