Raised This Month: $ Target: $400
 0% 

Why does this plugin makes the server crash?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-02-2022 , 18:02   Re: Why does this plugin makes the server crash?
Reply With Quote #1

Don't use that plugin, it's complete garbage and I know, I'm the author. Use this one, will work on any game mode.

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

new const EXTRA_ITEMS[][] = {
	"Balrog Ethereal"
}

new cvar_max_bots

new g_extraItems[sizeof EXTRA_ITEMS], g_extraItemCount

public plugin_init()
{
	register_plugin("Bots Buy Extra Items", "1.1", "Ainsley Harriott")
	cvar_max_bots = register_cvar("zp_force_buy_maxbots", "3")
}

public plugin_cfg()
{
	for (new i, itemid; i < sizeof EXTRA_ITEMS; i++)
	{
		itemid = zp_get_extra_item_id(EXTRA_ITEMS[i])

		if (itemid != -1)
		{
			g_extraItems[g_extraItemCount++] = itemid
		}
	}
}

public zp_round_started(gamemode, id)
{
	if (g_extraItemCount > 0)
	{
		GiveBotExtraItems()
	}
}

GiveBotExtraItems()
{
	new bots[32], botCount
	new humanBots[32], humanBotCount

	get_players(bots, botCount, "adh")

	for (new i, bot; i < botCount; i++)
	{
		bot = bots[i]

		if (!zp_get_user_zombie(bot))
		{
			humanBots[humanBotCount++] = bot
		}
	}

	SortIntegers(humanBots, humanBotCount, Sort_Random)

	for (new i, bot, itemid, max = min(humanBotCount, get_pcvar_num(cvar_max_bots)); i < max; i++)
	{
		bot = humanBots[i]
		itemid = g_extraItems[random(g_extraItemCount)]
		zp_force_buy_extra_item(bot, itemid, 1)
	}
}
__________________









Last edited by CrazY.; 01-02-2022 at 18:05.
CrazY. is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 01-26-2022 , 11:56   Re: Why does this plugin makes the server crash?
Reply With Quote #2

Quote:
Originally Posted by CrazY. View Post
Don't use that plugin, it's complete garbage and I know, I'm the author. Use this one, will work on any game mode.

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

new const EXTRA_ITEMS[][] = {
	"Balrog Ethereal"
}

new cvar_max_bots

new g_extraItems[sizeof EXTRA_ITEMS], g_extraItemCount

public plugin_init()
{
	register_plugin("Bots Buy Extra Items", "1.1", "Ainsley Harriott")
	cvar_max_bots = register_cvar("zp_force_buy_maxbots", "3")
}

public plugin_cfg()
{
	for (new i, itemid; i < sizeof EXTRA_ITEMS; i++)
	{
		itemid = zp_get_extra_item_id(EXTRA_ITEMS[i])

		if (itemid != -1)
		{
			g_extraItems[g_extraItemCount++] = itemid
		}
	}
}

public zp_round_started(gamemode, id)
{
	if (g_extraItemCount > 0)
	{
		GiveBotExtraItems()
	}
}

GiveBotExtraItems()
{
	new bots[32], botCount
	new humanBots[32], humanBotCount

	get_players(bots, botCount, "adh")

	for (new i, bot; i < botCount; i++)
	{
		bot = bots[i]

		if (!zp_get_user_zombie(bot))
		{
			humanBots[humanBotCount++] = bot
		}
	}

	SortIntegers(humanBots, humanBotCount, Sort_Random)

	for (new i, bot, itemid, max = min(humanBotCount, get_pcvar_num(cvar_max_bots)); i < max; i++)
	{
		bot = humanBots[i]
		itemid = g_extraItems[random(g_extraItemCount)]
		zp_force_buy_extra_item(bot, itemid, 1)
	}
}
Hello. When i tried to compile the code you gave me, i got the following 2 errors:

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


//// buy_extra_items.sma
// C:\Mod\cstrike\addons\amxmodx\scripting\bot_s upport_extra_items.sma(56) : error 017: undefined symbol "Sort_Random"
// C:\Mod\cstrike\addons\amxmodx\scripting\bot_s upport_extra_items.sma(56 -- 5 : error 088: number of arguments does not match definition


Here is the whole code that contains the lines that are the source of errors (the lines are marked in red):

Code:
GiveBotExtraItems()
{
	new bots[32], botCount
	new humanBots[32], humanBotCount

	get_players(bots, botCount, "adh")

	for (new i, bot; i < botCount; i++)
	{
		bot = bots[i]

		if (!zp_get_user_zombie(bot))
		{
			humanBots[humanBotCount++] = bot
		}
	}

	SortIntegers(humanBots, humanBotCount, Sort_Random)

	for (new i, bot, itemid, max = min(humanBotCount, get_pcvar_num(cvar_max_bots)); i < max; i++)
	{
		bot = humanBots[i]
		itemid = g_extraItems[random(g_extraItemCount)]
		zp_force_buy_extra_item(bot, itemid, 1)
	}
}
GlobalPlague 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 11:30.


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