- Ошибка
-
AMX Mod X Compiler 1.9.0.5271
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team
knives.sma(59) : warning 229: index tag mismatch (symbol "g_iKnives")
knives.sma(72) : warning 213: tag mismatch
knives.sma(92) : warning 229: index tag mismatch (symbol "g_iKnives")
knives.sma(110) : warning 229: index tag mismatch (symbol "g_iKnives")
knives.sma(154) : warning 229: index tag mismatch (symbol "g_iKnives")
knives.sma(181) : warning 229: index tag mismatch (symbol "g_iKnives")
knives.sma(222) : warning 229: index tag mismatch (symbol "g_iKnives")
Header size: 1484 bytes
Code size: 7616 bytes
Data size: 5172 bytes
Stack/heap size: 16384 bytes
Total requirements: 30656 bytes
7 Warnings.
Done.
- Компилятор
- WEB-компилятор
- Amx Mod X
- 1.9.0
- Исходный код
-
#include amxmodx
#include fakemeta
#include hamsandwich
#define PLUGIN "Knives Shop"
#define VERSION "1.3a"
#define AUTHOR "OverGame"
#define OFFSET_MONEY 115
#define OFFSET_WEAPON 41
#define OFFSET_LINUX 4
#define FILE_BASE "/addons/amxmodx/configs/knives.ini"
enum KNIVES_DATA
{
NAME[33],
VIEW[128],
PLAYER[128],
COST
};
new Array:g_iArrayKnives, g_iKnives[KNIVES_DATA], g_iKnife[33];
new g_iReplace[][][] =
{
{"!g", "^4"},
{"!t", "^3"},
{"!y", "^1"},
{"\r", ""},
{"\y", ""},
{"\d", ""}
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /knife", "Show_MenuShop");
register_clcmd("say_team /knife", "Show_MenuShop");
RegisterHam(Ham_Item_Deploy, "weapon_knife", "Ham_Item_Deploy_Knife_Post", true);
register_dictionary("knives.txt");
}
public plugin_natives()
{
register_native("get_user_knives", "native_get_user_knives", true);
register_native("set_user_knives", "native_set_user_knives", true);
}
public native_get_user_knives(iClient)
return g_iKnife[iClient];
public native_set_user_knives(iClient, iKnife, iMessage)
{
if((g_iKnife[iClient] = iKnife) == iKnife)
{
ArrayGetArray(g_iArrayKnives, iKnife, g_iKnives);
if(iMessage)
UTIL_SayText(iClient, "%L", LANG_PLAYER, "KNIVES_GIVE", g_iKnives[NAME]);
}
else
return false;
return true;
}
public plugin_precache()
{
g_iArrayKnives = ArrayCreate(KNIVES_DATA);
new szBuffer[256], szCost[10], iFile = fopen(FILE_BASE, "rt");
while(!feof(iFile))
{
fgets(iFile, szBuffer, 255);
trim(szBuffer);
if(szBuffer[0] == '"')
{
parse(szBuffer, g_iKnives[NAME], 32, szCost, 9, g_iKnives[VIEW], 127, g_iKnives[PLAYER], 127);
g_iKnives[COST] = str_to_num(szCost);
if(!equal(g_iKnives[VIEW], ""))
engfunc(EngFunc_PrecacheModel, g_iKnives[VIEW]);
if(!equal(g_iKnives[PLAYER], ""))
engfunc(EngFunc_PrecacheModel, g_iKnives[PLAYER]);
ArrayPushArray(g_iArrayKnives, g_iKnives);
}
else
continue;
}
fclose(iFile);
}
public client_putinserver(iClient)
g_iKnife[iClient] = 0;
public Ham_Item_Deploy_Knife_Post(iWeapon)
{
new iClient = get_pdata_cbase(iWeapon, OFFSET_WEAPON, OFFSET_LINUX);
if(is_user_alive(iClient))
{
ArrayGetArray(g_iArrayKnives, g_iKnife[iClient], g_iKnives);
if(!equal(g_iKnives[VIEW], ""))
set_pev(iClient, pev_viewmodel2, g_iKnives[VIEW]);
if(!equal(g_iKnives[PLAYER], ""))
set_pev(iClient, pev_weaponmodel2, g_iKnives[PLAYER]);
}
return HAM_IGNORED;
}
public Show_MenuShop(iClient)
{
new iMenu = menu_create(UTIL_GetReplace("KNIVES_TITLE"), "Handle_MenuShop");
for(new i; i < ArraySize(g_iArrayKnives); i++)
{
new szTemp[10];
num_to_str(i, szTemp, charsmax(szTemp));
menu_additem(iMenu, UTIL_GetItemCost(iClient, i), szTemp);
}
menu_setprop(iMenu, MPROP_BACKNAME, UTIL_GetReplace("KNIVES_BACK"));
menu_setprop(iMenu, MPROP_NEXTNAME, UTIL_GetReplace("KNIVES_NEXT"));
menu_setprop(iMenu, MPROP_EXITNAME, UTIL_GetReplace("KNIVES_EXIT"));
menu_display(iClient, iMenu, 0);
return PLUGIN_HANDLED;
}
public Handle_MenuShop(iClient, iMenu, iItem)
{
if(iItem == MENU_EXIT)
{
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
new szData[15], szName[64], iAccess, iCallBack;
menu_item_getinfo(iMenu, iItem, iAccess, szData, 14, szName, 63, iCallBack);
new iKeys = str_to_num(szData);
ArrayGetArray(g_iArrayKnives, iKeys, g_iKnives);
if(g_iKnife[iClient] == iKeys)
{
UTIL_SayText(iClient, "%L", LANG_PLAYER, "KNIVES_TAKEN");
return PLUGIN_HANDLED;
}
else
if(g_iKnives[COST] <= fm_get_user_money(iClient))
{
fm_set_user_money(iClient, fm_get_user_money(iClient) - g_iKnives[COST]);
UTIL_SayText(iClient, "%L", LANG_PLAYER, g_iKnives[COST] ? "KNIVES_BUYED" : "KNIVES_SELECTED", g_iKnives[NAME]);
UTIL_Set_User_Knife(iClient, iKeys);
}
else
UTIL_SayText(iClient, "%L", LANG_PLAYER, "KNIVES_NO_MONEY");
return PLUGIN_HANDLED;
}
bool:UTIL_Set_User_Knife(iClient, iKnife)
{
g_iKnife[iClient] = iKnife;
if(is_user_alive(iClient))
{
engclient_cmd(iClient, "weapon_knife");
ArrayGetArray(g_iArrayKnives, g_iKnife[iClient], g_iKnives);
if(!equal(g_iKnives[VIEW], ""))
set_pev(iClient, pev_viewmodel2, g_iKnives[VIEW]);
if(!equal(g_iKnives[PLAYER], ""))
set_pev(iClient, pev_weaponmodel2, g_iKnives[PLAYER]);
return true;
}
return false;
}
stock UTIL_SayText(client, const szMessage[], any:...)
{
new iCount = 1, iPlayers[32];
static szPost[188], i;
vformat(szPost, 187, szMessage, 3);
for(i = 0; i < sizeof(g_iReplace); i++)
replace_all(szPost, 187, g_iReplace[i][0], g_iReplace[i][1]);
if(client) iPlayers[0] = client; else get_players(iPlayers, iCount, "ch");
{
for(i = 0; i < iCount; i++)
{
if(is_user_connected(iPlayers[i]))
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szPost);
message_end();
}
}
}
}
stock UTIL_GetItemCost(iClient, iKnife)
{
static szReplace[128];
ArrayGetArray(g_iArrayKnives, iKnife, g_iKnives);
if(iKnife == g_iKnife[iClient])
format(szReplace, 127, "\d%s", g_iKnives[NAME]);
else
if(g_iKnives[COST])
format(szReplace, 127, "%s \d[%d]", g_iKnives[NAME], g_iKnives[COST]);
else
format(szReplace, 127, "%s", g_iKnives[NAME]);
return szReplace;
}
stock UTIL_GetReplace(const szRepl[])
{
static szReplace[128];
format(szReplace, 127, "%L", LANG_PLAYER, szRepl);
return szReplace;
}
stock fm_get_user_money(iClient)
return get_pdata_int(iClient, OFFSET_MONEY);
stock fm_set_user_money(iClient, iCost, iFlash = true)
{
set_pdata_int(iClient , OFFSET_MONEY , iCost);
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Money"), _, iClient);
write_long(iCost);
write_byte(iFlash ? 1 : 0);
message_end();
}
Плагин Магазина ножей
В этой теме было размещено решение! Перейти к решению.
Download all Attachments
-
5.9 KB Просмотры: 169
-
150 байт Просмотры: 147