View Single Post
wwahgnerbp
Member
Join Date: Mar 2013
Location: Earth, Solar System
Old 04-28-2017 , 17:40   Re: New syntax troubles
Reply With Quote #3

I forgot to mention that rebuyweapons is declared like this:
Code:
char rebuyweapons[WeaponsSlot][WEAPONS_MAX_LENGTH];
Here's the full code

Code:
/**
 * Force a client to rebuy their weapons.
 * 
 * @param client	The client index.
 */
void ZMarketRebuy(int client, bool autorebuy = false)
{
	// If client is dead, then stop.
	if (!IsPlayerAlive(client))
	{
		TranslationPrintToChat(client, "Must be alive");
		return;
	}
	
	// If client is a zombie, then stop.
	if (InfectIsClientInfected(client))
	{
		TranslationPrintToChat(client, "Must be human");
		return;
	}
	
	bool zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
	if (!autorebuy && zmarketbuyzone && !WeaponsIsClientInBuyZone(client))
	{
		TranslationPrintToChat(client, "Weapons zmarket buyzone");
		return;
	}
	
	// Transfer cookie values into an array.
	char rebuyweapons[WeaponsSlot][WEAPONS_MAX_LENGTH];
	ZMarketCookiesToArray(client, rebuyweapons, WEAPONS_SLOTS_MAX + 1, sizeof(rebuyweapons[]));
	
	
	// x = Weapon slot.
	for (int x = 0; x < WEAPONS_SLOTS_MAX + 1; x++)
	{
		// If slot is empty, then stop.
		if (!rebuyweapons[x][0])
		{
			continue;
		}
		
		ZMarketEquip(client, rebuyweapons[x], true);
	}
}
Code:
stock void ZMarketCookiesToArray(int client, char[][] rebuyweapons, int maxweapons, int maxlen)
{
	char rebuycookiename[32];
	Handle rebuycookie;
	
	// x = Weapon slot.
	for (int x = 0; x < maxweapons; x++)
	{
		// Format cookie name.
		Format(rebuycookiename, sizeof(rebuycookiename), "%s_%d", ZMARKET_COOKIE_REBUY, x);
		
		// Find cookie handle, and retrieve its value.
		rebuycookie = FindClientCookie(rebuycookiename);
		GetClientCookie(client, rebuycookie, rebuyweapons[x], maxlen);
		CloseHandle(rebuycookie);
	}
}
When I try as you suggested the compiler gives me two errors but it manages to generate the binary

// zr/weapons/zmarket.inc(116 : warning 213: tag mismatch
// zr/weapons/zmarket.inc(116 : warning 229: index tag mismatch (symbol "rebuyweapons")


What does these errors means? How can I solve that?

Last edited by wwahgnerbp; 04-28-2017 at 18:20.
wwahgnerbp is offline