PF_MessageBegin_I: with no target entity

Сообщения
270
Реакции
43
Помог
5 раз(а)
Ошибка
sys_error.log
L 08/02/2018 - 13:18:29: (map "de_dust2") PF_MessageBegin_I: with no target entity
ОС
Linux
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.4.0.633-dev
Build date: 10:34:06 Jan 24 2018 (1383)
Build from: https://github.com/dreamstalker/rehlds/commit/82ee1b0
ReGamedll
ReGameDLL version: 5.5.0.288-dev
Build date: 17:21:36 Jan 28 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/60b6cf9
Версия Metamod
Metamod-r v1.3.0.112, API (5:13)
Metamod-r build: 16:01:51 Feb 8 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/2e23956
Список метамодулей
[ 1] Reunion               RUN   -    reunion_mm_i386.so               v0.1.0.89       ini  Start Never
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.8.3-Re ini Start ANY
[ 3] Ultimate Unprecacher RUN - ultimate_unprecacher_mm_i386.so v0.3 Alpha ini ANY ANY
[ 4] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 5] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 6] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 7] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY ANY
[ 8] WHBlocker RUN - whblocker_mm_i386.so v1.5.695 ini Chlvl ANY
[ 9] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[10] SoftBlocker RUN - softblocker_mm_i386.so v1.1g ini ANY Never
[11] ReParachute RUN - parachute_amxx_i386.so v1.1 Beta pl2 ANY ANY
[12] ReAPI RUN - reapi_amxx_i386.so v5.5.0.148-dev pl2 ANY Never
[13] MySQL RUN - mysql_amxx_i386.so v1.8.3-Re pl2 ANY ANY
[14] FakeMeta RUN - fakemeta_amxx_i386.so v1.8.3-Re pl2 ANY ANY
[15] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl2 ANY Never
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.8.3-Re pl2 ANY ANY
[17] CStrike RUN - cstrike_amxx_i386.so v1.8.3-Re pl2 ANY ANY
[18] CSX RUN - csx_amxx_i386.so v1.8.3-Re pl2 ANY ANY
[19] Engine RUN - engine_amxx_i386.so v1.8.3-Re pl2 ANY ANY
[20] Fun RUN - fun_amxx_i386.so v1.8.3-Re pl2 ANY ANY
Список плагинов
[  1] Admin Loader            3.1         neygomon          admin_loader.am  running
[ 2] Fake Ping 1.0 MeRcyLeZZ/gyxoBk FakePing.amxx running
[ 3] FreshBans 1.3.8b kanagava fresh_bans_138_ running
[ 4] Ban Sound: Fresh Bans 1.0 Leo_[BH] fb_ban_sound.am running
[ 5] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 6] Mini Sound Esp Fix 1.0 ranget mini_sound_esp_ running
[ 7] Advanced Client Checke 0.3.4 Mistrick cmdchecker.amxx running
[ 8] Advanced Gag 1.9.0 neygomon amx_gag.amxx running
[ 9] ReAimDetector API 0.2.1 ReHLDS Team reaimdetector.a debug
[ 10] Admin Commands 1.8.3-Re AMXX Dev Team admincmd.amxx running
[ 11] Admin Help 1.8.3-Re AMXX Dev Team adminhelp.amxx running
[ 12] Slots Reservation 1.2 pUzzlik admin_slots.amx running
[ 13] Multi-Lingual System 1.8.3-Re AMXX Dev Team multilingual.am running
[ 14] Menus Front-End 1.8.3-Re AMXX Dev Team menufrontv2_cli running
[ 15] Commands Menu 1.8.3-Re AMXX Dev Team cmdmenu.amxx running
[ 16] Players Menu 1.8.3-Re AMXX Dev Team plmenu.amxx running
[ 17] Teleport Menu 1.8.3-Re AMXX Dev Team telemenu.amxx running
[ 18] Maps Menu 1.8.3-Re AMXX Dev Team mapsmenu.amxx running
[ 19] Admin Chat 1.8.3-Re AMXX Dev Team adminchat.amxx running
[ 20] Anti Flood 1.8.3-Re AMXX Dev Team antiflood.amxx running
[ 21] Admin Votes 1.8.3-Re AMXX Dev Team adminvote.amxx running
[ 22] Map Manager 2.5.61 Mistrick mapmanager.amxx running
[ 23] Map Manager: Sub Plugi 0.1 Mistrick mapmanager_subp running
[ 24] HLstatsX CE Ingame Plu 1.6.19 (HL psychonic hlstatsx_comman running
[ 25] CS Misc. Stats 1.8.3-Re AMXX Dev Team miscstats.amxx running
[ 26] Supply Crates 2.0 TBagT supply_box.amxx running
[ 27] Global Offensive 4.62 Psychical rcsgo_rest.amxx debug
[ 28] Achievements 5.0 fLaXXiE pasiekimai.amxx debug
[ 29] Simple Damager 1.0 mforce simple_damager. running
[ 30] Resetscore 1.0 mforce re_resetscore.a running
[ 31] [ReAPI] No Team Flash 0.0.2 Vaqtincha no_team_flash.a running
[ 32] Auto Demo Recorder 2.2 F@nt0M demo_recorder.a running
[ 33] csgo FITH Sounds & Tex 0.0.4 Vaqtincha Custom_FITH_Sou running
[ 34] PLUGIN VERSION AUTHOR csgo_menu.amxx running
[ 35] CS:GO Features 1.0.1.1 Sho0ter assist.amxx running
[ 36] WinTeam Sprite 0.0.8 Some Scripter WinTeam_Sprite. running
[ 37] Block Advert 1.4 neygomon block_advert_x2 running
[ 38] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 39] unknown unknown unknown motd_help.amxx running
[ 40] Advert Messages 1.22 neygomon adverts.amxx running
[ 41] unknown unknown unknown a_steam_models. running
[ 42] [ReAPI] AimEspFix VIP 1.0 ? fix_vip_tab.amx running
[ 43] Models Replacement 0.0.2 ConnorMcLeod | V models_replacem running
[ 44] [ReVIP] System Core 2.5 full pUzzlik re_vip_core.amx running
[ 45] [ReVIP] Menu 2.5 full pUzzlik re_vip_menu.amx running
[ 46] [ReVIP] Connected Info 2.5 full pUzzlik re_vip_connect_ running
[ 47] [ReVIP] Tab Info 2.5 full pUzzlik re_vip_tab_info running
[ 48] [ReVIP] Add HP 2.5 full pUzzlik re_vip_hp_add.a running
48 plugins, 48 running
Greetings gentlemen's, :thank_you:any ideas how to find and resolve this problem?:dntknw: crash most of the time it happens when the server is full 32/32 (5-+10 players)
 

Вложения

Сообщения
2,143
Реакции
1,225
Помог
44 раз(а)
Ищите проблему в участке кода, в одном из своих плагинов, который отвечает за прекеш моделей. :pardon:
 
Сообщения
957
Реакции
1,185
Помог
52 раз(а)
Murz, You are stuck in the limit of 512 models. The required file for the plugin does not fit into the pre-cache
 
  • Нравится
Реакции: Murz
Сообщения
2,143
Реакции
1,225
Помог
44 раз(а)
Sonyx, это один из вариантов. У меня была такая же ошибка, и вызывал её мой косяк в буфере прекеша моделей. Не правильно записал :)
 
Сообщения
957
Реакции
1,185
Помог
52 раз(а)
Minni, ну по логу судя 99 и 100 что в прекеш не влезла модель, отсылаемая плагином в сообщении.
 
Сообщения
2,143
Реакции
1,225
Помог
44 раз(а)
Sonyx, всё может быть. Я был на его сервере и у него куча моделей. Закачивал минут 5-6.
 
Сообщения
957
Реакции
1,185
Помог
52 раз(а)
Murz, and try disabling the Mini Sound Esp Fix plug-in
 
Сообщения
270
Реакции
43
Помог
5 раз(а)
Murz, and try disabling the Mini Sound Esp Fix plug-in
i found where is problem. but bad for me i don't know how to fix it.

by commenting this part, crashes stoped.
Код:
//register_clcmd("say /trade", "TradeMenu");
its somewhere in this part of code

Код:
public TradeMenu(id)
{
    new offer;
    
    if(1 <= TradeTarget[id] <= 32)
    {
        new target = TradeTarget[id];
        new p_target = TradeTarget[target];
            
        if(is_user_connected(target) && p_target == id)
        {   // Both trading
            showTradeMenu(id);
        }
        else if((offer = PlayerHasTradingOffer(id)) > 0)
        {
            new szText[128], menu;
            new name[64];
            get_user_name(offer, name, charsmax(name));
            formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_TRADING", PREFIX_EVENT, name);
            menu = menu_create(szText, "TradeOfferHandler");
            
            formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_ACCEPT");   
            menu_additem(menu, szText);

            formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_DECLINE");   
            menu_additem(menu, szText);

            menu_display(id, menu, 0);
        }
        else
        {
            showTradeTargets(id);
        }
    }
    else if((offer = PlayerHasTradingOffer(id)) > 0)
    {
        new szText[128], menu;
        new name[64];
        get_user_name(offer, name, charsmax(name));
        
        formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_TRADING", PREFIX_EVENT, name);
        menu = menu_create(szText, "TradeOfferHandler");
        
        formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_ACCEPT");   
        menu_additem(menu, szText);

        formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_DECLINE");   
        menu_additem(menu, szText);
        
        menu_display(id, menu, 0);
    }
    else
    {
        showTradeTargets(id);
    }
}

public TradeOfferHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new offer = PlayerHasTradingOffer(id);
    
    if(!(1 <= offer <= 32) || !is_user_connected(offer))
    {
        TradeMenu(id);
        return PLUGIN_HANDLED;
    }
    
    new name[64];
    get_user_name(id, name, charsmax(name));
    
    switch(item)
    {
        case 0:
        {
            TradeTarget[id] = offer;
            client_print_color(offer, print_team_default, "%L", LANG_PLAYER, "TRADE_YPLAYER_ACCEPT", Prefix, name);

            ResetTrade(id, false);
            ResetTrade(offer, false);
            
            TradeMenu(offer);
        }
        case 1:
        {
            TradeTarget[offer] = 0;
            client_print_color(offer, print_team_default, "%L", LANG_PLAYER, "TRADE_YPLAYER_DECLINE", Prefix, name);
        }
    }
    TradeMenu(id);
    return PLUGIN_HANDLED;
}

stock PlayerHasTradingOffer(id)
{
    for(new i = 1; i <= 32; i++)
    {
        if(is_user_connected(i) && TradeTarget[i] == id) return i;
    }
    return -1;
}

public showTradeTargets(id)
{   
    new szText[512];
    
    formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_SHOW_TARGETS", PREFIX_EVENT);
    new menu = menu_create(szText, "TradePlayersHandler");
    
    new szName[32], szUserId[32], players[32], pnum, tempid;
    get_players(players, pnum);
    
    for(new i; i < pnum; i++)
    {
        tempid = players[i];
        
        if(tempid == id)
            continue;
        
        get_user_name(tempid, szName, charsmax(szName));
        
        formatex(szUserId, charsmax(szUserId), "%d", get_user_userid(tempid));
        menu_additem(menu, szName, szUserId, 0);
    }
    menu_display(id, menu, 0);
}

public TradePlayersHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new szData[6], szName[64];
    new _access, item_callback;
    menu_item_getinfo(menu, item, _access, szData,charsmax(szData), szName,charsmax(szName), item_callback);
    
    new userid = str_to_num(szData);
    
    new player = find_player("k", userid); // flag "k" : find player from userid

    if(player && is_user_connected(player))
    {
        if(canOffer[id])
        {
            new name[64];
            get_user_name(id, name, charsmax(name));

            TradeTarget[id] = player;
            client_print_color(player, print_team_default, "%L", LANG_PLAYER, "TRADE_PLAYER", Prefix, name);
            TradeMenu(player);
            set_task(10.0, "resetOffering", id+8080);
            canOffer[id] = false;
        }
        else client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_WAITING_TARGETS", Prefix);
    }
    TradeMenu(id);
    
    return PLUGIN_HANDLED;
}

public resetOffering(id)
{
    id -= 8080;
    canOffer[id] = true;
}

public showTradeMenu(id)
{
    if(1 <= TradeTarget[id] <= 32)
    {
        new target = TradeTarget[id];
        
        if(is_user_connected(target))
        {
            new szText[512], target_name[64];
            get_user_name(target, target_name, charsmax(target_name));
            
            formatex(szText, charsmax(szText), "\y[\rPublic\y] \wKeičiatės su \r%s\d:\w", target_name);
            
            new menu = menu_create(szText, "TradeMenuHandler");
            
            if(TradeSkin[id] != -1)
            {
                new skin_id = TradeSkin[id];
                formatex(szText, charsmax(szText), "\wSkiną: \y%s \d[\r%s\d]", WeaponNames[skin_id], szWeaponNames[Weapons[skin_id]]);
            }
            else
            {
                formatex(szText, charsmax(szText), "\wSkiną: \dnepasirinkta");
            }
            menu_additem(menu, szText);
            
            if(TradeChest[id] != -1 && TradeChestCount[id] > 0)
            {
                new chest_id = TradeChest[id];
                formatex(szText, charsmax(szText), "\wSkrynią: \y%s \d[%d]", chest_name(chest_id), TradeChestCount[id]);
            }
            else
            {
                formatex(szText, charsmax(szText), "\wSkrynią: \dnepasirinkta");
            }
            menu_additem(menu, szText);
            
            formatex(szText, charsmax(szText), "\wRaktai: \d%d", TradeKey[id]);
            menu_additem(menu, szText);
            
            formatex(szText, charsmax(szText), "\wTaškai: \d$%d", TradeMoney[id]);
            
            new extraText[512];
            formatex(extraText, charsmax(extraText), "%s^n^n\w--- \y%s \w---^n^n", szText, target_name);
            
            if(TradeSkin[target] != -1)
            {
                new skin_id = TradeSkin[target];
                formatex(extraText, charsmax(extraText), "%s\wSkiną: \y%s \d[\r%s\d]^n", extraText, WeaponNames[skin_id], szWeaponNames[Weapons[skin_id]]);
            }
            else
            {
                formatex(extraText, charsmax(extraText), "%s\wSkiną: \dnepasirinkta^n", extraText);
            }
            
            if(TradeChest[target] != -1 && TradeChestCount[id] > 0)
            {
                new chest_id = TradeChest[target];
                formatex(extraText, charsmax(extraText), "%s\wSkrynią: \y%s \d[%d]^n", extraText, chest_name(chest_id), TradeChestCount[target]);
            }
            else
            {
                formatex(extraText, charsmax(extraText), "%s\wSkrynią: \dnepasirinkta^n", extraText);
            }
            
            formatex(extraText, charsmax(extraText), "%s\wRaktai: \d%d^n", extraText, TradeKey[target]);
            formatex(extraText, charsmax(extraText), "%s\wTaškai: \d$%d^n^n", extraText, TradeMoney[target]);
            menu_additem(menu, extraText);
            
            if(TradeAccept[id] == -1)
            {   
                formatex(szText, charsmax(szText), "\yPatvirtinti");
                menu_additem(menu, szText);
            }   
            else
            {   
                formatex(szText, charsmax(szText), "\yPatvirtinti \d[Waiting for other player]");
                menu_additem(menu, szText);
            }   
                        
            formatex(szText, charsmax(szText), "\rAtšaukti");
            menu_additem(menu, szText);
            
            menu_display(id, menu, 0);
        }
        else
        {
            TradeMenu(id);
        }
    }
    else
    {
        TradeMenu(id);
    }
}

public TradeMenuHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    if(TradeAccept[id] == -1)
    {
        switch(item)
        {
            case 0:
            {     // Skin
                showTradeSkinsMenu(id);
            }
            case 1:
            {     // Chest
                showTradeChestsMenu(id);
            }
            case 2:
            {     // Keys
                inMM[id] = true;
                client_cmd(id, "messagemode SET_TRADE_KEYS");
                TradeMenu(id);
            }
            case 3:
            {     // Money
                inMM[id] = true;
                client_cmd(id, "messagemode SET_TRADE_MONEY");
                TradeMenu(id);
            }
        }
    }
        
    new target = TradeTarget[id];
    
    if(item == 4)
    { // Accept
        if(TradeAccept[id] == -1)
        {
            TradeAccept[id] = 1;
        }
        else
        {
            TradeAccept[id] = -1;
        }
        
        if(TradeAccept[id] != -1)
        {
            client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_PLAYER_ACCEPT", Prefix);
            
            if(TradeAccept[target] != -1)
            {
                MakeTrade(id, target);
            }
            TradeMenu(id);
        }
    }
    else if(item == 5)
    { // Decline
        client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_PLAYER_DECLINE", Prefix);
        ResetTrade(id, true);
        ResetTrade(target, true);
        TradeMenu(id);
    }
    
    return PLUGIN_HANDLED;
}

public showTradeSkinsMenu(id)
{
    new szText[512];
        
    formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_ITEM_SKINS", PREFIX_EVENT);
    new menu = menu_create(szText, "skinsTradeMenuHandler");

    menu_additem(menu, "None", "-1");
    
    new String[32], All;
    for(new i = 1; i < AllWeapon; i++)
    {
        if(uWeapon[i][id] <= 0)
            continue;
        
        num_to_str(i, String, 31);
        formatex(szText, sizeof(szText), "%L", LANG_PLAYER, "SKINPIECE", (bUsingGuns[id][Weapons[i]] == i) ? "\w" : "\y", WeaponNames[i], szWeaponNames[Weapons[i]], uWeapon[i][id]);
        menu_additem(menu, szText, String);
        All++;
        
    }
    menu_display(id, menu, 0);
}

public skinsTradeMenuHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        TradeMenu(id);
        return PLUGIN_HANDLED;
    }
    
    new szData[6], szName[64];
    new _access, item_callback;
    menu_item_getinfo(menu, item, _access, szData, charsmax(szData), szName, charsmax(szName), item_callback);
    
    new skin_id = str_to_num(szData);
    
    if(skin_id != -1)
    {
        new name[64];
        get_user_name(id, name, charsmax(name));
        
        TradeSkin[id] = skin_id;
        client_print_color(TradeTarget[id], print_team_default, "[^4Public^1] ^3%s ^1set ^4%s ^1[^4%s^1] skiną!", name, WeaponNames[skin_id], szWeaponNames[Weapons[skin_id]]);
    }
    TradeMenu(id);
    TradeMenu(TradeTarget[id]);
    
    return PLUGIN_HANDLED;
}

public showTradeChestsMenu(id)
{
    new szText[512];
    formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "TRADE_ITEM_CHESTS", PREFIX_EVENT);
    new menu = menu_create(szText, "chestsTradeMenuHandler");
    
    menu_additem(menu, "None", "-1");
    
    for(new i = 1; i <= CHEST_COUNT; i++)
    {
        if(Chest[id][i] > 0)
        {
            formatex(szText, sizeof(szText), "%L", LANG_PLAYER, "CHESTPIECE", chest_name(i), Chest[id][i]);
            
            new szButton[128]; formatex(szButton, charsmax(szButton), "%d", i);
            menu_additem(menu, szText, szButton);
            
        }
    }
    menu_display(id, menu, 0);
}

public chestsTradeMenuHandler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu);
        TradeMenu(id);
        return PLUGIN_HANDLED;
    }
    
    new szData[6], szName[64];
    new _access, item_callback;
    menu_item_getinfo( menu, item, _access, szData,charsmax(szData), szName, charsmax(szName), item_callback);
    
    new chest_id = str_to_num(szData);
    
    if(chest_id != -1)
    {
        new name[64];
        get_user_name(id, name, charsmax(name));
        
        TradeChest[id] = chest_id;
        
        inMM[id] = true;
        client_cmd(id, "messagemode SET_TRADE_CHESTS");
    }
    TradeMenu(id);
    return PLUGIN_HANDLED;
}

public ResetTrade(id, bool:reset)
{
    if(reset)
    TradeTarget[id] = 0;
    TradeAccept[id] = -1;
    TradeSkin[id] = -1;
    TradeChest[id] = -1;
    TradeKey[id] = 0;
    TradeMoney[id] = 0;
}

public cmdKeys(id)
{
    if(inMM[id])
    {
        new szTemp[64];
        
        read_args(szTemp, charsmax(szTemp));
        remove_quotes(szTemp);
        
        if(IsInteger(szTemp))
        {
            new pts = str_to_num(szTemp);
            
            if(TradeKey[id] != pts)
            {
                if(pts > pKey[id]) pts = pKey[id];
                TradeKey[id] = pts;
                
                new name[64];
                get_user_name(id, name, charsmax(name));
                client_print_color(TradeTarget[id], print_team_default, "[^4Public^1] ^3%s ^1set ^4%d ^1raktų!", name, pts);
                TradeMenu(TradeTarget[id]);
            }
            else
            {
                client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_PLAYER_DECLINE", Prefix);
            }
        }
        else
        {
            client_cmd(id, "messagemode SET_TRADE_KEYS");
            return PLUGIN_HANDLED;
        }
    }
    
    inMM[id] = false;
    set_task(0.5, "TradeMenu", id);
    return PLUGIN_HANDLED;
}

public cmdMoney(id)
{
    if(inMM[id])
    {
        new szTemp[64];
        
        read_args(szTemp, charsmax(szTemp));
        remove_quotes(szTemp);
        
        if(IsInteger(szTemp))
        {
            new pts = str_to_num(szTemp);
            if(TradeMoney[id] != pts)
            {
                if(pts > Points[id]) pts = Points[id];
                TradeMoney[id] = pts;
                
                new name[64];
                get_user_name(id, name, charsmax(name));
                client_print_color(TradeTarget[id], print_team_default, "[^4Public^1] ^3%s ^1set ^4%d ^1taškų!", name, pts);
                TradeMenu(TradeTarget[id]);
            }
            else
            {
                client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_PLAYER_DECLINE", Prefix);
            }
        }
        else
        {
            client_cmd(id, "messagemode SET_TRADE_MONEY");
            return PLUGIN_HANDLED;
        }
    }
    
    inMM[id] = false;
    set_task(0.5, "TradeMenu", id);
    
    return PLUGIN_HANDLED;
}

public cmdChests(id)
{
    if(inMM[id])
    {
        new szTemp[64];
        
        read_args(szTemp, charsmax(szTemp));
        remove_quotes(szTemp);
        
        if(IsInteger(szTemp) && str_to_num(szTemp) > 0)
        {
            new pts = str_to_num(szTemp);
            
            if(TradeChestCount[id] != pts && TradeChest[id] != -1 && (1 <= TradeChest[id] <= CHEST_COUNT) )
            {
                new cnt = Chest[id][TradeChest[id]];
                
                if(pts > cnt) pts = cnt;
                
                if(pts <= 0) TradeChest[id] = -1;
                TradeChestCount[id] = pts;
                
                new name[64];
                get_user_name(id, name, charsmax(name));
                client_print_color(TradeTarget[id], print_team_default, "[^4Public^1] ^3%s ^1set ^4%s %d ^1skrynių!", name, chest_name(TradeChest[id]), pts);
                TradeMenu(TradeTarget[id]);
            }
            else
            {
                client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_PLAYER_DECLINE", Prefix);
            }
        }
        else
        {
            client_cmd(id, "messagemode SET_TRADE_CHESTS");
            return PLUGIN_HANDLED;
        }
    }
    
    inMM[id] = false;
    set_task(0.5, "TradeMenu", id);
    
    return PLUGIN_HANDLED;
}

bool:IsInteger(buffer[])
{
    new len = strlen(buffer);
    
    for(new i = 0; i < len; i++)
    {
        if(!isdigit(buffer[i]))
            return false;
    }
    return true;   
}

public MakeTrade(id, target)
{
    if(!is_user_connected(id) || !is_user_connected(target)) return;
    
    new bool:TradeWillHappen = true;
    new skin_id, target_skin_id, chest_id, target_chest_id, chest_count, target_chest_count, keys, target_keys, money, target_money;
    
    if(TradeSkin[id] != -1)
    {
        if(uWeapon[TradeSkin[id]][id] <= 0)
        {
            TradeWillHappen = false;
        }
        else
        {
            skin_id = TradeSkin[id];
        }
    }
    
    if(TradeSkin[target] != -1)
    {
        if(uWeapon[TradeSkin[target]][target] <= 0)
        {
            TradeWillHappen = false;
        }
        else
        {
            target_skin_id = TradeSkin[target];
        }
    }
    
    if(TradeChest[id] != -1 && TradeChestCount[id] > 0)
    {
        if(Chest[id][TradeChest[id]] < TradeChestCount[id])
        {
            TradeWillHappen = false;
        }
        else
        {
            chest_id = TradeChest[id];
            chest_count = TradeChestCount[id];
        }
    }
    
    if(TradeChest[target] != -1 && TradeChestCount[target] > 0)
    {
        if(Chest[target][TradeChest[target]] < TradeChestCount[target])
        {
            TradeWillHappen = false;
        }
        else
        {
            target_chest_id = TradeChest[target];
            target_chest_count = TradeChestCount[target];
        }
    }
    
    if(TradeKey[id] > 0)
    {
        if(pKey[id] < TradeKey[id]) TradeWillHappen = false;
        else keys = TradeKey[id];
    }
    
    if(TradeKey[target] > 0)
    {
        if(pKey[target] < TradeKey[target]) TradeWillHappen = false;
        else target_keys = TradeKey[target];
    }
    
    if(TradeMoney[id] > 0)
    {
        if(Points[id] < TradeMoney[id]) TradeWillHappen = false;
        else money = TradeMoney[id];
    }
    
    if(TradeMoney[target] > 0)
    {
        if(Points[target] < TradeMoney[target]) TradeWillHappen = false;
        else target_money = TradeMoney[target];
    }
    
    if(TradeWillHappen)
    {
        pKey[id] -= keys; pKey[target] -= target_keys; pKey[id] += target_keys; pKey[target] += keys;
        Points[id] -= money; Points[target] -= target_money; Points[id] += target_money; Points[target] += money;
        
        uWeapon[skin_id][id]--; uWeapon[target_skin_id][target]--; uWeapon[target_skin_id][id]++; uWeapon[skin_id][target]++;
        Chest[id][chest_id] -= chest_count;
        Chest[id][target_chest_id]  += target_chest_count;
        Chest[target][target_chest_id] -= target_chest_count;
        Chest[target][chest_id] += chest_count;
        
        client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_SUCCESSFULLY_MAKE", Prefix);
        SaveData(id);
        SaveData(target);
    }
    else
    {
        client_print_color(id, print_team_default, "%L", LANG_PLAYER, "TRADE_FAILED_MISSING", Prefix);
        client_print_color(target, print_team_default, "%L", LANG_PLAYER, "TRADE_FAILED_MISSING", Prefix);
    }

    ResetTrade(id, true);
    ResetTrade(target, true);
}
 

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

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