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

ZP plugin - stop buy


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 08:07.


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