[ZP] Ultimate Addon UAIO 3.0

В този раздел се качват всякакви съб-плъгини, тоест добавки за такива плъгини, които имат собствено API и позволяват изработката на съб-плъгини работещи с тях.
Отговори
Потребителски аватар

Автор на темата
<VeCo>
AMXX Скриптър
AMXX Скриптър
Мнения: 58
Регистриран: 28 яну 2019, 19:01
Се отблагодари: 2 пъти
Получена благодарност: 19 пъти

[ZP] Ultimate Addon UAIO 3.0

Мнение от <VeCo> » 08 окт 2016, 23:50

[ZP] Ultimate Addon UAIO by <VeCo>
Версия: 3.0
Автор: <VeCo>
Категория: Общо предназначение
Модификация: Counter-Strike (CS)
Описание:
Този плъгин съдържа най-разнообразни екстри за Zombie Plague.
Ще го ъпдейтвам постепенно с всякакви интересни заявки.

Засега плъгинът съдържа:
  • Запазване на аммо паковете
  • Запазване на последния избран клас
  • Показване на оставащата кръв на зомбито, което атакувате, чрез съобщение в центъра на екрана
  • Команда, с която да виждате колко аммо пакове имате в момента
  • Команда за даване на аммо пакове на другите играчи
  • Админ команда за даване на аммо пакове на други играчи
  • Команда, с която да виждате колко аммо пакове има даден играч.
  • Админ команда за взимане на аммо пакове от други играчи
  • Админ команда за преглед на аммо паковете на всички играчи в сървъра.
Чат команди:
/give "име" "аммо пакове" - давате определен брой аммо пакове на определен играч
/ap - показва Ви в чата колко аммо пакове имате
/ammo "име" - показва колко аммо пакове има даден играч

Админ команди:
zp_giveap "име / #userid / @H / @Z / @ALL" "аммо пакове" - давате определен брой аммо пакове на определен играч / всички хора / всички зомбита / всички играчи

zp_takeap "име / #userid / @H / @Z / @ALL" "аммо пакове" - взимате определен брой аммо пакове от определен играч / всички хора / всички зомбита / всички играчи

zp_ammolist - показва Name / IP / SteamID / Ammo Packs на всички играчи в сървъра

CVARs:
zp_ua_data_save_type -1/0/1/2 - по какво да се запазват данните за играчите :
-1 - изключено
0 - по ник
1 - по IP
2 - по STEAMID

zp_ua_give_command 1/0 - включва/изключва командата /give
zp_ua_ap_command 1/0 - включва/изключва командата /ap
zp_ua_ammo_command 1/0 - включва/изключва командата /ammo

zp_ua_show_hp 0/1/2/3 - кога да показва на колко кръв остава вашата жертва зомби :
0 - изключено
1 - жертвата е зомби
2 - жертвата е немезис
3 - жертвата е или зомби, или немезис

zp_ua_give_ammo_public 1/0 - включва/изключва показването на съобщение на всички играчи, когато играч даде аммо пакове на друг играч

zp_ua_ammo_limit 0 - лимит на запазените аммо пакове (0 - няма лимит)

Модули:

Код: Избери всички

#include <nvault>
Билбиотеки:

Код: Избери всички

#include <zombieplague>
Промени:
  • 1.0 - първа версия на плъгина
  • 1.1 - добавен CVAR за задаване на лимит на запазените аммо пакове
  • 1.2 - поправен бъг с client_print натива
  • 1.3 - поправени бъгове с даването на аммо пакове на други играчи
  • 1.4 - сега вместо отрицателна стойност на кръвта, ще ви се показва надписа "KILLED!" в центъра на екрана, когато убиете зомби
  • 1.5 - добавено автоматично запазване на аммо паковете на всеки нов рунд, добавено автоматично зареждане на аммо паковете при смяна на ника на играч
  • 1.6 - променен е zp_ua_data_save_type CVAR-ът, поправен бъг със запазването на аммо паковете, поправен бъг с /give командата, добавена е админ командата zp_giveap
  • 1.7 - поправен бъг с zp_giveap командата
  • 1.8 - поправен бъг със запазването на аммо паковете по IP
  • 1.9 - промяна в кода за запазването на аммо паковете
  • 2.0 - поправен бъг в Damage event-a, добавена е командата /ammo
  • 2.1 - поправен бъг с /ammo командата
  • 2.2 - поправен бъг в Damage event-a (отново)
  • 2.3 - промяна в кода за запазването на аммо паковете (отново, дано да е за последно)
  • 2.4 - zp_giveap вече може и да отнема аммо пакове на играч при използване на отрицателна стойност на аммо паковете
  • 2.5 - добавена е админ командата zp_takeap
  • 2.6 - добавени CVAR-и за включване/изключване на чат командите, вече ако не сте записан в nvault файла (т.е. ако влизате за първи път в сървъра) вашият брой аммо пакове ще бъде като ZP CVAR-а zp_starting_ammo_packs
  • 2.7 - добавено е логване на командите за даване/взимане на аммо пакове
  • 2.8 - премахнат е ненужен код, добавена е поддръжка за ZP 5.0 или по-нова версия (както и define за него)
  • 2.9 - поправена е грешка в поддръжката за ZP 5.0
  • 3.0 - добавена е командата zp_ammolist
Благодарности:
--- @sick : за идеята на плъгина и тестването му
--- @xxxDiVXxxx : за идеята за командата /ap и за zp_takeap
--- @ardi : за идеята за CVAR-a за задаване на лимит на запазените аммо пакове
--- @remotiv : за идеята за zp_giveap командата
--- @gloBi : за идеята за логването на командите за даване на аммо пакове
--- @d-WaLkMaN-b ;] : за идеята за zp_ammolist командата

Промяна на сорс кода:

Код: Избери всички

#define ADMIN_GIVE_AMMO ADMIN_IMMUNITY // ниво за достъп до zp_giveap командата
#define ADMIN_TAKE_AMMO ADMIN_RCON // ниво за достъп до zp_takeap командата
#define ADMIN_AMMO_LIST ADMIN_ADMIN //ниво за достъп до zp_ammolist командата

//#define USE_ZP_50 // махнете "//" в началото на този ред, ако ползвате Zombie Plague 5.0 или по-нова версия
zp_ua_uaio_veco.rar
(13.61 KиБ) Свален 122 пъти
zp_ua_uaio_veco.rar
(13.61 KиБ) Свален 122 пъти
:pepo_think3:

Потребителски аватар

Dachoni
Потребител
Потребител
Мнения: 29
Регистриран: 23 ное 2017, 16:48

[ZP] Ultimate Addon UAIO 3.0

Мнение от Dachoni » 18 дек 2017, 17:16

Ползвам ZP 5.08 и изписва това:

Код: Избери всички

: [AMXX] Run time error 10 (plugin "zp_ua_uaio_veco.amxx") (native "zp_ammopacks_get") - debug not enabled!
Добавих и вече не вади грешка.
Последна промяна от Dachoni на 19 дек 2017, 09:36, променено общо 1 път.

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5036
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 56 пъти
Получена благодарност: 469 пъти
Години: 21
Контакти:

[ZP] Ultimate Addon UAIO 3.0

Мнение от OciXCrom TM » 18 дек 2017, 23:22

Активирай debug преди да дадеш грешката.

Потребителски аватар

NiCk
Потребител
Потребител
Мнения: 4
Регистриран: 20 фев 2018, 15:19

[ZP] Ultimate Addon UAIO 3.0

Мнение от NiCk » 26 фев 2018, 17:51

Здравейте, бихте ли ми преработили плъгина да работи с zp 4.3 fix5a
като пусна плъгина и сървъра не тръгва,
етоя и грешката.

stray key in process_key: item_getiteminfo 61
[HACKD] Found compatible ReHLDS engine.
[ReAimDetector] Version: 0.2.0 Linux 'Counter-Strike 1.6'
[ReAimDetector] Success: Build ReHLDS version defined Linux '1306'.
[WHB] Version: 1.5.692 Linux (Usage SSE 4.1)
[WHB] Success: Build ReHLDS version defined Linux '1306'
[WHB] Success: Configuration executed.
[ReAuthCheck] Version: 0.1.6 Linux 'Counter-Strike 1.6'
[ReAuthCheck] Success: Configuration executed.
[ReAuthCheck] Success: Build ReHLDS version defined Linux '1306'
ReGameDLL version: 5.3.0.273-dev
L 02/26/2018 - 17:35:34: -------- Mapchange to zm_dust_winter --------
[AMXX] Loaded 3 admins from file
Segmentation fault

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5036
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 56 пъти
Получена благодарност: 469 пъти
Години: 21
Контакти:

[ZP] Ultimate Addon UAIO 3.0

Мнение от OciXCrom TM » 26 фев 2018, 19:56

Плъгинът си е направен да работи и на 4.3, и на 5.0, като по подразбиране е настроен за 4.3. Няма какво да се оправя по кода. От грешките които си предоставил, не виждам нищо свързано със самия плъгин. То ако не е подходящ за 4.3, щеше да изпише, че не може да го подкара, а не целият сървър да не тръгва.

Потребителски аватар

aBlack P4M's
Рекламатор
Рекламатор
Мнения: 116
Регистриран: 14 авг 2018, 01:10
Се отблагодари: 25 пъти
Получена благодарност: 20 пъти

[ZP] Ultimate Addon UAIO 3.0

Мнение от aBlack P4M's » 22 окт 2018, 14:01

Значи вчера инсталирах плъгини на 4.3 fix5a версията на ZP, всичко е ток и жица обаче днеска забелязах един проблем ?! След като рестартирам сървъра от панела на хостина тоест цялостен рестарт, аммо паковете не се запазват изчезват ?! Направил съм да се запазват чрез никнейм но уби след рестарт всичко се връща на нулата... Как може да се преправи този проблем ?
Изображение
Black-Gaming FB Page
My Steam Profile
ИзображениеИзображение

Потребителски аватар

summertime vibes PSA
Тестов модератор
Тестов модератор
Мнения: 944
Регистриран: 27 ное 2016, 17:47
Местоположение: In the Heaven
Се отблагодари: 39 пъти
Получена благодарност: 74 пъти
Контакти:

[ZP] Ultimate Addon UAIO 3.0

Мнение от summertime vibes PSA » 22 окт 2018, 14:48

Мисля, че с fVault ще е по-добро решение.
Изображение

Потребителски аватар

aBlack P4M's
Рекламатор
Рекламатор
Мнения: 116
Регистриран: 14 авг 2018, 01:10
Се отблагодари: 25 пъти
Получена благодарност: 20 пъти

[ZP] Ultimate Addon UAIO 3.0

Мнение от aBlack P4M's » 22 окт 2018, 14:58

F33L Th3 P0W3R. написа:
22 окт 2018, 14:48
Мисля, че с fVault ще е по-добро решение.
А как ще се направи това ? Би ли ме светнал, че не разбирам много много от скриптинг-а.
Изображение
Black-Gaming FB Page
My Steam Profile
ИзображениеИзображение

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5036
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 56 пъти
Получена благодарност: 469 пъти
Години: 21
Контакти:

[ZP] Ultimate Addon UAIO 3.0

Мнение от OciXCrom TM » 22 окт 2018, 20:54

Няма значение дали е fVault или нещо друго. Важното е запазването да се прави в client_disconnect, а load-ването в client_connect, без никакъв task за забавяне.

Потребителски аватар

aBlack P4M's
Рекламатор
Рекламатор
Мнения: 116
Регистриран: 14 авг 2018, 01:10
Се отблагодари: 25 пъти
Получена благодарност: 20 пъти

[ZP] Ultimate Addon UAIO 3.0

Мнение от aBlack P4M's » 23 окт 2018, 18:20

OciXCrom™ написа:
22 окт 2018, 20:54
Няма значение дали е fVault или нещо друго. Важното е запазването да се прави в client_disconnect, а load-ването в client_connect, без никакъв task за забавяне.
Има ли кой да го направи тука ? Да промени това което викаш и да пастне кода на главния плъгин и аз да я заместя със старото ?! Както казах в предишния отговор.. Не разбирам от скриптинг-а
Изображение
Black-Gaming FB Page
My Steam Profile
ИзображениеИзображение

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5036
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 56 пъти
Получена благодарност: 469 пъти
Години: 21
Контакти:

[ZP] Ultimate Addon UAIO 3.0

Мнение от OciXCrom TM » 24 окт 2018, 12:13

Код: Избери всички

/*
---------------------------------------------------------
   #  #  #    #===    ###    ##    #
  #    ##     #===   #      #  #    #
   #   #      #===    ###    ##    #
---------------------------------------------------------
[ZP] Ultimate Addon UAIO by <VeCo> 3.0

Plugin made by <VeCo>
Special thanks to:
 - sick : for the idea of the plugin and testing.
 - xxxDiVXxxx : for the idea of the /ap command and zp_takeap.
 - ardi : for the idea of the ammo pack limit CVAR.
 - remotiv : for the idea of the zp_giveap command.
 - gloBi: for the idea of logging give commands.
 - d-WaLkMaN-b ;] : for the idea for zp_ammolist command.

If you modify the code, please DO NOT change the author!

---------------------------------------------------------

* PLUGIN CONTAINS:

 ==> Save Ammo Packs
 ==> Save Last Chosen Zombie Class
 ==> Show remaining health of the attacked zombie
 ==> Command for seeing your amount of your ammo packs.
 ==> Command for giving ammo packs to another player.
 ==> Admin command for giving ammo packs to other players.
 ==> Command for seeing another player's amount of ammo packs.
 ==> Admin command for taking ammo packs from other players.

---------------------------------------------------------
Contacts:
e-mail: [email protected]
skype: veco_kn
---------------------------------------------------------
Changes log:
 -> v 1.0 = First release!
 -> v 1.1 = Added CVAR for limit of the ammo packs.
 -> v 1.2 = Fixed bug with client_print native.
 -> v 1.3 = Fixed bugs with ammo give.
 -> v 1.4 = Added "KILLED!" instead of negative health value
	    in the victim health displayer.
 -> v 1.5 = Added autosave on new round.
	    Added autoload on player nick change.
 -> v 1.6 = Changed zp_ua_data_save_type CVAR.
	    Fixed bug with the ammo pack saving.
	    Fixed bug in the /give command.
	    Added admin command zp_giveap.
 -> v 1.7 = Fixed bug with the zp_giveap command.
 -> v 1.8 = Fixed bug with saving the ammo packs to ip.
 -> v 1.9 = Changes in code for saving.
 -> v 2.0 = Fixed bug with Damage event.
	    Added chat command /ammo.
 -> v 2.1 = Fixed bugs in the /ammo command.
 -> v 2.2 = Fixed bug with Damage event. (again)
 -> v 2.3 = Changes in code for saving. (again, hope they are final)
 -> v 2.4 = zp_giveap now can take ammo packs if you use negative
	    value.
 -> v 2.5 = Added admin command zp_takeap.
 -> v 2.6 = Added CVARs for turning off/on the chat commands.
	    If your ammo packs aren't saved in the nvault file,
	    you will have the ammo pack amount from the ZP
	    CVAR zp_starting_ammo_packs.
 -> v 2.7 = Added logging for give and take commands.
 -> v 2.8 = Removed unnecessary code.
	    Added support for ZP 5.0 or higher and define
	    for it.
 -> v 2.9 = Fixed error in ZP 5.0 support.
 -> v 3.0 = Added zp_ammolist command.
---------------------------------------------------------
Don't forget to visit http://www.amxmodxbg.org :)
---------------------------------------------------------
*/

#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define ADMIN_GIVE_AMMO ADMIN_IMMUNITY // access level for zp_giveap command
#define ADMIN_TAKE_AMMO ADMIN_RCON // access level for zp_takeap command
#define ADMIN_AMMO_LIST ADMIN_ADMIN // access level for zp_ammolist command

//#define USE_ZP_50 // remove "//" in the beginning of this line if you use Zombie Plague 5.0 or higher

#if !defined USE_ZP_50
#include <zombieplague>
#else
#include <zp50_core>
#include <zp50_class_zombie>
#include <zp50_class_nemesis>
#include <zp50_ammopacks>
#endif

#define LOGFILE "addons/amxmodx/logs/zp_ua_uaio_veco.log"

/*START - From colorchat.inc by Numb */
enum Color {
	NORMAL = 1,
	GREEN,
	TEAM_COLOR,
	GREY,
	RED,
	BLUE,
}

new TeamName[][] = {
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}
/*END - From colorchat.inc by Numb */

new must_save[33],data_vault, pointer_activity,
cvar_data_save_type, cvar_cmd_give,cvar_cmd_ap,cvar_cmd_ammo, cvar_show_hp, cvar_give_ammo_public, cvar_ammo_limit
public plugin_init() {
	register_plugin("[ZP] Ultimate Addon UAIO by <VeCo>", "2.9", "<VeCo>")
	register_cvar("zp_ua_uaio_veco_version","2.9",FCVAR_SERVER | FCVAR_SPONLY)
	
	pointer_activity = get_cvar_pointer("amx_show_activity")
	
	register_concmd("zp_giveap","admin_ammo_give",ADMIN_GIVE_AMMO,"<name / #userid / @H / @Z / @ALL> <ammo packs>")
	register_concmd("zp_takeap","admin_ammo_take",ADMIN_TAKE_AMMO,"<name / #userid / @H / @Z / @ALL> <ammo packs>")
	register_concmd("zp_ammolist","admin_ammo_list",ADMIN_AMMO_LIST,"- displays all players' ammo packs")
	
	register_clcmd("say","hook_say")
	register_clcmd("say_team","hook_say")
	
	register_event("Damage","event_damage","b","2!0","3=0","4!0")
	
	cvar_data_save_type = register_cvar("zp_ua_data_save_type","0")
	
	cvar_cmd_give = register_cvar("zp_ua_give_command","1")
	cvar_cmd_ap = register_cvar("zp_ua_ap_command","1")
	cvar_cmd_ammo = register_cvar("zp_ua_ammo_command","1")
	
	cvar_show_hp = register_cvar("zp_ua_show_hp","3")
	
	cvar_give_ammo_public = register_cvar("zp_ua_give_ammo_public","1")
	
	cvar_ammo_limit = register_cvar("zp_ua_ammo_limit","0")
	
	data_vault = nvault_open("zp_ua_uaio_veco")
}

public admin_ammo_give(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	new arg_name[32],arg_ap[10]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_ap,9)
	
	new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
	target,type, num_ap = str_to_num(arg_ap)
	
	if(!equali(arg_name,"@H") && !equali(arg_name,"@Z") && !equali(arg_name,"@ALL")) target = cmd_target(id,arg_name,0)
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	get_user_name(target,target_name,31)
	get_user_ip(target,target_ip,15,1)
	get_user_authid(target,target_steamid,31)
	
	if(num_ap <= 0)
	{
		console_print(id,"[ZP]^x01 You can give only positive ammo packs.")
		return PLUGIN_HANDLED
	}
	
	type = 0
	
	if(equali(arg_name,"@H"))
	{
		type = 1
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
	} else if(equali(arg_name,"@Z"))
	{
		type = 2
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
	} else if(equali(arg_name,"@ALL"))
	{
		type = 3
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
	} else {
#if !defined USE_ZP_50
		zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
#else
		zp_ammopacks_set(target, zp_ammopacks_get(target) + num_ap)
#endif
	}
	
	if(get_pcvar_num(cvar_give_ammo_public))
	{
		switch(get_pcvar_num(pointer_activity))
		{
			case 1:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all humans.",arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all zombies.",arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all players.",arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
				}
			}
			case 2:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all humans.",name,arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all zombies.",name,arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all players.",name,arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
				}
			}
		}
	}
	
	switch(type)
	{
		case 1: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all humans.",name,ip,steamid,num_ap)
		case 2: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all zombies.",name,ip,steamid,num_ap)
		case 3: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all players.",name,ip,steamid,num_ap)
		default: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
	}
	
	return PLUGIN_HANDLED
}

public admin_ammo_take(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	new arg_name[32],arg_ap[10]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_ap,9)
	
	new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
	target,type, num_ap = str_to_num(arg_ap)
	
	if(!equali(arg_name,"@H") && !equali(arg_name,"@Z") && !equali(arg_name,"@ALL")) target = cmd_target(id,arg_name,0)
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	get_user_name(target,target_name,31)
	get_user_ip(target,target_ip,15,1)
	get_user_authid(target,target_steamid,31)
	
	if(num_ap <= 0)
	{
		console_print(id,"[ZP]^x01 You can take only positive ammo packs.")
		return PLUGIN_HANDLED
	}
	
	type = 0
	
	if(equali(arg_name,"@H"))
	{
		type = 1
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
	} else if(equali(arg_name,"@Z"))
	{
		type = 2
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
	} else if(equali(arg_name,"@ALL"))
	{
		type = 3
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
	} else {
#if !defined USE_ZP_50
		zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) - num_ap)
#else
		zp_ammopacks_set(target, zp_ammopacks_get(target) - num_ap)
#endif
	}
	
#if !defined USE_ZP_50
	if(zp_get_user_ammo_packs(target) < 0) zp_set_user_ammo_packs(target,0)
#else
	if(zp_ammopacks_get(target) < 0) zp_ammopacks_set(target,0)
#endif
	
	if(get_pcvar_num(cvar_give_ammo_public))
	{
		switch(get_pcvar_num(pointer_activity))
		{
			case 1:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all humans.",arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all zombies.",arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all players.",arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from ^x04%s^x01.",arg_ap,target_name)
				}
			}
			case 2:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all humans.",name,arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all zombies.",name,arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all players.",name,arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from ^x04%s^x01.",name,arg_ap,target_name)
				}
			}
		}
	}
	
	switch(type)
	{
		case 1: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all humans.",name,ip,steamid,num_ap)
		case 2: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all zombies.",name,ip,steamid,num_ap)
		case 3: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all players.",name,ip,steamid,num_ap)
		default: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
	}
	
	return PLUGIN_HANDLED
}

public admin_ammo_list(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	static players[32],num, i,ii
	get_players(players,num)
	
	console_print(id,"Name | IP | SteamID | Ammo Packs :")
	
	static name[32],ip[16],steamid[24]
	
	for(i=0;i<num;i++)
	{
		ii = players[i]
		
		get_user_name(ii,name,31)
		get_user_ip(ii,ip,15,1)
		get_user_authid(ii,steamid,23)
		
#if !defined USE_ZP_50
		console_print(id,"%s %s %s %i",name,ip,steamid, zp_get_user_ammo_packs(ii))
#else
		console_print(id,"%s %s %s %i",name,ip,steamid, zp_ammopacks_get(ii))
#endif
	}
	
	return PLUGIN_HANDLED
}

public hook_say(id)
{
	new args[129], arg_cmd[6],arg_name[32],arg_ap[10]
	read_args(args,128)
	remove_quotes(args)
	parse(args, arg_cmd,5, arg_name,31, arg_ap,9)
	
	if(get_pcvar_num(cvar_cmd_give) && equali(arg_cmd,"/give"))
	{
		new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
		target, num_ap = str_to_num(arg_ap)
		
		get_user_name(id,name,31)
		get_user_ip(id,ip,15,1)
		get_user_authid(id,steamid,31)
		
		target = cmd_target(id,arg_name,0)
		
		get_user_name(target,target_name,31)
		get_user_ip(target,target_ip,15,1)
		get_user_authid(target,target_steamid,31)
		
		if(equal(arg_name,""))
		{
			ColorChat(id,GREEN,"[ZP]^x01 You must enter a name.")
			return
		}
		
		if(!target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 I can't find player with the name ^x04%s^x01.",arg_name)
			return
		}
		
		if(id == target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 You can't give ammo packs to yourself.")
			return
		}
		
#if !defined USE_ZP_50
		if(zp_get_user_ammo_packs(id) < num_ap)
#else
		if(zp_ammopacks_get(id) < num_ap)
#endif
		{
			ColorChat(id,GREEN,"[ZP]^x01 You don't have enough ammo packs.")
			return
		}
		
		if(num_ap <= 0)
		{
			ColorChat(id,GREEN,"[ZP]^x01 You can give only positive ammo packs.")
			return
		}
		
#if !defined USE_ZP_50
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - num_ap)
		zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
#else
		zp_ammopacks_set(id, zp_ammopacks_get(id) - num_ap)
		zp_ammopacks_set(target, zp_ammopacks_get(target) + num_ap)
#endif
		
		ColorChat(id,GREEN,"[ZP]^x01 You successfully gave ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
		ColorChat(target,GREEN,"[ZP] %s^x01 gave you ^x04%s^x01 ammo packs.",name,arg_ap)
		
		if(get_pcvar_num(cvar_give_ammo_public)) ColorChat(0,GREEN,"[ZP] %s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
		
		log_to_file("addons/amxmodx/logs/zp_ua_uaio_veco.log","%s [IP: %s][STEAMID: %s] gave [%i] ammo packs to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
	}
	
#if !defined USE_ZP_50
	if(get_pcvar_num(cvar_cmd_ap) && equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 You have ^x04%i^x01 ammo packs.",zp_get_user_ammo_packs(id))
#else
	if(get_pcvar_num(cvar_cmd_ap) && equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 You have ^x04%i^x01 ammo packs.",zp_ammopacks_get(id))
#endif
	
	if(get_pcvar_num(cvar_cmd_ammo) && equali(arg_cmd,"/ammo"))
	{
		new target_name[32],target
		target = cmd_target(id,arg_name,0)
		get_user_name(target,target_name,31)
		
		if(equal(arg_name,""))
		{
			ColorChat(id,GREEN,"[ZP]^x01 You must enter a name.")
			return
		}
		
		if(!target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 I can't find player with the name ^x04%s^x01.",arg_name)
			return
		}
		
		if(id == target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 Try the^x04 /ap^x01 command to see your ammo packs.")
			return
		}
		
#if !defined USE_ZP_50
		ColorChat(id,GREEN,"[ZP] %s^x01 has ^x04%i^x01 ammo packs.",target_name,zp_get_user_ammo_packs(target))
#else
		ColorChat(id,GREEN,"[ZP] %s^x01 has ^x04%i^x01 ammo packs.",target_name,zp_ammopacks_get(target))
#endif
	}
}

public event_damage(id)
{
	new killer,hp
	killer = get_user_attacker(id)
	hp = get_user_health(id)
	
	if(is_user_connected(id) && is_user_connected(killer))
	{
		if(hp > 0)
		{
			switch(get_pcvar_num(cvar_show_hp))
			{
#if !defined USE_ZP_50
				case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
				case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
				case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
#else
				case 1: if(zp_core_is_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
				case 2: if(zp_class_nemesis_get(id)) client_print(killer,print_center,"HP: %i",hp)
				case 3: if(zp_core_is_zombie(id) || zp_class_nemesis_get(id)) client_print(killer,print_center,"HP: %i",hp)
#endif
			}
		} else {
			switch(get_pcvar_num(cvar_show_hp))
			{
#if !defined USE_ZP_50
				case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"KILLED!")
				case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
				case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
#else
				case 1: if(zp_core_is_zombie(id)) client_print(killer,print_center,"KILLED!")
				case 2: if(zp_class_nemesis_get(id)) client_print(killer,print_center,"KILLED!")
				case 3: if(zp_core_is_zombie(id) || zp_class_nemesis_get(id)) client_print(killer,print_center,"KILLED!")
#endif
			}
		}
	}
}

public client_connect(id) if(get_pcvar_num(cvar_data_save_type) != -1) load_user_data(id)

public client_disconnect(id)
{
	if(get_pcvar_num(cvar_data_save_type) != -1 && must_save[id])
	{
		save_user_data(id)
		must_save[id] = false
	}
}

public load_user_data(id)
{
	if(!is_user_connected(id)) return
	
	new user_data[64], vaultkey[64],vaultdata[63], data_ammo_packs[32],data_zombie_class[32], vault_timestamp
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1:
		{
			get_user_ip(id,user_data,63,1)
			format(vaultkey,63,"[ip]%s",user_data)
		}
		case 2:
		{
			get_user_authid(id,user_data,63)
			format(vaultkey,63,"[aulthid]%s",user_data)
		}
		default:
		{
			get_user_name(id,user_data,63)
			format(vaultkey,63,"[name]%s",user_data)
		}
	}
	
	if(!nvault_lookup(data_vault,vaultkey,vaultdata,62,vault_timestamp))
	{
		must_save[id] = true
		return
	}
	
	nvault_get(data_vault,vaultkey,vaultdata,62)
	replace_all(vaultdata,62,"#"," ")
	
	parse(vaultdata, data_ammo_packs,31, data_zombie_class,31)
	
#if !defined USE_ZP_50
	zp_set_user_ammo_packs(id, str_to_num(data_ammo_packs))
	zp_set_user_zombie_class(id, str_to_num(data_zombie_class))
#else
	zp_ammopacks_set(id, str_to_num(data_ammo_packs))
	if(str_to_num(data_zombie_class) != -1) zp_class_zombie_set_next(id, str_to_num(data_zombie_class))
#endif
	
	must_save[id] = true
	
#if !defined USE_ZP_50
	if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_get_user_ammo_packs(id) > get_pcvar_num(cvar_ammo_limit)) zp_set_user_ammo_packs(id,get_pcvar_num(cvar_ammo_limit))
#else
	if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_ammopacks_get(id) > get_pcvar_num(cvar_ammo_limit)) zp_ammopacks_set(id,get_pcvar_num(cvar_ammo_limit))
#endif
}

public save_user_data(id)
{
	new user_data[64], vaultkey[64],vaultdata[63]
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1:
		{
			get_user_ip(id,user_data,63,1)
			format(vaultkey,63,"[ip]%s",user_data)
		}
		case 2:
		{
			get_user_authid(id,user_data,63)
			format(vaultkey,63,"[aulthid]%s",user_data)
		}
		default:
		{
			get_user_name(id,user_data,63)
			format(vaultkey,63,"[name]%s",user_data)
		}
	}
	
#if !defined USE_ZP_50
	format(vaultdata,62,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
#else
	format(vaultdata,62,"%i#%i#",zp_ammopacks_get(id),zp_class_zombie_get_current(id))
#endif
	
	nvault_set(data_vault,vaultkey,vaultdata)
}

/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
	new message[256]

	switch(type) {
		case NORMAL: message[0] = 0x01
		case GREEN: message[0] = 0x04
		default: message[0] = 0x03
	}

	vformat(message[1], 251, msg, 4)

	message[192] = '^0'

	new team, ColorChange, index, MSG_Type

	if(id) {
		MSG_Type = MSG_ONE
		index = id
	} else {
		index = FindPlayer()
		MSG_Type = MSG_ALL
	}

	team = get_user_team(index)
	ColorChange = ColorSelection(index, MSG_Type, type)

	ShowColorMessage(index, MSG_Type, message)

	if(ColorChange)
		Team_Info(index, MSG_Type, TeamName[team])
}

ShowColorMessage(id, type, message[]) {
	static bool:saytext_used
	static get_user_msgid_saytext

	if(!saytext_used) {
		get_user_msgid_saytext = get_user_msgid("SayText")
		saytext_used = true
	}

	message_begin(type, get_user_msgid_saytext, _, id)
	write_byte(id)
	write_string(message)
	message_end()
}

Team_Info(id, type, team[]) {
	static bool:teaminfo_used
	static get_user_msgid_teaminfo

	if(!teaminfo_used) {
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
		teaminfo_used = true
	}

	message_begin(type, get_user_msgid_teaminfo, _, id)
	write_byte(id)
	write_string(team)
	message_end()

	return 1
}

ColorSelection(index, type, Color:Type) {
	switch(Type) {
		case RED: return Team_Info(index, type, TeamName[1])
		case BLUE: return Team_Info(index, type, TeamName[2])
		case GREY: return Team_Info(index, type, TeamName[0])
	}

	return 0
}

FindPlayer() {
	new i = -1

	while(i <= get_maxplayers()) {
		if(is_user_connected(++i))
			return i
	}

	return -1
}
/*END - From colorchat.inc by Numb */

Потребителски аватар

aBlack P4M's
Рекламатор
Рекламатор
Мнения: 116
Регистриран: 14 авг 2018, 01:10
Се отблагодари: 25 пъти
Получена благодарност: 20 пъти

[ZP] Ultimate Addon UAIO 3.0

Мнение от aBlack P4M's » 24 окт 2018, 13:12

OciXCrom™ написа:
24 окт 2018, 12:13

Код: Избери всички

/*
---------------------------------------------------------
   #  #  #    #===    ###    ##    #
  #    ##     #===   #      #  #    #
   #   #      #===    ###    ##    #
---------------------------------------------------------
[ZP] Ultimate Addon UAIO by <VeCo> 3.0

Plugin made by <VeCo>
Special thanks to:
 - sick : for the idea of the plugin and testing.
 - xxxDiVXxxx : for the idea of the /ap command and zp_takeap.
 - ardi : for the idea of the ammo pack limit CVAR.
 - remotiv : for the idea of the zp_giveap command.
 - gloBi: for the idea of logging give commands.
 - d-WaLkMaN-b ;] : for the idea for zp_ammolist command.

If you modify the code, please DO NOT change the author!

---------------------------------------------------------

* PLUGIN CONTAINS:

 ==> Save Ammo Packs
 ==> Save Last Chosen Zombie Class
 ==> Show remaining health of the attacked zombie
 ==> Command for seeing your amount of your ammo packs.
 ==> Command for giving ammo packs to another player.
 ==> Admin command for giving ammo packs to other players.
 ==> Command for seeing another player's amount of ammo packs.
 ==> Admin command for taking ammo packs from other players.

---------------------------------------------------------
Contacts:
e-mail: [email protected]
skype: veco_kn
---------------------------------------------------------
Changes log:
 -> v 1.0 = First release!
 -> v 1.1 = Added CVAR for limit of the ammo packs.
 -> v 1.2 = Fixed bug with client_print native.
 -> v 1.3 = Fixed bugs with ammo give.
 -> v 1.4 = Added "KILLED!" instead of negative health value
	    in the victim health displayer.
 -> v 1.5 = Added autosave on new round.
	    Added autoload on player nick change.
 -> v 1.6 = Changed zp_ua_data_save_type CVAR.
	    Fixed bug with the ammo pack saving.
	    Fixed bug in the /give command.
	    Added admin command zp_giveap.
 -> v 1.7 = Fixed bug with the zp_giveap command.
 -> v 1.8 = Fixed bug with saving the ammo packs to ip.
 -> v 1.9 = Changes in code for saving.
 -> v 2.0 = Fixed bug with Damage event.
	    Added chat command /ammo.
 -> v 2.1 = Fixed bugs in the /ammo command.
 -> v 2.2 = Fixed bug with Damage event. (again)
 -> v 2.3 = Changes in code for saving. (again, hope they are final)
 -> v 2.4 = zp_giveap now can take ammo packs if you use negative
	    value.
 -> v 2.5 = Added admin command zp_takeap.
 -> v 2.6 = Added CVARs for turning off/on the chat commands.
	    If your ammo packs aren't saved in the nvault file,
	    you will have the ammo pack amount from the ZP
	    CVAR zp_starting_ammo_packs.
 -> v 2.7 = Added logging for give and take commands.
 -> v 2.8 = Removed unnecessary code.
	    Added support for ZP 5.0 or higher and define
	    for it.
 -> v 2.9 = Fixed error in ZP 5.0 support.
 -> v 3.0 = Added zp_ammolist command.
---------------------------------------------------------
Don't forget to visit http://www.amxmodxbg.org :)
---------------------------------------------------------
*/

#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define ADMIN_GIVE_AMMO ADMIN_IMMUNITY // access level for zp_giveap command
#define ADMIN_TAKE_AMMO ADMIN_RCON // access level for zp_takeap command
#define ADMIN_AMMO_LIST ADMIN_ADMIN // access level for zp_ammolist command

//#define USE_ZP_50 // remove "//" in the beginning of this line if you use Zombie Plague 5.0 or higher

#if !defined USE_ZP_50
#include <zombieplague>
#else
#include <zp50_core>
#include <zp50_class_zombie>
#include <zp50_class_nemesis>
#include <zp50_ammopacks>
#endif

#define LOGFILE "addons/amxmodx/logs/zp_ua_uaio_veco.log"

/*START - From colorchat.inc by Numb */
enum Color {
	NORMAL = 1,
	GREEN,
	TEAM_COLOR,
	GREY,
	RED,
	BLUE,
}

new TeamName[][] = {
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}
/*END - From colorchat.inc by Numb */

new must_save[33],data_vault, pointer_activity,
cvar_data_save_type, cvar_cmd_give,cvar_cmd_ap,cvar_cmd_ammo, cvar_show_hp, cvar_give_ammo_public, cvar_ammo_limit
public plugin_init() {
	register_plugin("[ZP] Ultimate Addon UAIO by <VeCo>", "2.9", "<VeCo>")
	register_cvar("zp_ua_uaio_veco_version","2.9",FCVAR_SERVER | FCVAR_SPONLY)
	
	pointer_activity = get_cvar_pointer("amx_show_activity")
	
	register_concmd("zp_giveap","admin_ammo_give",ADMIN_GIVE_AMMO,"<name / #userid / @H / @Z / @ALL> <ammo packs>")
	register_concmd("zp_takeap","admin_ammo_take",ADMIN_TAKE_AMMO,"<name / #userid / @H / @Z / @ALL> <ammo packs>")
	register_concmd("zp_ammolist","admin_ammo_list",ADMIN_AMMO_LIST,"- displays all players' ammo packs")
	
	register_clcmd("say","hook_say")
	register_clcmd("say_team","hook_say")
	
	register_event("Damage","event_damage","b","2!0","3=0","4!0")
	
	cvar_data_save_type = register_cvar("zp_ua_data_save_type","0")
	
	cvar_cmd_give = register_cvar("zp_ua_give_command","1")
	cvar_cmd_ap = register_cvar("zp_ua_ap_command","1")
	cvar_cmd_ammo = register_cvar("zp_ua_ammo_command","1")
	
	cvar_show_hp = register_cvar("zp_ua_show_hp","3")
	
	cvar_give_ammo_public = register_cvar("zp_ua_give_ammo_public","1")
	
	cvar_ammo_limit = register_cvar("zp_ua_ammo_limit","0")
	
	data_vault = nvault_open("zp_ua_uaio_veco")
}

public admin_ammo_give(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	new arg_name[32],arg_ap[10]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_ap,9)
	
	new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
	target,type, num_ap = str_to_num(arg_ap)
	
	if(!equali(arg_name,"@H") && !equali(arg_name,"@Z") && !equali(arg_name,"@ALL")) target = cmd_target(id,arg_name,0)
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	get_user_name(target,target_name,31)
	get_user_ip(target,target_ip,15,1)
	get_user_authid(target,target_steamid,31)
	
	if(num_ap <= 0)
	{
		console_print(id,"[ZP]^x01 You can give only positive ammo packs.")
		return PLUGIN_HANDLED
	}
	
	type = 0
	
	if(equali(arg_name,"@H"))
	{
		type = 1
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
	} else if(equali(arg_name,"@Z"))
	{
		type = 2
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
	} else if(equali(arg_name,"@ALL"))
	{
		type = 3
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
	} else {
#if !defined USE_ZP_50
		zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
#else
		zp_ammopacks_set(target, zp_ammopacks_get(target) + num_ap)
#endif
	}
	
	if(get_pcvar_num(cvar_give_ammo_public))
	{
		switch(get_pcvar_num(pointer_activity))
		{
			case 1:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all humans.",arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all zombies.",arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all players.",arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
				}
			}
			case 2:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all humans.",name,arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all zombies.",name,arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all players.",name,arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
				}
			}
		}
	}
	
	switch(type)
	{
		case 1: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all humans.",name,ip,steamid,num_ap)
		case 2: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all zombies.",name,ip,steamid,num_ap)
		case 3: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all players.",name,ip,steamid,num_ap)
		default: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
	}
	
	return PLUGIN_HANDLED
}

public admin_ammo_take(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	new arg_name[32],arg_ap[10]
	
	read_argv(1,arg_name,31)
	read_argv(2,arg_ap,9)
	
	new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
	target,type, num_ap = str_to_num(arg_ap)
	
	if(!equali(arg_name,"@H") && !equali(arg_name,"@Z") && !equali(arg_name,"@ALL")) target = cmd_target(id,arg_name,0)
	
	get_user_name(id,name,31)
	get_user_ip(id,ip,15,1)
	get_user_authid(id,steamid,31)
	
	get_user_name(target,target_name,31)
	get_user_ip(target,target_ip,15,1)
	get_user_authid(target,target_steamid,31)
	
	if(num_ap <= 0)
	{
		console_print(id,"[ZP]^x01 You can take only positive ammo packs.")
		return PLUGIN_HANDLED
	}
	
	type = 0
	
	if(equali(arg_name,"@H"))
	{
		type = 1
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
	} else if(equali(arg_name,"@Z"))
	{
		type = 2
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i) && zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
	} else if(equali(arg_name,"@ALL"))
	{
		type = 3
#if !defined USE_ZP_50
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
		for(new i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
	} else {
#if !defined USE_ZP_50
		zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) - num_ap)
#else
		zp_ammopacks_set(target, zp_ammopacks_get(target) - num_ap)
#endif
	}
	
#if !defined USE_ZP_50
	if(zp_get_user_ammo_packs(target) < 0) zp_set_user_ammo_packs(target,0)
#else
	if(zp_ammopacks_get(target) < 0) zp_ammopacks_set(target,0)
#endif
	
	if(get_pcvar_num(cvar_give_ammo_public))
	{
		switch(get_pcvar_num(pointer_activity))
		{
			case 1:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all humans.",arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all zombies.",arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all players.",arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from ^x04%s^x01.",arg_ap,target_name)
				}
			}
			case 2:
			{
				switch(type)
				{
					case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all humans.",name,arg_ap)
					case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all zombies.",name,arg_ap)
					case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all players.",name,arg_ap)
					default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from ^x04%s^x01.",name,arg_ap,target_name)
				}
			}
		}
	}
	
	switch(type)
	{
		case 1: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all humans.",name,ip,steamid,num_ap)
		case 2: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all zombies.",name,ip,steamid,num_ap)
		case 3: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all players.",name,ip,steamid,num_ap)
		default: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
	}
	
	return PLUGIN_HANDLED
}

public admin_ammo_list(id,level,cid)
{
	if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	static players[32],num, i,ii
	get_players(players,num)
	
	console_print(id,"Name | IP | SteamID | Ammo Packs :")
	
	static name[32],ip[16],steamid[24]
	
	for(i=0;i<num;i++)
	{
		ii = players[i]
		
		get_user_name(ii,name,31)
		get_user_ip(ii,ip,15,1)
		get_user_authid(ii,steamid,23)
		
#if !defined USE_ZP_50
		console_print(id,"%s %s %s %i",name,ip,steamid, zp_get_user_ammo_packs(ii))
#else
		console_print(id,"%s %s %s %i",name,ip,steamid, zp_ammopacks_get(ii))
#endif
	}
	
	return PLUGIN_HANDLED
}

public hook_say(id)
{
	new args[129], arg_cmd[6],arg_name[32],arg_ap[10]
	read_args(args,128)
	remove_quotes(args)
	parse(args, arg_cmd,5, arg_name,31, arg_ap,9)
	
	if(get_pcvar_num(cvar_cmd_give) && equali(arg_cmd,"/give"))
	{
		new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
		target, num_ap = str_to_num(arg_ap)
		
		get_user_name(id,name,31)
		get_user_ip(id,ip,15,1)
		get_user_authid(id,steamid,31)
		
		target = cmd_target(id,arg_name,0)
		
		get_user_name(target,target_name,31)
		get_user_ip(target,target_ip,15,1)
		get_user_authid(target,target_steamid,31)
		
		if(equal(arg_name,""))
		{
			ColorChat(id,GREEN,"[ZP]^x01 You must enter a name.")
			return
		}
		
		if(!target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 I can't find player with the name ^x04%s^x01.",arg_name)
			return
		}
		
		if(id == target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 You can't give ammo packs to yourself.")
			return
		}
		
#if !defined USE_ZP_50
		if(zp_get_user_ammo_packs(id) < num_ap)
#else
		if(zp_ammopacks_get(id) < num_ap)
#endif
		{
			ColorChat(id,GREEN,"[ZP]^x01 You don't have enough ammo packs.")
			return
		}
		
		if(num_ap <= 0)
		{
			ColorChat(id,GREEN,"[ZP]^x01 You can give only positive ammo packs.")
			return
		}
		
#if !defined USE_ZP_50
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - num_ap)
		zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
#else
		zp_ammopacks_set(id, zp_ammopacks_get(id) - num_ap)
		zp_ammopacks_set(target, zp_ammopacks_get(target) + num_ap)
#endif
		
		ColorChat(id,GREEN,"[ZP]^x01 You successfully gave ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
		ColorChat(target,GREEN,"[ZP] %s^x01 gave you ^x04%s^x01 ammo packs.",name,arg_ap)
		
		if(get_pcvar_num(cvar_give_ammo_public)) ColorChat(0,GREEN,"[ZP] %s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
		
		log_to_file("addons/amxmodx/logs/zp_ua_uaio_veco.log","%s [IP: %s][STEAMID: %s] gave [%i] ammo packs to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
	}
	
#if !defined USE_ZP_50
	if(get_pcvar_num(cvar_cmd_ap) && equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 You have ^x04%i^x01 ammo packs.",zp_get_user_ammo_packs(id))
#else
	if(get_pcvar_num(cvar_cmd_ap) && equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 You have ^x04%i^x01 ammo packs.",zp_ammopacks_get(id))
#endif
	
	if(get_pcvar_num(cvar_cmd_ammo) && equali(arg_cmd,"/ammo"))
	{
		new target_name[32],target
		target = cmd_target(id,arg_name,0)
		get_user_name(target,target_name,31)
		
		if(equal(arg_name,""))
		{
			ColorChat(id,GREEN,"[ZP]^x01 You must enter a name.")
			return
		}
		
		if(!target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 I can't find player with the name ^x04%s^x01.",arg_name)
			return
		}
		
		if(id == target)
		{
			ColorChat(id,GREEN,"[ZP]^x01 Try the^x04 /ap^x01 command to see your ammo packs.")
			return
		}
		
#if !defined USE_ZP_50
		ColorChat(id,GREEN,"[ZP] %s^x01 has ^x04%i^x01 ammo packs.",target_name,zp_get_user_ammo_packs(target))
#else
		ColorChat(id,GREEN,"[ZP] %s^x01 has ^x04%i^x01 ammo packs.",target_name,zp_ammopacks_get(target))
#endif
	}
}

public event_damage(id)
{
	new killer,hp
	killer = get_user_attacker(id)
	hp = get_user_health(id)
	
	if(is_user_connected(id) && is_user_connected(killer))
	{
		if(hp > 0)
		{
			switch(get_pcvar_num(cvar_show_hp))
			{
#if !defined USE_ZP_50
				case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
				case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
				case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
#else
				case 1: if(zp_core_is_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
				case 2: if(zp_class_nemesis_get(id)) client_print(killer,print_center,"HP: %i",hp)
				case 3: if(zp_core_is_zombie(id) || zp_class_nemesis_get(id)) client_print(killer,print_center,"HP: %i",hp)
#endif
			}
		} else {
			switch(get_pcvar_num(cvar_show_hp))
			{
#if !defined USE_ZP_50
				case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"KILLED!")
				case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
				case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
#else
				case 1: if(zp_core_is_zombie(id)) client_print(killer,print_center,"KILLED!")
				case 2: if(zp_class_nemesis_get(id)) client_print(killer,print_center,"KILLED!")
				case 3: if(zp_core_is_zombie(id) || zp_class_nemesis_get(id)) client_print(killer,print_center,"KILLED!")
#endif
			}
		}
	}
}

public client_connect(id) if(get_pcvar_num(cvar_data_save_type) != -1) load_user_data(id)

public client_disconnect(id)
{
	if(get_pcvar_num(cvar_data_save_type) != -1 && must_save[id])
	{
		save_user_data(id)
		must_save[id] = false
	}
}

public load_user_data(id)
{
	if(!is_user_connected(id)) return
	
	new user_data[64], vaultkey[64],vaultdata[63], data_ammo_packs[32],data_zombie_class[32], vault_timestamp
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1:
		{
			get_user_ip(id,user_data,63,1)
			format(vaultkey,63,"[ip]%s",user_data)
		}
		case 2:
		{
			get_user_authid(id,user_data,63)
			format(vaultkey,63,"[aulthid]%s",user_data)
		}
		default:
		{
			get_user_name(id,user_data,63)
			format(vaultkey,63,"[name]%s",user_data)
		}
	}
	
	if(!nvault_lookup(data_vault,vaultkey,vaultdata,62,vault_timestamp))
	{
		must_save[id] = true
		return
	}
	
	nvault_get(data_vault,vaultkey,vaultdata,62)
	replace_all(vaultdata,62,"#"," ")
	
	parse(vaultdata, data_ammo_packs,31, data_zombie_class,31)
	
#if !defined USE_ZP_50
	zp_set_user_ammo_packs(id, str_to_num(data_ammo_packs))
	zp_set_user_zombie_class(id, str_to_num(data_zombie_class))
#else
	zp_ammopacks_set(id, str_to_num(data_ammo_packs))
	if(str_to_num(data_zombie_class) != -1) zp_class_zombie_set_next(id, str_to_num(data_zombie_class))
#endif
	
	must_save[id] = true
	
#if !defined USE_ZP_50
	if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_get_user_ammo_packs(id) > get_pcvar_num(cvar_ammo_limit)) zp_set_user_ammo_packs(id,get_pcvar_num(cvar_ammo_limit))
#else
	if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_ammopacks_get(id) > get_pcvar_num(cvar_ammo_limit)) zp_ammopacks_set(id,get_pcvar_num(cvar_ammo_limit))
#endif
}

public save_user_data(id)
{
	new user_data[64], vaultkey[64],vaultdata[63]
	
	switch(get_pcvar_num(cvar_data_save_type))
	{
		case 1:
		{
			get_user_ip(id,user_data,63,1)
			format(vaultkey,63,"[ip]%s",user_data)
		}
		case 2:
		{
			get_user_authid(id,user_data,63)
			format(vaultkey,63,"[aulthid]%s",user_data)
		}
		default:
		{
			get_user_name(id,user_data,63)
			format(vaultkey,63,"[name]%s",user_data)
		}
	}
	
#if !defined USE_ZP_50
	format(vaultdata,62,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
#else
	format(vaultdata,62,"%i#%i#",zp_ammopacks_get(id),zp_class_zombie_get_current(id))
#endif
	
	nvault_set(data_vault,vaultkey,vaultdata)
}

/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
	new message[256]

	switch(type) {
		case NORMAL: message[0] = 0x01
		case GREEN: message[0] = 0x04
		default: message[0] = 0x03
	}

	vformat(message[1], 251, msg, 4)

	message[192] = '^0'

	new team, ColorChange, index, MSG_Type

	if(id) {
		MSG_Type = MSG_ONE
		index = id
	} else {
		index = FindPlayer()
		MSG_Type = MSG_ALL
	}

	team = get_user_team(index)
	ColorChange = ColorSelection(index, MSG_Type, type)

	ShowColorMessage(index, MSG_Type, message)

	if(ColorChange)
		Team_Info(index, MSG_Type, TeamName[team])
}

ShowColorMessage(id, type, message[]) {
	static bool:saytext_used
	static get_user_msgid_saytext

	if(!saytext_used) {
		get_user_msgid_saytext = get_user_msgid("SayText")
		saytext_used = true
	}

	message_begin(type, get_user_msgid_saytext, _, id)
	write_byte(id)
	write_string(message)
	message_end()
}

Team_Info(id, type, team[]) {
	static bool:teaminfo_used
	static get_user_msgid_teaminfo

	if(!teaminfo_used) {
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
		teaminfo_used = true
	}

	message_begin(type, get_user_msgid_teaminfo, _, id)
	write_byte(id)
	write_string(team)
	message_end()

	return 1
}

ColorSelection(index, type, Color:Type) {
	switch(Type) {
		case RED: return Team_Info(index, type, TeamName[1])
		case BLUE: return Team_Info(index, type, TeamName[2])
		case GREY: return Team_Info(index, type, TeamName[0])
	}

	return 0
}

FindPlayer() {
	new i = -1

	while(i <= get_maxplayers()) {
		if(is_user_connected(++i))
			return i
	}

	return -1
}
/*END - From colorchat.inc by Numb */
Здравей @OciXCrom™ Благодаря ти за отговора и за редакцията на плъгина, обаче сега даже след смяна на картата пак не се запазват аммо паковете, преди след рестарт изчезваха сега след смяна на мапа се нулират аммо паковете за съжаление, друг вариант ? (Ако може)
Изображение
Black-Gaming FB Page
My Steam Profile
ИзображениеИзображение

Отговори

Върни се в “Съб-плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 1 гост