Raised This Month: $32 Target: $400
 8% 

zp_extraitems rewrite every map change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nbanow
Senior Member
Join Date: Dec 2010
Location: Lithuania
Old 03-19-2021 , 05:50   zp_extraitems rewrite every map change
Reply With Quote #1

Hello. I've added a plugin which adds armor and hp if bought from an extra items menu.
Everything works fine but every map change it duplicates in zp_extraitems.ini

All extraitems.ini file is flooded with armor/hp extraitem. Could I stop this plugin make duplicating settings to zp_extraitems.ini? I thought it's because of using "\r" but removing this from code and leaving as "Armor+ [100]" in the code didn't helped, it's still duplicating every map change. Is it possible to keep it but prevent it from overwriting?

Plugin code:

HTML Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

#define NAME "mkod_steam_pack"
#define VERSION "1.0"
#define AUTHOR "MKOD"

new g_itemid_harmor, g_itemid_hhealth, g_itemid_zhealth

const g_harmor_num = 100
const g_harmor_max = 300

const g_hhealth_num = 100
const g_hhealth_max = 300

const g_zhealth_num = 1000
const g_zhealth_max = 15000

public plugin_init()
{
	register_plugin(NAME, VERSION, AUTHOR)
	
	g_itemid_harmor = zp_register_extra_item("Armor+ \r[100]", 15, ZP_TEAM_HUMAN)
	g_itemid_hhealth = zp_register_extra_item("HP+ \r[100]", 25, ZP_TEAM_HUMAN)
	g_itemid_zhealth = zp_register_extra_item("HP+ \r[1000]", 15, ZP_TEAM_ZOMBIE)
}

public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_itemid_harmor)
	{
		set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue) + g_harmor_num, g_harmor_max)))
	}
	else if(itemid == g_itemid_hhealth)
	{
		set_pev(player, pev_health, float(min(pev(player, pev_health) + g_hhealth_num, g_hhealth_max)))
	}
	else if(itemid == g_itemid_zhealth)
	{
		set_pev(player, pev_health, float(min(pev(player, pev_health) + g_zhealth_num, g_zhealth_max)))
	}
	return PLUGIN_HANDLED
}

Last edited by Nbanow; 03-19-2021 at 06:07.
Nbanow is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode