Проблемы с выдачей денег в плагине.

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

Lis

Сообщения
59
Реакции
21
Предупреждения
10
Помог
1 раз(а)
Ошибка
нет ошибки в работе плагина
ОС
Linux
Amx Mod X
Built from: https://github.com/alliedmodders/amxmodx/commit/be52641
Build ID: 5232:be52641
Core mode: JIT+ASM32
amxx version
AMX Mod X 1.9.0.5232 (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: Oct 14 2018 08:47:55
Built from: https://github.com/alliedmodders/amxmodx/commit/be52641
Build ID: 5232:be52641
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.4.0-dev+m
Build date: 15:08:41 Oct 22 2018 (1654)
Build from:
ReGamedll
ReGameDLL version: 5.7.0.318-dev
Build date: 21:07:26 Oct 30 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/932001b
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
[ 1] Reunion RUN - reunion.so v0.1.0.133 ini Start Never 
[ 2] ReAuthCheck RUN - reauthcheck.so v0.1.6 ini Start Never
[ 3] VoiceTranscoder RUN - vtc.so v2017RC3 ini ANY ANY
[ 4] AMX Mod X RUN - amxmodx.so v1.9.0.5232 ini Start ANY
[ 5] Rechecker RUN - rechecker.so v2.5 ini Chlvl ANY
[ 6] ReSRDetector RUN - resrdetector.so v0.1.0 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker.so v1.5.695 ini Chlvl ANY
[ 8] MySQL RUN - mysql_amxx_i386.so v1.9.0.5232 pl4 ANY ANY
[ 9] Fun RUN - fun_amxx_i386.so v1.9.0.5232 pl4 ANY ANY
[10] Engine RUN - engine_amxx_i386.so v1.9.0.5232 pl4 ANY ANY
[11] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5232 pl4 ANY ANY
[12] ReAPI RUN - reapi_amxx_i386.so v5.6.0.160-dev pl4 ANY Never
[13] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl4 ANY Never
[14] MySQL Threads RUN - mysqlt_amxx_i386.so v1.2 pl4 ANY ANY
[15] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5219 pl4 ANY ANY
[16] CSX RUN - csx_amxx_i386.so v1.9.0.5219 pl4 ANY ANY
[17] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5232 pl4 ANY ANY
[18] ReDM API RUN - redm_api_amxx_i386.so v1.3.3.7 pl4 ANY Never
Список плагинов
[  1] GameCMS_API             5.2.9       zhorzh78          gamecms_api_5.2  running
[ 2] FreshBans 1.4.0b kanagava fresh_bans_183. running
[ 3] Advanced Gag 1.9.0 neygomon advanced_gag.am running
[ 4] ReDeathMatch 2.6.7.0 ReDM Dev Team ReDeathMatch.am running
[ 5] Players Menu 1.7 neugomon players_menu.am running
[ 6] VoteGag 1.0 sNk votegag.amxx running
[ 7] Rock to Ban 1.02 Safety1st rock2ban.amxx running
[ 8] [183] Demo Recorder RB 18.02.08 SKAJIbnEJIb demorecorder_rb running
[ 9] [183] High Ping Kicker 18.05.15 SKAJIbnEJIb hpk_rbs.amxx running
[ 10] [183] Spect Bot 17.08.28 SKAJIbnEJIb & Bo SpectBot.amxx running
[ 11] Parachute for ALL [ReA 3.0 Leo_[BH] parachute_for_a running
[ 12] Knife DeathMatch: VIP 1.0.3 Salvatore vipmenu.amxx running
Автор плагина
Salvatore
Версия плагина
Knife DeathMatch: VIP Menu 1.0.3
Исходный код
#include <amxmodx>
#include <reapi>

#pragma ctrlchar '\'
#pragma semicolon 1

#if !defined MAX_PLAYERS
#define MAX_PLAYERS 32
#endif

new const PLUGIN_NAME[] = "Knife DeathMatch: VIP Menu";
new const PLUGIN_VERSION[] = "1.0.3";
new const PLUGIN_AUTHOR[] = "Salvatore";

new const MESSAGE_PREFIX[] = "VIPMENU";

enum any: Items
{
ItemGravity,
ItemSpeed,
ItemExplosiveGrenade,
ItemMultijump,
ItemInvisiblity,
ItemMoney,
ItemHealthPoints
} new bool: gbPlayerAttachedItems[MAX_PLAYERS + 1][Items], giPlayerUsedItems[MAX_PLAYERS + 1][Items];

enum MethodType
{
MethodSteam,
MethodName,
MethodIP
};

enum Config
{
//main section
BitsAccess,
MethodType: SaveMethod,

//items_limit section
ItemsLimit[Items],
ItemsAmount[Items]
} new gConfig[Config];

new giMenuCallback;
new Trie: gpMapVector;

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

RegisterHookChain(RG_CBasePlayer_Spawn, "HC_CBasePlayer_Spawn_Post", 1);
RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "HC_CBasePlayer_ResetMaxSpeed");
RegisterHookChain(RG_CBasePlayer_Jump, "HC_CBasePlayer_Jump_Post", 1);

giMenuCallback = menu_makecallback("VM_Callback");

register_dictionary("vipmenu.txt");
}

public client_putinserver(player)
{
arrayset(giPlayerUsedItems[player], 0, Items);
arrayset(gbPlayerAttachedItems[player], false, Items);

if (~get_user_flags(player) & gConfig[BitsAccess])
return PLUGIN_CONTINUE;

new szMethodInfo[32];
switch (gConfig[SaveMethod])
{
case MethodSteam: get_user_authid(player, szMethodInfo, charsmax(szMethodInfo));
case MethodName: get_user_name(player, szMethodInfo, charsmax(szMethodInfo));
case MethodIP: get_user_ip(player, szMethodInfo, charsmax(szMethodInfo), true);
}

TrieGetArray(gpMapVector, szMethodInfo, giPlayerUsedItems[player], Items) && TrieDeleteKey(gpMapVector, szMethodInfo);

return PLUGIN_CONTINUE;
}

public client_disconnected(player)
{
if (~get_user_flags(player) & gConfig[BitsAccess])
return PLUGIN_CONTINUE;

new szMethodInfo[32];
switch (gConfig[SaveMethod])
{
case MethodSteam: get_user_authid(player, szMethodInfo, charsmax(szMethodInfo));
case MethodName: get_user_name(player, szMethodInfo, charsmax(szMethodInfo));
case MethodIP: get_user_ip(player, szMethodInfo, charsmax(szMethodInfo), true);
}

TrieSetArray(gpMapVector, szMethodInfo, giPlayerUsedItems[player], Items);

return PLUGIN_CONTINUE;
}

public HC_CBasePlayer_Spawn_Post(const this)
{
if (is_user_alive(this))
{
new /*bool:*/ bOldMultiJumpState = gbPlayerAttachedItems[this][ItemMultijump];
arrayset(gbPlayerAttachedItems[this], 0, Items);
rg_reset_maxspeed(this);
rg_set_rendering(this);

if (bOldMultiJumpState && !gConfig[ItemsLimit][ItemMultijump])
gbPlayerAttachedItems[this][ItemMultijump] = true;
}
}

public HC_CBasePlayer_ResetMaxSpeed(const this)
{
if (gbPlayerAttachedItems[this][ItemSpeed])
{
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_SUPERCEDE;
}

return HC_CONTINUE;
}

public HC_CBasePlayer_Jump_Post(const this)
{
if (!gbPlayerAttachedItems[this][ItemMultijump])
return;

static iJumps;
if (get_entvar(this, var_flags) & FL_ONGROUND)
{
iJumps = 0;
return;
}

if (~get_entvar(this, var_flags) & FL_ONGROUND && ~get_entvar(this, var_oldbuttons) & IN_JUMP && ++iJumps < gConfig[ItemsAmount][ItemMultijump])
{
new Float: flVelocity[3];
get_entvar(this, var_velocity, flVelocity);
flVelocity[2] = random_float(250.0, 300.0);
set_entvar(this, var_velocity, flVelocity);
return;
}
}

public ClientCommand_VM(const this)
{
new iMenu = menu_create(fmt("\\w%L", this, get_user_flags(this) & gConfig[BitsAccess] ? "MENU_TITLE_ACCESS" : "MENU_TITLE_NOACCESS"), "VM_Handler");
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_GRAVITY"), "1", .callback = giMenuCallback);
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_SPEED"), "2", .callback = giMenuCallback);
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_EXPLOSIVE"), "3", .callback = giMenuCallback);
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_MULTIJUMP", gConfig[ItemsAmount][ItemMultijump]), "4", .callback = giMenuCallback);
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_INVISIBLITY"), "5", .callback = giMenuCallback);
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_MONEY", gConfig[ItemsAmount][ItemMoney]), "6", .callback = giMenuCallback);
menu_additem(iMenu, fmt("\\w%L", this, "MENU_ITEM_HP", gConfig[ItemsAmount][ItemHealthPoints]), "7", .callback = giMenuCallback);

menu_setprop(iMenu, MPROP_NEXTNAME, fmt("\\w%L", this, "MENU_NEXTNAME"));
menu_setprop(iMenu, MPROP_BACKNAME, fmt("\\w%L", this, "MENU_BACKNAME"));
menu_setprop(iMenu, MPROP_EXITNAME, fmt("\\w%L", this, "MENU_EXITNAME"));

menu_display(this, iMenu, 0);
return PLUGIN_HANDLED;
}

public VM_Handler(const this, const menu, const item)
{
if (item == MENU_EXIT)
return menu_destroy(menu);

giPlayerUsedItems[this][item]++;

switch (item)
{
case ItemGravity:
{
set_entvar(this, var_gravity, gConfig[ItemsAmount][ItemGravity]);
gbPlayerAttachedItems[this][item] = true;
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_GRAVITY", gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
}

case ItemSpeed:
{
set_entvar(this, var_maxspeed, gConfig[ItemsAmount][ItemSpeed]);
gbPlayerAttachedItems[this][item] = true;
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_SPEED", gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
}

case ItemExplosiveGrenade:
{
rg_has_item_by_name(this, "weapon_hegrenade") ? rg_set_user_bpammo(this, WEAPON_HEGRENADE, rg_get_user_bpammo(this, WEAPON_HEGRENADE) + 1) : rg_give_item(this, "weapon_hegrenade");
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_EXPLOSIVE", gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
}

case ItemMultijump:
{
gbPlayerAttachedItems[this][item] = gConfig[ItemsLimit][ItemMultijump] ? true : !gbPlayerAttachedItems[this][item];

if (gConfig[ItemsLimit][ItemMultijump])
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_MULTIJUMP", gConfig[ItemsAmount][item], gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
else
{
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, gbPlayerAttachedItems[this][item] ? "USE_ITEM_MULTIJUMP_ENABLED" : "USE_ITEM_MULTIJUMP_DISABLED");
ClientCommand_VM(this);
}
}

case ItemInvisiblity:
{
rg_set_rendering(this, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, gConfig[ItemsAmount][ItemInvisiblity]);
gbPlayerAttachedItems[this][item] = true;
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_INVISIBLITY", gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
}

case ItemMoney:
{
rg_add_account(this, gConfig[ItemsAmount][ItemMoney], AS_SET);
gbPlayerAttachedItems[this][item] = true;
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_MONEY", gConfig[ItemsAmount][ItemMoney], gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
}

case ItemHealthPoints:
{
set_entvar(this, var_health, float(gConfig[ItemsAmount][ItemHealthPoints]));
gbPlayerAttachedItems[this][item] = true;
client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_HP", gConfig[ItemsAmount][ItemHealthPoints], gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
}
}

return menu_destroy(menu);
}

public VM_Callback(const this, const menu, const item)
{
new szItemName[64], iDummyInt;
menu_item_getinfo(menu, item, iDummyInt, szItemName, charsmax(szItemName), szItemName, charsmax(szItemName), iDummyInt);

if (~get_user_flags(this) & gConfig[BitsAccess])
{
remove_all_colors(szItemName, charsmax(szItemName));
menu_item_setname(menu, item, fmt("\\d%s %L", szItemName, this, "MENU_ITEM_NOACCESS"));
return ITEM_DISABLED;
}

if (!gConfig[ItemsLimit][item] && item == ItemMultijump)
{
menu_item_setname(menu, item, fmt("%s %L", szItemName, this, gbPlayerAttachedItems[this][ItemMultijump] ? "MENU_ITEM_STATE_DISABLE" : "MENU_ITEM_STATE_ENABLE"));
return ITEM_IGNORE;
}

if (gConfig[ItemsLimit][item] && giPlayerUsedItems[this][item])
{
new iItemState = giPlayerUsedItems[this][item] >= gConfig[ItemsLimit][item] ? ITEM_DISABLED : ITEM_IGNORE;
iItemState && remove_all_colors(szItemName, charsmax(szItemName));
menu_item_setname(menu, item, fmt("%s %L", szItemName, this, iItemState ? "MENU_ITEMS_LEFT_DISABLED" : "MENU_ITEMS_LEFT", giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]));
return iItemState;
}

return ITEM_IGNORE;
}

public plugin_cfg()
{
new szFile[PLATFORM_MAX_PATH];
get_localinfo("amxx_configsdir", szFile, charsmax(szFile));
add(szFile, charsmax(szFile), "/vm_settings.ini");

new INIParser: pHandle = INI_CreateParser();
INI_SetReaders(pHandle, "ParserRead_KeyValue");
!INI_ParseFile(pHandle, szFile) && set_fail_state("Config %s not found", szFile);
gpMapVector = TrieCreate();
}

const TOKEN_NOTFOUND = -1;
public ParserRead_KeyValue(INIParser:handle, const key[], const value[], bool:invalid_tokens, bool:equal_token, bool:quotes, curtok, any:data)
{
if (equal(key, "access"))
gConfig[BitsAccess] = read_flags(value);
else if (equal(key, "save_method"))
gConfig[SaveMethod] = MethodType: str_to_num(value);
else if (equal(key, "cmd_open"))
{
new szBuffer[256], szCmd[32];
copy(szBuffer, charsmax(szBuffer), value);

while (strtok2(szBuffer, szCmd, charsmax(szCmd), szBuffer, charsmax(szBuffer), ',', true) != TOKEN_NOTFOUND)
{
register_clcmd(szCmd, "ClientCommand_VM");
szBuffer[0] != EOS && register_clcmd(szBuffer, "ClientCommand_VM");
}
}
else if (contain(key, "maxcount") != TOKEN_NOTFOUND)
{
switch (key[0])
{
case 'g': gConfig[ItemsLimit][ItemGravity] = str_to_num(value);
case 's': gConfig[ItemsLimit][ItemSpeed] = str_to_num(value);
case 'e': gConfig[ItemsLimit][ItemExplosiveGrenade] = str_to_num(value);
case 'j': gConfig[ItemsLimit][ItemMultijump] = str_to_num(value);
case 'i': gConfig[ItemsLimit][ItemInvisiblity] = str_to_num(value);
case 'm': gConfig[ItemsLimit][ItemMoney] = str_to_num(value);
case 'h': gConfig[ItemsLimit][ItemHealthPoints] = str_to_num(value);
}
}
else if (contain(key, "amount") != TOKEN_NOTFOUND)
{
switch (key[0])
{
case 'g': gConfig[ItemsAmount][ItemGravity] = any: str_to_float(value);
case 's': gConfig[ItemsAmount][ItemSpeed] = any: str_to_float(value);
case 'j': gConfig[ItemsAmount][ItemMultijump] = str_to_num(value);
case 'i': gConfig[ItemsAmount][ItemInvisiblity] = str_to_num(value);
case 'm': gConfig[ItemsAmount][ItemMoney] = str_to_num(value);
case 'h': gConfig[ItemsAmount][ItemHealthPoints] = str_to_num(value);
}
}

return true;
}

stock remove_all_colors(buffer[], const len)
{
replace_all(buffer, len, "\\r", NULL_STRING);
replace_all(buffer, len, "\\y", NULL_STRING);
replace_all(buffer, len, "\\d", NULL_STRING);
replace_all(buffer, len, "\\w", NULL_STRING);
}

stock rg_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
new Float:renderColor[3];
renderColor[0] = float(r);
renderColor[1] = float(g);
renderColor[2] = float(b);

set_entvar(entity, var_renderfx, fx);
set_entvar(entity, var_rendercolor, renderColor);
set_entvar(entity, var_rendermode, render);
set_entvar(entity, var_renderamt, float(amount));
}
Стоит мод пушки лазеры csdm .
Поставил данный плагин как вип меню для вип игроков.
Все в принципе работает без проблем кроме функции взять деньги.
Когда берешь деньги из випменю то если у тебя в игре уже есть заработанные за убийства деньги и их больше чем указано в випменю то они скидываются до значения обозначенного в випменю.
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
273
Реакции
424
Помог
5 раз(а)
Код:
case ItemMoney:
        {
-            rg_add_account(this, gConfig[ItemsAmount][ItemMoney], AS_SET);
+            rg_add_account(this, gConfig[ItemsAmount][ItemMoney], AS_ADD);
            gbPlayerAttachedItems[this][item] = true;
            client_print_color(this, print_team_default, "\4[%s]\1 %L", MESSAGE_PREFIX, this, "USE_ITEM_MONEY", gConfig[ItemsAmount][ItemMoney], gConfig[ItemsLimit][item] - giPlayerUsedItems[this][item], gConfig[ItemsLimit][item]);
        }
14 Дек 2018
sbelov020, опередил:rofl:
 
Сообщения
241
Реакции
435
Сия проблема - скорее не проблема, а жизненные реалии. Просто плагин, как любой управляющий орган не любит выдавать деньги. Я его хорошо понимаю, тоже не люблю платить зарплату. Приходят в конце месяца зомби с большими глазами и протягивают ручку... а ты им - нет денег сегодня =)

...и улыбочку пошире =)

У многих работа хорошая, но функция выдачи денег - хреновая =)))
 

Lis

Сообщения
59
Реакции
21
Предупреждения
10
Помог
1 раз(а)
sbelov020, Да все отлично спасибо.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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