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

ZP plugin - stop buy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maNIaRO
Member
Join Date: Nov 2014
Old 09-21-2022 , 18:13   ZP plugin - stop buy
Reply With Quote #1

Hi everyone,
I have the following plugin for buying 100 armor, for ZP. It is also made to buy maximum 2 times.
When you buy armor, it says a message in chat, and after 2 times, says another message.
But even after second time, my 10 ammo goes away. I do not receive armor and I see the message that I can buy only 2 times, but how can I block to not use any ammo after second time?


Thanks

PHP Code:
#include <amxmodx> 
#include <fakemeta> 
#include <zombieplague>
#include <zp50_colorchat>

new const g_item_name[] = { "Anti-Infection Armor \r[100]" 
const 
g_item_cost 10

new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" 
const 
g_armor_amount 100 
const g_armor_limit 200 

new g_ItemCount[33]
new 
g_itemid_armor 

public plugin_precache() 

    
precache_sound(g_sound_buyarmor


public 
plugin_init() 

    
register_plugin("[ZP] Extra: Anti-Infection Armor""1.0""MeRcyLeZZ"
        
    
g_itemid_armor zp_register_extra_item(g_item_nameg_item_costZP_TEAM_HUMAN
}

// Human buys our upgrade, give him some armor 
public zp_extra_item_selected(playeritemid

    if (
itemid == g_itemid_armor
    { 
        if(
g_ItemCount[player] >= 2)
        {
            
zp_colored_print(0"You are allowed to buy armor only^4 2 times^1 per round! Max.^3 200ap^1.")
            
ZP_PLUGIN_HANDLED
        
}
        else
        
zp_colored_print(0"You successfully bought^4 100ap^1.")
        {
            
set_pev(playerpev_armorvaluefloat(min(pev(playerpev_armorvalue)+g_armor_amountg_armor_limit))) 
            
engfunc(EngFunc_EmitSoundplayerCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM
            
            
g_ItemCount[player] ++
        }
    } 

maNIaRO is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-21-2022 , 18:29   Re: ZP plugin - stop buy
Reply With Quote #2

PHP Code:
        if(g_ItemCount[player] >= 2)
        {
            
zp_colored_print(0"You are allowed to buy armor only^4 2 times^1 per round! Max.^3 200ap^1.")
            
ZP_PLUGIN_HANDLED
        
}
        else
        
zp_colored_print(0"You successfully bought^4 100ap^1.")
        {
            
set_pev(playerpev_armorvaluefloat(min(pev(playerpev_armorvalue)+g_armor_amountg_armor_limit))) 
            
engfunc(EngFunc_EmitSoundplayerCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM
            
            
g_ItemCount[player] ++
        } 

PHP Code:
        if(g_ItemCount[player] >= 2)
        {
            
zp_colored_print(0"You are allowed to buy armor only^4 2 times^1 per round! Max.^3 200ap^1.")
            return 
ZP_PLUGIN_HANDLED
        
}
        else
        {
            
zp_colored_print(0"You successfully bought^4 100ap^1.")
            
set_pev(playerpev_armorvaluefloat(min(pev(playerpev_armorvalue)+g_armor_amountg_armor_limit))) 
            
engfunc(EngFunc_EmitSoundplayerCHAN_BODYg_sound_buyarmor1.0ATTN_NORM0PITCH_NORM
            
            
g_ItemCount[player] ++
        } 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-21-2022 at 18:30.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply


Thread Tools
Display Modes

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 01:10.


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