AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ZP plugin - stop buy (https://forums.alliedmods.net/showthread.php?t=339621)

maNIaRO 09-21-2022 18:13

ZP plugin - stop buy
 
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] ++
        }
    } 



Natsheh 09-21-2022 18:29

Re: ZP plugin - stop buy
 
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] ++
        } 

:arrow:
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] ++
        } 



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

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