Page 1 of 1
Cerere Plugin ZP
Posted: 08 Aug 2019, 23:54
by Archeon
Plugin Cerut: Item Limiter
Descriere (adica ce face el mai exact): Să limitez anumite arme/iteme din meniul "Extra Items", dintr-un fişier iar când cineva cumpără acel item să apară în dreptul lui [x/y] sau pur şi simplu să se facă gri, indicând că nu mai poate fi cumpărat pentru această rundă. Este un plugin deja pe alliedmodders (
https://forums.alliedmods.net/showthread.php?t=242103) dar este făcut doar pentru ZP 5.0+
Serverul ruleaza (HLDS/ReHLDS): HLDS
Versiune AMX Mod X: 1.8.2
Modul Serverului: Zombie Plague 4.3 fix6a (
https://forums.alliedmods.net/showthread.php?t=279404)
Mulţumesc.
Re: Cerere Plugin ZP
Posted: 08 Aug 2019, 23:55
by levin
treci pe 5.0....
Re: Cerere Plugin ZP
Posted: 09 Aug 2019, 00:00
by Archeon
L E V I N wrote: ↑08 Aug 2019, 23:55
treci pe 5.0....
Am fost pe 5.0, nu-mi place :)). Mi se pare mai uşor 4.3.
Re: Cerere Plugin ZP
Posted: 09 Aug 2019, 14:48
by levin
windows 10 e modern, da tu stai pe windows xp că ți place...cum vine asta?
Re: Cerere Plugin ZP
Posted: 09 Aug 2019, 18:45
by Archeon
Nu are legătură una cu alta. 4.3 oferă alte configurări mult mai simple și mai utile decât 5.0. Am cerut un plugin pentru versiunea pe care o folosesc, motivul pentru care folosesc versiunea asta, e problema mea. Dacă cineva ma poate ajuta cu aceasta cerere bine, dacă nu, pot trai și fără. Nu iti spun asta cu răutate, pur și simplu prefer 4.3.
Re: Cerere Plugin ZP
Posted: 09 Aug 2019, 19:14
by levin
o să văd când am timp, poate în seara asta
Re: Cerere Plugin ZP
Posted: 09 Aug 2019, 21:57
by levin
încearcă să pui zp50_items&const .sma/.inc + zp50_colorchat.inc
zp50_items.inc
Code: Select all
#if defined _zp50_items_included
#endinput
#endif
#define _zp50_items_included
//#include <zp50_core>
#include <zp50_items_const>
#if AMXX_VERSION_NUM >= 175
#pragma reqlib zp50_items
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib zp50_items
#endif
#else
#pragma library zp50_items
#endif
/**
* Registers a custom item which will be added to the extra items menu of ZP.
*
* Note: The returned item ID can be later used to catch item
* selection events for the zp_item_select_() forwards.
*
* @param name Caption to display on the menu.
* @param cost Cost to display on the menu.
* @return An internal item ID, or ZP_INVALID_ITEM on failure.
*/
native zp_items_register(const name[], cost)
/**
* Returns an item's ID.
*
* @param name Item name to look for.
* @return Internal item ID, or ZP_INVALID_ITEM if not found.
*/
native zp_items_get_id(const real_name[])
/**
* Returns an item's name.
*
* @param itemid A valid item ID.
* @param name The buffer to store the string in.
* @param len Character size of the output buffer.
* @return True on success, false otherwise.
*/
native zp_items_get_name(itemid, name[], len)
/**
* Returns an item's real name (used when registering the item).
*
* @param classid A valid item ID.
* @param name The buffer to store the string in.
* @param len Character size of the output buffer.
* @return True on success, false otherwise.
*/
native zp_items_get_real_name(itemid, real_name[], len)
/**
* Returns an item's cost.
*
* @param itemid A valid item ID.
* @return Item's cost.
*/
native zp_items_get_cost(itemid)
/**
* Shows menu with available extra items for player.
*
* @param id Player index.
*/
native zp_items_show_menu(id)
/**
* Forces a player to buy an extra item.
*
* @param id Player index.
* @param itemid A valid extra item ID.
* @param ignorecost If set, item's cost won't be deduced from player.
* @return True on success, false otherwise.
*/
native zp_items_force_buy(id, itemid, ignorecost = false)
/**
* Appends text to an item being displayed on the extra items menu.
* Use this on the item select pre forward.
*
* @param text Additional text to display.
*/
native zp_items_menu_text_add(const text[])
/**
* Called when determining whether an item should be available to a player.
*
* Possible return values are:
* - ZP_ITEM_AVAILABLE (show in menu, allow selection)
* - ZP_ITEM_NOT_AVAILABLE (show in menu, don't allow selection)
* - ZP_ITEM_DONT_SHOW (don't show in menu, don't allow selection)
*
* @param id Player index.
* @param itemid Internal item ID.
* @param ignorecost Whether item cost should be ignored.
*/
forward zp_fw_items_select_pre(id, itemid, ignorecost)
/**
* Called after a player selected an item from the extra items menu.
*
* @param id Player index.
* @param itemid Internal item ID.
* @param ignorecost Whether item cost should be ignored.
*/
forward zp_fw_items_select_post(id, itemid, ignorecost)
limiter.sma
Code: Select all
#include <amxmodx>
//#include <amxmisc>
#include <amx_settings_api>
//#include <zp50_core>
#include <zp50_items>
#define PLUGIN "[ZP50] Class unlocker"
#define VERSION "1.1"
#define AUTHOR "Catastrophe"
#define MAX_LIST 128
#define PLUGIN_MODE 1
new const EXTRAS_FILE[] = "zp_extra_limit.ini"
new Array:extra_id
new Array:extra_limit
#if defined PLUGIN_MODE 1
new extra_count[33][MAX_LIST]
#endif
#if defined PLUGIN_MODE 2
new extra_count_global[MAX_LIST]
#endif
new zpel_cvars[3]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "event_newround", "a", "1=0", "2=0")
register_cvar("ZPEL","1",(FCVAR_SERVER|FCVAR_SPONLY))
zpel_cvars[0] = register_cvar("zp_extra_limit_mode", "0")
}
public plugin_precache()
{
extra_id = ArrayCreate(64, 1)
extra_limit = ArrayCreate(4, 1)
amx_load_setting_string_arr(EXTRAS_FILE, "LIMIT", "item_id", extra_id)
amx_load_setting_string_arr(EXTRAS_FILE, "LIMIT", "item_limit", extra_limit)
}
public event_newround()
{
if(get_pcvar_num(zpel_cvars[0]) != 0) return
#if defined PLUGIN_MODE 1
for(new i = 1; i <= get_maxplayers(); i++) arrayset(extra_count[i], 0, MAX_LIST - 1)
#endif
#if defined PLUGIN_MODE 2
for(new j = 0; j <= MAX_LIST - 1; j++) extra_count_global[j] = 0
#endif
}
public zp_fw_items_select_pre(id, itemid, ignorecost)
{
new txt[32]
for(new i = 0; i <= ArraySize(extra_id) - 1; i++)
{
new e_id[64], e_lim[4]
new e_lim_num
ArrayGetString(extra_id, i, e_id, charsmax(e_id))
ArrayGetString(extra_limit, i, e_lim, charsmax(e_lim))
e_lim_num = str_to_num(e_lim)
if(itemid == zp_items_get_id(e_id))
{
#if defined PLUGIN_MODE 1
if(extra_count[id][i] >= e_lim_num)
{
format(txt, charsmax(txt), "\d[%d/%d]", extra_count[id][i],e_lim_num)
zp_items_menu_text_add(txt)
return ZP_ITEM_NOT_AVAILABLE
}
else
{
format(txt, charsmax(txt), "\w[%d/%d]", extra_count[id][i],e_lim_num)
zp_items_menu_text_add(txt)
return ZP_ITEM_AVAILABLE
}
#endif
#if defined PLUGIN_MODE 2
if(extra_count_global[i] >= e_lim_num)
{
format(txt, charsmax(txt), "\d[%d/%d]", extra_count[i],e_lim_num)
zp_items_menu_text_add(txt)
return ZP_ITEM_NOT_AVAILABLE
}
else
{
format(txt, charsmax(txt), "\w[%d/%d]", extra_count[i],e_lim_num)
zp_items_menu_text_add(txt)
return ZP_ITEM_AVAILABLE
}
#endif
}
}
return ZP_ITEM_AVAILABLE
}
public zp_fw_items_select_post(id, itemid, ignorecost)
{
for(new i = 0; i <= ArraySize(extra_id) - 1; i++)
{
new e_id[64]
ArrayGetString(extra_id, i, e_id, charsmax(e_id))
if(itemid == zp_items_get_id(e_id))
{
#if defined PLUGIN_MODE 1
extra_count[id][i]++
#endif
#if defined PLUGIN_MODE 2
extra_count_global[i]++
#endif
}
}
}
itemul de l vrei cu limită îl pui prin zp_items_register("NUME",PRET) în .sma iar în limiter.ini adaugi pentru limită cum zice în acel topic de pe allied (adica înlocuiești zp_register_extra_item)
Re: Cerere Plugin ZP
Posted: 09 Aug 2019, 22:54
by Archeon
În amx_plugins:
Code: Select all
unknown unknown unknown limiter.amxx bad load
zp50_items.inc l-am folosit pe cel de la tine, pentru const.inc aveam file-ul din topic-ul de pe allied. S-a compilat fără erori dar totuşi nu îl ia. Ce-am făcut aiurea?
Mulţumesc!
Re: Cerere Plugin ZP
Posted: 10 Aug 2019, 00:05
by levin
vezi în logs sau gamecp dc dă fail..
Re: Cerere Plugin ZP
Posted: 10 Aug 2019, 00:36
by Archeon
Verific mâine şi revin cu edit. Mulţumesc.
Edit:
L 08/10/2019 - 13:26:00: [AMXX] Plugin "limiter.amxx" failed to load: Module/Library "amx_settings_api" required for plugin. Check modules.ini.
Modules.ini
Code: Select all
fun
engine
fakemeta
geoip
sockets
regex
nvault
cstrike
csx
hamsandwich