Raised This Month: $ Target: $400
 0% 

Edit PVIP Shop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tedaimlocks
Member
Join Date: Jan 2024
Old 04-24-2024 , 08:38   Edit PVIP Shop
Reply With Quote #1

Hello, could someone edit my pvipshop and make a .ini file for it?

For example:
Create a ini file called zp_pvipshop.ini
And inside that file i want it to be like this



[Extraitems]
"Name of the item in menu" "Item" "Price" "RoundLimit" "MapLimit"

"Shining Heart" "Shining Heart Rod" "65000" "" "1" // also if the "" for the respective function is empty that means there wont be any round limit or map limit

* You can remove the hardcoded armor and health, i have another plugin for them.

HTML Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <zp_buymenu>
#include <colorchat>
#include <zombieplague>

#define PLUGIN "PVIP Shop"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

#define PVIP_FLAG ADMIN_LEVEL_D

#define MAX_USES_PER_ROUND 5
#define MAX_USES_PER_MAP 1

new HasUsedItemArmorPerRoundLimit[33][MAX_USES_PER_ROUND]
new HasUsedItemHealthPerRoundLimit[33][MAX_USES_PER_ROUND]
new HasUsedItem1PerMapLimit[33][MAX_USES_PER_MAP]
new HasUsedItem2PerMapLimit[33][MAX_USES_PER_MAP]
new HasUsedItem3PerMapLimit[33][MAX_USES_PER_MAP]

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /pvip", "PVIPMenu")
    register_logevent("logevent_RoundStart", 2, "1=Round_Start");
}

public logevent_RoundStart() {
    new i, j;
    for (i = 0; i < sizeof(HasUsedItemArmorPerRoundLimit); i++) {
        for (j = 0; j < MAX_USES_PER_ROUND; j++) {
            HasUsedItemArmorPerRoundLimit[i][j] = false;
        }
    }
    for (i = 0; i < sizeof(HasUsedItemHealthPerRoundLimit); i++) {
        for (j = 0; j < MAX_USES_PER_ROUND; j++) {
            HasUsedItemHealthPerRoundLimit[i][j] = false;
        }
    }
}

public PVIPMenu(id) {
    if(!(get_user_flags(id) & PVIP_FLAG) || !is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id)) {
        return PLUGIN_HANDLED;
    }

    new title[198];
    new money = zp_cs_get_user_money(id);
    formatex(title, charsmax(title), "\ySPK - Zombie Plague \r[CSO] \d | PVIP Shop^nMoney: %d", money);

    new menu = menu_create(title, "PVIPMenuHandler");

    new ArmorUsesRound = GetNumUsesRound(id, HasUsedItemArmorPerRoundLimit);
    new HealthUsesRound = GetNumUsesRound(id, HasUsedItemHealthPerRoundLimit);
    new ShiningHeartRodUsesMap = GetNumUsesMap(id, HasUsedItem1PerMapLimit);
    new NemesisUsesMap = GetNumUsesMap(id, HasUsedItem2PerMapLimit);
    new SurvivorUsesMap = GetNumUsesMap(id, HasUsedItem3PerMapLimit);

    new ArmorMenuItemRoundLimit[128];
    new HealthMenuItemRoundLimit[128];
    new ItemShiningHeartRodMapLimit[128];
    new ItemNemesisMapLimit[128];
    new ItemSurvivorMapLimit[128];

    if(zp_cs_get_user_money(id) <= 2499) {
        format(ArmorMenuItemRoundLimit, sizeof(ArmorMenuItemRoundLimit), "\d100 Armor \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", ArmorUsesRound, MAX_USES_PER_ROUND);
        format(HealthMenuItemRoundLimit, sizeof(HealthMenuItemRoundLimit), "\d100 Health \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", HealthUsesRound, MAX_USES_PER_ROUND);
        format(ItemShiningHeartRodMapLimit, sizeof(ItemShiningHeartRodMapLimit), "\dShining Heart Rod \d[\r%d\d/\y%d \rper map\d] \d| \y[\r65000$\y]", ShiningHeartRodUsesMap, MAX_USES_PER_MAP);
        format(ItemNemesisMapLimit, sizeof(ItemNemesisMapLimit), "\dNemesis \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", NemesisUsesMap, MAX_USES_PER_MAP);
        format(ItemSurvivorMapLimit, sizeof(ItemSurvivorMapLimit), "\dSurvivor \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", SurvivorUsesMap, MAX_USES_PER_MAP);
    }

    else if(zp_cs_get_user_money(id) <= 64999) {
        format(ArmorMenuItemRoundLimit, sizeof(ArmorMenuItemRoundLimit), "100 Armor \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", ArmorUsesRound, MAX_USES_PER_ROUND);
        format(HealthMenuItemRoundLimit, sizeof(HealthMenuItemRoundLimit), "100 Health \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", HealthUsesRound, MAX_USES_PER_ROUND);
        format(ItemShiningHeartRodMapLimit, sizeof(ItemShiningHeartRodMapLimit), "\dShining Heart Rod \d[\r%d\d/\y%d \rper map\d] \d| \y[\r65000$\y]", ShiningHeartRodUsesMap, MAX_USES_PER_MAP);
        format(ItemNemesisMapLimit, sizeof(ItemNemesisMapLimit), "\dNemesis \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", NemesisUsesMap, MAX_USES_PER_MAP);
        format(ItemSurvivorMapLimit, sizeof(ItemSurvivorMapLimit), "\dSurvivor \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", SurvivorUsesMap, MAX_USES_PER_MAP);
    }

    else if(zp_cs_get_user_money(id) <= 149999) {
        format(ArmorMenuItemRoundLimit, sizeof(ArmorMenuItemRoundLimit), "100 Armor \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", ArmorUsesRound, MAX_USES_PER_ROUND);
        format(HealthMenuItemRoundLimit, sizeof(HealthMenuItemRoundLimit), "100 Health \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", HealthUsesRound, MAX_USES_PER_ROUND);
        format(ItemShiningHeartRodMapLimit, sizeof(ItemShiningHeartRodMapLimit), "Shining Heart Rod \d[\r%d\d/\y%d \rper map\d] \d| \y[\r65000$\y]", ShiningHeartRodUsesMap, MAX_USES_PER_MAP);
        format(ItemNemesisMapLimit, sizeof(ItemNemesisMapLimit), "\dNemesis \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", NemesisUsesMap, MAX_USES_PER_MAP);
        format(ItemSurvivorMapLimit, sizeof(ItemSurvivorMapLimit), "\dSurvivor \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", SurvivorUsesMap, MAX_USES_PER_MAP);
    }

    else {
    format(ArmorMenuItemRoundLimit, sizeof(ArmorMenuItemRoundLimit), "100 Armor \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", ArmorUsesRound, MAX_USES_PER_ROUND);
    format(HealthMenuItemRoundLimit, sizeof(HealthMenuItemRoundLimit), "100 Health \d[\r%d\d/\y%d \rper round\d] \d| \y[\r2500$\y]", HealthUsesRound, MAX_USES_PER_ROUND);
    format(ItemShiningHeartRodMapLimit, sizeof(ItemShiningHeartRodMapLimit), "Shining Heart Rod \d[\r%d\d/\y%d \rper map\d] \d| \y[\r65000$\y]", ShiningHeartRodUsesMap, MAX_USES_PER_MAP);
    format(ItemNemesisMapLimit, sizeof(ItemNemesisMapLimit), "Nemesis \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", NemesisUsesMap, MAX_USES_PER_MAP);
    format(ItemSurvivorMapLimit, sizeof(ItemSurvivorMapLimit), "Survivor \d[\r%d\d/\y%d \rper map\d] \d| \y[\r150000$\y]", SurvivorUsesMap, MAX_USES_PER_MAP);
    }

    menu_additem(menu, ArmorMenuItemRoundLimit, "1");
    menu_additem(menu, HealthMenuItemRoundLimit, "2");
    menu_additem(menu, ItemShiningHeartRodMapLimit, "3");
    menu_additem(menu, ItemNemesisMapLimit, "4");
    menu_additem(menu, ItemSurvivorMapLimit, "5");

    menu_setprop(menu, MPROP_EXITNAME, "Exit");
    menu_display(id, menu);
    return PLUGIN_CONTINUE;
}

public PVIPMenuHandler(id, menu, item) {
    switch(item) {
        case 0: {
            if(is_user_alive(id))
                PVIPMenuItemArmorPerRoundLimit(id);
            else
                return PLUGIN_HANDLED;
        }
        case 1: {
            if(is_user_alive(id))
                PVIPMenuItemHealthPerRoundLimit(id);
            else
                return PLUGIN_HANDLED;
        }
        case 2: {
            if(is_user_alive(id))
                PVIPMenuItem1PerMapLimit(id);
            else
                return PLUGIN_HANDLED;
        }
        case 3: {
            if(is_user_alive(id))
                PVIPMenuItem2PerMapLimit(id);
            else
                return PLUGIN_HANDLED;
        }
        case 4: {
            if(is_user_alive(id))
                PVIPMenuItem3PerMapLimit(id);
            else
                return PLUGIN_HANDLED;
        }
    }
    return PLUGIN_CONTINUE;
}

public PVIPMenuItemArmorPerRoundLimit(id) {
    new uses = GetNumUsesRound(id, HasUsedItemArmorPerRoundLimit);
    if (uses >= MAX_USES_PER_ROUND) {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 You have reached the maximum uses of^x04 Armor^x03 for this round.");
        return PLUGIN_HANDLED;
    }
    if(zp_cs_get_user_money(id) <= 2499) {
        return PLUGIN_HANDLED;
    }
    zp_cs_set_user_money(id, zp_cs_get_user_money(id) - 2500);
    set_user_armor(id, get_user_armor(id) + 100);
    HasUsedItemArmorPerRoundLimit[id][uses] = true;
    return PLUGIN_CONTINUE;
}

public PVIPMenuItemHealthPerRoundLimit(id) {
    new uses = GetNumUsesRound(id, HasUsedItemHealthPerRoundLimit);
    if (uses >= MAX_USES_PER_ROUND) {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 You have reached the maximum uses of^x04 Health^x03 for this round.");
        return PLUGIN_HANDLED;
    }
    if(zp_cs_get_user_money(id) <= 2499) {
        return PLUGIN_HANDLED;
    }
    zp_cs_set_user_money(id, zp_cs_get_user_money(id) - 2500);
    set_user_health(id, get_user_health(id) + 100);
    HasUsedItemHealthPerRoundLimit[id][uses] = true;
    return PLUGIN_CONTINUE;
}
public PVIPMenuItem1PerMapLimit(id) {
    new uses = GetNumUsesMap(id, HasUsedItem1PerMapLimit);
    if (uses >= MAX_USES_PER_MAP) {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 You have reached the maximum uses of^x04 Shining Heart Rod^x03 for this map.");
        return PLUGIN_HANDLED;
    }

    if (zp_get_extra_item_id("Shining Heart Rod") != -1) {
        if(zp_cs_get_user_money(id) <= 64999) {
            return PLUGIN_HANDLED;
        }
        zp_cs_set_user_money(id, zp_cs_get_user_money(id) - 65000);
        zp_force_buy_extra_item(id, zp_get_extra_item_id("Shining Heart Rod"), 1);
        HasUsedItem1PerMapLimit[id][uses] = true;
    }
    else {
        if(zp_cs_get_user_money(id) <= 64999) {
            return PLUGIN_HANDLED;
        }
        else {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 The item^x04 Shining Heart Rod^x03 was not found.");
        HasUsedItem1PerMapLimit[id][uses] = false;
        }
    }
    return PLUGIN_CONTINUE;
}

public PVIPMenuItem2PerMapLimit(id) {
    new uses = GetNumUsesMap(id, HasUsedItem2PerMapLimit);
    if (uses >= MAX_USES_PER_MAP) {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 You have reached the maximum uses of^x04 Nemesis^x03 for this map.");
        return PLUGIN_HANDLED;
    }

    if(zp_has_round_started()) {
        return PLUGIN_HANDLED;
    }

    if (zp_get_extra_item_id("Nemesis") != -1) {
        if(zp_cs_get_user_money(id) <= 149999) {
            return PLUGIN_HANDLED;
        }
        zp_cs_set_user_money(id, zp_cs_get_user_money(id) - 150000);
        zp_force_buy_extra_item(id, zp_get_extra_item_id("Nemesis"), 1);
        HasUsedItem2PerMapLimit[id][uses] = true;
    }
    else {
        if(zp_cs_get_user_money(id) <= 149999) {
            return PLUGIN_HANDLED;
        }
        else {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 The item^x04 Nemesis^x03 was not found.");
        HasUsedItem2PerMapLimit[id][uses] = false;
        }
    }
    return PLUGIN_CONTINUE;
}

public PVIPMenuItem3PerMapLimit(id) {
    new uses = GetNumUsesMap(id, HasUsedItem3PerMapLimit);
    if (uses >= MAX_USES_PER_MAP) {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 You have reached the maximum uses of^x04 Survivor^x03 for this map.");
        return PLUGIN_HANDLED;
    }

    if(zp_has_round_started()) {
        return PLUGIN_HANDLED;
    }

    if (zp_get_extra_item_id("Survivor") != -1) {
        if(zp_cs_get_user_money(id) <= 149999) {
            return PLUGIN_HANDLED;
        }
        zp_cs_set_user_money(id, zp_cs_get_user_money(id) - 150000);
        zp_force_buy_extra_item(id, zp_get_extra_item_id("Survivor"), 1);
        HasUsedItem3PerMapLimit[id][uses] = true;
    }
    else {
        if(zp_cs_get_user_money(id) <= 149999) {
            return PLUGIN_HANDLED;
        }
        else {
        ColorChat(id, GREEN, "^x01[^x04SPK ZM^x01]^x03 The item^x04 Survivor^x03 was not found.");
        HasUsedItem3PerMapLimit[id][uses] = false;
        }
    }
    return PLUGIN_CONTINUE;
}

public GetNumUsesRound(id, array[][])
{
    new uses = 0;
    new i;
    for (i = 0; i < MAX_USES_PER_ROUND; i++)
    {
        if (array[id][i])
        {
            uses++;
        }
    }
    return uses;
}

public GetNumUsesMap(id, array[][])
{
    new uses = 0;
    new i;
    for (i = 0; i < MAX_USES_PER_MAP; i++)
    {
        if (array[id][i])
        {
            uses++;
        }
    }
    return uses;
}

Last edited by tedaimlocks; 04-24-2024 at 13:00.
tedaimlocks is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 04-29-2024 , 01:16   Re: Edit PVIP Shop
Reply With Quote #2

Anyone?
tedaimlocks is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 05-05-2024 , 07:05   Re: Edit PVIP Shop
Reply With Quote #3

Anyone? if someone could even make the ini file read thingy would be great
tedaimlocks is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old Yesterday , 20:37   Re: Edit PVIP Shop
Reply With Quote #4

im unable to test this locally
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <zombieplague>
#include <zp_buymenu>

enum _:_table
{
    function,
    
item_name[MAX_NAME_LENGTH],
    
item[MAX_NAME_LENGTH],
    
amount,
    
price,
    
round_limit,
    
map_limit
}
new const 
table[][_table] =
{
    { 
0"100 Armor"""100200330},
    { 
1"100 Health"""100200330},
    
// extra item addon starting here
    
2"Shining Heart Rod""Shining Heart Rod"/*always zero*/0200330},
    { 
3"Nemesis""Nemesis"/*always zero*/0200330},
    { 
4"Survivor""Survivor"/*always zero*/0200330}
}
new 
player[MAX_PLAYERS 1][sizeof(table)*2]
function_do(idi)
{
    new 
money zp_cs_get_user_money(id)
    if (
money >= table[i][price])
    {
        if (
player[id][i] < table[i][round_limit] && player[id][sizeof(table)-i] < table[i][map_limit])
        {
            switch (
i)
            {
                case 
0set_user_armor(idget_user_armor(id) + table[i][amount])
                case 
1set_user_health(idget_user_health(id) + table[i][amount])
                case 
2..sizeof(table):
                {
                    if (
zp_get_extra_item_id(table[i][item]) != -1)
                        
zp_force_buy_extra_item(idzp_get_extra_item_id(table[i][item]), 1)
                    else
                    {
                        
client_print_color(idprint_team_default"^4Missing extra item addon")
                        return 
PLUGIN_HANDLED
                    
}
                }
            }

            
client_print_color(idprint_team_red"^3Successfully purchased ^4%s"table[i][item_name])
            
zp_cs_set_user_money(idmoney table[i][price])
            
player[id][i]++
            
player[id][sizeof(table)-i]++
        }

        else
        {
            if (
player[id][sizeof(table)-i] >= table[i][map_limit])
                
client_print_color(idprint_team_red"^4Reached ^3map limit (%d)"table[i][map_limit])
            else
                
client_print_color(idprint_team_red"^4Reached ^3round limit (%d)"table[i][round_limit])
        }
    }

    else
        
client_print_color(idprint_team_default"^4Missing funds")

    return 
PLUGIN_CONTINUE
}

public 
plugin_init()
{
    
register_clcmd("say /pvip""clcmd_f")
    
register_logevent("round_start"2"1=Round_Start")
}

public 
clcmd_f(id)
{
    new 
menu menu_create("shop""menu_handler")
    for (new 
0sizeof(table); i++)
    {
        
menu_additem(menufmt("%s%s (%d/%d)"
            
bool:(
                (
player[id][i] < table[i][round_limit] && player[id][sizeof(table)-i] < table[i][map_limit]) &&
                (
zp_cs_get_user_money(id) >= table[i][price])
            ? 
"" "\d"table[i][item_name]),
            
player[id][i], table[i][round_limit]))
    }
    
menu_display(idmenu)
}

public 
round_start()
{
    for (new 
0<= MAX_PLAYERSi++)
        
arrayset(player[i], 0sizeof(table))
}

public 
menu_handler(idmenui)
{
    
menu_destroy(menu)
    if (
!= MENU_EXIT)
        
function_do(idi)

__________________
bigdaddy424 is offline
tedaimlocks
Member
Join Date: Jan 2024
Old Today , 09:08   Re: Edit PVIP Shop
Reply With Quote #5

I get errors when compiling it, and its not quite what i wanted ( i wanted a 3rd party file called zp_pvipitems.ini in addons/amxmodx/configs) . Appreciate the effort though.

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

text6BUoEi.sma(12) : error 017: undefined symbol "MAX_NAME_LENGTH"
text6BUoEi.sma(21) : warning 228: length of initialler exceeds size of the enum field
text6BUoEi.sma(21) : warning 228: length of initialler exceeds size of the enum field
text6BUoEi.sma(21) : error 018: initialization data exceeds declared size
text6BUoEi.sma(24) : warning 228: length of initialler exceeds size of the enum field
text6BUoEi.sma(24) : warning 228: length of initialler exceeds size of the enum field
text6BUoEi.sma(24) : error 018: initialization data exceeds declared size
text6BUoEi.sma(2 : error 017: undefined symbol "MAX_PLAYERS"
text6BUoEi.sma(46) : error 017: undefined symbol "client_print_color"
text6BUoEi.sma(46) : warning 215: expression has no effect
text6BUoEi.sma(46) : error 001: expected token: ";", but found ")"
text6BUoEi.sma(46) : error 029: invalid expression, assumed zero
text6BUoEi.sma(46) : fatal error 107: too many error messages on one line

Compilation aborted.
8 Errors.

Last edited by tedaimlocks; Today at 09:08.
tedaimlocks is offline
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 19:04.


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