Bots Buy Extra Items

Unpaid Requests, Public Plugins
Post Reply
User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

Re: Bots Buy Extra Items

#1

Post by z0h1r-LK » 1 year ago

What do you mean?

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#2

Post by z0h1r-LK » 1 year ago

Tell me, Why you want make Bots bought Extra Items?

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#3

Post by z0h1r-LK » 1 year ago

I will try to create plugin

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#4

Post by z0h1r-LK » 1 year ago

Not much, I so busy, But I will create that for you


User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#6

Post by sPe3doN » 1 year ago

try this, i don't know if this work or no cuz i didin't test it, i just convert this plugin from zp mod

Code: Select all

#include <zombie_escape>


/*================================================================================
 [Plugin Customization]
=================================================================================*/

// Items name (note: add exact item name)

new const EXTRA_ITEMS[][] = {
	"Item 1",
	"Item 2",
	"Item 3"
}

/*================================================================================
 Customization ends here! Yes, that's it. Editing anything beyond
 here is not officially supported. Proceed at your own risk...
=================================================================================*/

enum
{
	TASK_STARTGIVE = 298,
	TASK_GIVEITEM
}

#define ID_BOT (taskid - TASK_GIVEITEM)

new cvar_max_bots, g_botname[33][32], g_has_item[33], g_maxplayers;

public plugin_init()
{
	/* Plugin register */
	register_plugin("[ZE] Bot Addon: Force buy items", "v0.2", "Crazy");

	/* Cvars */
	cvar_max_bots = register_cvar("ze_force_buy_maxbots", "4");

	/* Max players */
	g_maxplayers = get_maxplayers()
}

public client_putinserver(id)
{
	if (is_user_bot(id))
		get_user_name(id, g_botname[id], charsmax(g_botname[]));
}

public ze_game_started()
{
	for (new id = 1; id <= g_maxplayers; id++)
		g_has_item[id] = false;

	set_task(2.0, "give_item_task", TASK_STARTGIVE);
}

public give_item_task(taskid)
{
	static id, iBots, iMaxBots;
	iBots = 0;
	iMaxBots = get_pcvar_num(cvar_max_bots);

	while (iBots <= iMaxBots)
	{
		id = get_random_bot(random_num(1, get_alive_bots()));

		if (!is_user_alive(id))
			continue;

		if (ze_is_user_zombie(id))
			continue;

		if (g_has_item[id])
			continue;

		set_task(1.0, "give_item", id+TASK_GIVEITEM);

		iBots++;
	}

	remove_task(TASK_STARTGIVE);
	remove_task(TASK_GIVEITEM);
}

public give_item(taskid)
{
	static id, random, itemid;
	id = ID_BOT;
	random = random_num(0, sizeof EXTRA_ITEMS - 1);
	itemid = ze_get_item_id(EXTRA_ITEMS[random]);

	if (itemid == -1)
	{
		set_task(0.5, "give_item", id+TASK_GIVEITEM);
		return;
	}

	ze_force_buy_item(id, itemid, 1);
	g_has_item[id] = true;
	remove_task(id+TASK_GIVEITEM);
}

get_alive_bots()
{
	static iBot, id;
	iBot = 0;

	for (id = 1; id <= g_maxplayers; id++)
	{
		if (is_user_alive(id) && is_user_bot(id))
			iBot++;
	}

	return iBot;
}

get_random_bot(n)
{
	static iBot, id;
	iBot = 0;

	for (id = 1; id <= g_maxplayers; id++)
	{
		if (is_user_alive(id) && is_user_bot(id))
			iBot++;

		if (iBot == n)
			return id;
	}

	return -1;
}
Image

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#7

Post by sPe3doN » 1 year ago

InsertSK wrote: 1 year ago does not work also in compile
you sure ? cuz it's complie without any problem for me

Code: Select all

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// ze_bot_force_buy_items.sma
//
// Header size:            944 bytes
// Code size:             3024 bytes
// Data size:             5604 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   25956 bytes
// Done.
//
// Compilation Time: 1.94 sec
// ----------------------------------------

Press enter to exit ...
Image

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#8

Post by z0h1r-LK » 1 year ago


It's working !!
Use it to compile any plugin from Escapers-Zone: viewtopic.php?f=6&t=221
And update your AMX Mod X, ReAPI, ReGameDLL, ReHLDS to last version : viewtopic.php?f=7&t=9
Last edited by z0h1r-LK 1 year ago, edited 1 time in total.
Reason: correction

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 10 guests