Возможность загнать игрока в минус...

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
15
Реакции
2
Ошибка
Загоняет в минус аммо, лвл, опыт
ОС
Windows
Amx Mod X
AMX Mod X 1.10.0.5378 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Aug 2 2019 00:49:04
Built from: https://github.com/alliedmodders/amxmodx/commit/0bd69445
Build ID: 5378:0bd69445
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.6.3.7/Stdio (cstrike)
ReHLDS version: 3.7.0.688-dev
Build date: 17:03:18 Sep 5 2019 (1972)
Build from: https://github.com/dreamstalker/rehlds/commit/262f443
ReGamedll
ReGameDLL version: 5.11.0.418-dev
Build date: 18:38:08 Sep 23 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/46624d9
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 15:47:38 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
description           stat pend  file                         vers          src  load  unload
[ 1] AMX Mod X RUN - amxmodx_mm.dll v1.10.0.5378 ini Start ANY
[ 2] Reunion RUN - reunion_mm.dll v0.1.0.92 ini Start Never
[ 3] Revoice RUN - revoice_mm.dll v0.1.0.32 ini Start Never
[ 4] Ultimate Unprecacher RUN - ultimate_unprecacher_mm.dll vBeta 2.5.3 ini Chlvl Chlvl
[ 5] POD-Bot mm RUN - podbot_mm.dll v3.0B18c ini Chlvl ANY
[ 6] CStrike RUN - cstrike_amxx.dll v1.10.0.5378 pl1 ANY ANY
[ 7] FakeMeta RUN - fakemeta_amxx.dll v1.10.0.5378 pl1 ANY ANY
[ 8] Ham Sandwich RUN - hamsandwich_amxx.dll v1.10.0.5378 pl1 ANY ANY
[ 9] Engine RUN - engine_amxx.dll v1.10.0.5378 pl1 ANY ANY
[10] Fun RUN - fun_amxx.dll v1.10.0.5378 pl1 ANY ANY
10 plugins, 10 running
Список плагинов
[  1] Admin Base              1.10.0.537  AMXX Dev Team     admin.amxx       running
[ 2] Admin Commands 1.10.0.537 AMXX Dev Team admincmd.amxx running
[ 3] Slots Reservation 1.10.0.537 AMXX Dev Team adminslots.amxx running
[ 4] Menus Front-End 1.10.0.537 AMXX Dev Team menufront.amxx running
[ 5] Players Menu 1.10.0.537 AMXX Dev Team plmenu.amxx running
[ 6] Maps Menu 1.10.0.537 AMXX Dev Team mapsmenu.amxx running
[ 7] Admin Chat 1.10.0.537 AMXX Dev Team adminchat.amxx running
[ 8] Anti Flood 1.10.0.537 AMXX Dev Team antiflood.amxx running
[ 9] Zombie Plague 4.3 Fix5a MeRcyLeZZ zombie_plague40 debug
[ 10] unknown unknown unknown zp_bm_check_dis running
[ 11] Custom Models 1.3.2 neugomon zp_custom_model running
[ 12] [ZP]Level System 6.0 Dambas zp_level_system running
[ 13] unknown unknown unknown zmo_addon_camer running
[ 14] [AMXX] Menus 0.0.1 1331 xman2030_menu_p debug
[ 15] [ZP] Default Zombie Cl 4.3 Fix5 MeRcyLeZZ zp_zclasses40.a running
[ 16] [ZP] Extra Item: Immun 3.0 ZigiZagi zp_extra_immuni running
[ 17] unknown unknown unknown zp_extra_grenad debug
[ 18] unknown unknown unknown zp_extra_grenad debug
[ 19] unknown unknown unknown admin_menu.amxx running
Добрый день,
Коротко о плагине: Мод Zombie plague, возможность выдать/забрать игрокам аммо, уровень и опыт

При функции "забрать" может полностью загнать игрока в минус (аммо, уровень, и опыт)
Помогите пожалуйста исправить, чтобы у игрока ниже нуля нельзя ничего было забрать

Код:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>

new g_szMenu_give[33]

new g_menu_data[33]
#define MENU_PAGE_PLAYERS g_menu_data[id]

const KEYSMENU2 = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_0
public plugin_init()
{
    register_clcmd("menu_give", "clcd_give_menu");
    register_menu("Give Menu", KEYSMENU2, "menu_give")   
}

public clcd_give_menu(id) return show_ad_menu(id);

show_ad_menu(id)
{
    if (!is_user_connected(id))
    return PLUGIN_CONTINUE;
    
    static menu[512]
    new len
    
    len += formatex(menu[len], charsmax(menu) - len, "\r[ZP] \wЧумовые \yЗомбарики \r| \wЯдерное меню \r[BZ]^n^n\yВыдать:^n")
        
    len += formatex(menu[len], charsmax(menu) - len, "\r[1] \wАммо \r(500)^n")
    len += formatex(menu[len], charsmax(menu) - len, "\r[2] \wУровень \r(1)^n")
    len += formatex(menu[len], charsmax(menu) - len, "\r[3] \wОпыт \r(10)^n^n\yЗабрать:^n")
    len += formatex(menu[len], charsmax(menu) - len, "\r[4] \wАммо \r(500)^n")
    len += formatex(menu[len], charsmax(menu) - len, "\r[5] \wУровень \r(1)^n")
    len += formatex(menu[len], charsmax(menu) - len, "\r[6] \wОпыт \r(10)^n")
        
    len += formatex(menu[len], charsmax(menu) - len, "^n\r[0]\w Выход")
    
    set_pdata_int(id, 205, 0)
    show_menu(id, KEYSMENU2, menu, -1, "Give Menu")
    
    return PLUGIN_CONTINUE;   
}

public menu_give(id, key)
{
    if (!is_user_connected(id))
    return
    
    switch(key)
    {
        case 0:
        {
          g_szMenu_give[id]=0
          show_menu_player_list(id)
        }
        case 1:
        {
            g_szMenu_give[id]=1
            show_menu_player_list(id)
        }
        case 2:
        {
            g_szMenu_give[id]=2
            show_menu_player_list(id)
        }
        case 3:
        {
            g_szMenu_give[id]=3
            show_menu_player_list(id)
        }
        case 4:
        {
            g_szMenu_give[id]=4
            show_menu_player_list(id)
        }
        case 5:
        {
            g_szMenu_give[id]=5
            show_menu_player_list(id)
        }
    }
}

show_menu_player_list(id)
{
    static menu[512], player_name[32]
    new menuid, player, buffer[2]
    
    // Title
    switch(g_szMenu_give[id])
    {
        case 0: formatex(menu, charsmax(menu), "\r[ZP]\w Выдача аммо \r[BZ]^n")
        case 1: formatex(menu, charsmax(menu), "\r[ZP]\w Выдача уровня \r[BZ]^n")
        case 2: formatex(menu, charsmax(menu), "\r[ZP]\w Выдача опыта \r[BZ]^n")
        case 3: formatex(menu, charsmax(menu), "\r[ZP]\w Забрать аммо \r[BZ]^n")
        case 4: formatex(menu, charsmax(menu), "\r[ZP]\w Забрать уровень \r[BZ]^n")
        case 5: formatex(menu, charsmax(menu), "\r[ZP]\w Забрать опыт \r[BZ]^n")
        case 6: formatex(menu, charsmax(menu), "\r[ZP]\w Раздача аммо \r[BZ]^n")
    }
    menuid = menu_create(menu, "menu_player_list")
    
    // Player List
    for (player = 0; player <= 32; player++)
    {
        // Skip if not connected
        if (!is_user_connected(player))
            continue;
        
        // Get player's name
        get_user_name(player, player_name, charsmax(player_name))
        
        // Format text depending on the action to take   
        switch(g_szMenu_give[id])
        {
           case 0: formatex(menu, charsmax(menu), "%s \r[%d аммо]", player_name, zp_get_user_ammo_packs(player))
           case 1: formatex(menu, charsmax(menu), "%s \r[L: %d]", player_name, zp_get_user_level(player))
           case 2: formatex(menu, charsmax(menu), "%s \r[EXP: %d]", player_name, zp_get_user_exp(player))
           case 3: formatex(menu, charsmax(menu), "%s \r[%d аммо]", player_name, zp_get_user_ammo_packs(player))
           case 4: formatex(menu, charsmax(menu), "%s \r[L: %d]", player_name, zp_get_user_level(player))
           case 5: formatex(menu, charsmax(menu), "%s \r[EXP: %d]", player_name, zp_get_user_exp(player))
           case 6: formatex(menu, charsmax(menu), "%s \r[%d аммо]", player_name, zp_get_user_ammo_packs(player))
        }
        
        // Add player
        buffer[0] = player
        buffer[1] = 0
        menu_additem(menuid, menu, buffer)
    }
    
    // Back - Next - Exit
    formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
    menu_setprop(menuid, MPROP_BACKNAME, menu)
    formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
    menu_setprop(menuid, MPROP_NEXTNAME, menu)
    formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
    menu_setprop(menuid, MPROP_EXITNAME, menu)
    
    // If remembered page is greater than number of pages, clamp down the value
    MENU_PAGE_PLAYERS = min(MENU_PAGE_PLAYERS, menu_pages(menuid)-1)
    
    // Fix for AMXX custom menus
    set_pdata_int(id, 205, 0)
    menu_display(id, menuid, MENU_PAGE_PLAYERS)
}

public menu_player_list(id, menuid, item)
{
    // Menu was closed
    if (item == MENU_EXIT)
    {
        MENU_PAGE_PLAYERS = 0
        menu_destroy(menuid)
        return PLUGIN_HANDLED;
    }
    
    // Remember player's menu page
    MENU_PAGE_PLAYERS = item / 7
    
    // Retrieve player id
    new buffer[2], dummy, player
    menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
    player = buffer[0]
    
    // Make sure it's still connected
    if (is_user_connected(player))
    {
        new name[32], name2[32]
        get_user_name(player, name, 31)
        get_user_name(player, name2, 31)
    
        switch(g_szMenu_give[id])
        {
            case 0:
            {               
                zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player)+500)
                client_printcolor(id, "^x04[ZP]^x01 Вы выдали ^x04 500 ^x01аммо - игроку ^x04%s", name)
            }
            case 1:
            {
                zp_set_user_level(player, zp_get_user_level(player)+1)
                client_printcolor(id, "^x04[ZP]^x01 Вы выдали ^x04 1 ^x01уровень - игроку ^x04%s", name)
            }
            case 2:
            {
                zp_set_user_exp(player, zp_get_user_exp(player)+10)
                client_printcolor(id, "^x04[ZP]^x01 Вы выдали ^x04 10 ^x01опыта - игроку ^x04%s", name)
            }
            case 3:
            {
                zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player)-500)
                client_printcolor(id, "^x04[ZP]^x01 Вы забрали ^x04 500 ^x01аммо у игрока - ^x04%s", name)
            }
            case 4:
            {
                zp_set_user_level(player, zp_get_user_level(player)-1)
                client_printcolor(id, "^x04[ZP]^x01 Вы забрали ^x04 1 ^x01уровень у игрока - ^x04%s", name)
            }
            case 5:
            {
                zp_set_user_exp(player, zp_get_user_exp(player)-10)
                client_printcolor(id, "^x04[ZP]^x01 Вы забрали ^x04 10 ^x01опыта у игрока - ^x04%s", name)
            }
        }
    }
    
    show_menu_player_list(id)
    
    menu_destroy(menuid)
    return PLUGIN_HANDLED;
}

stock client_printcolor(const pPlayer, const input[], any:...)
{
    static szMsg[191]
    vformat(szMsg, charsmax(szMsg), input, 3)
    
    if(pPlayer) {
        message_begin(MSG_ONE_UNRELIABLE, 76, _, pPlayer)
        write_byte(pPlayer)
        write_string(szMsg)
        message_end()
    } else {
        static player
        for (player = 1; player <= 32; player++) {
            if (!is_user_connected(player)) continue;
            
            message_begin(MSG_ONE_UNRELIABLE, 76, _, player)
            write_byte(player)
            write_string(szMsg)
            message_end()
        }
    }
}
 

Вложения

Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу