SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/01/2019, 02:51 PM   #1
Fratzi
Little Clucker
 
Join Date: Aug 2017
Location: 127.0.0.1
Posts: 10
Reputation: 0
Exclamation Gang zone problem.

Hello. I do not get the color from an gang zone when I use /turfs
With this function they take them from the database.
Code:
function LoadZones() {
	new rows, fields;
	cache_get_data(rows, fields, handle);

	if(rows) {
		new result[128], id;
		for(new i = 0; i < rows; i++) {
			id++;
			cache_get_field_content(i, "MinX", result), ZoneInfo[id][zMinX] = floatstr(result);
			cache_get_field_content(i, "MinY", result), ZoneInfo[id][zMinY] = floatstr(result);
			cache_get_field_content(i, "MaxX", result), ZoneInfo[id][zMaxX] = floatstr(result);
			cache_get_field_content(i, "MaxY", result), ZoneInfo[id][zMaxY] = floatstr(result);
			cache_get_field_content(i, "Team", result), ZoneInfo[id][zTeam] = strval(result);
			cache_get_field_content(i, "Hours", result), ZoneInfo[id][zHours] = strval(result);	
			turfsss++;

			Zone[id] = GangZoneCreateEx(ZoneInfo[id][zMinX], ZoneInfo[id][zMinY], ZoneInfo[id][zMaxX], ZoneInfo[id][zMaxY], id, 1.0);
		}
	}
	printf("Turfs: %d", turfsss);
	return true;
}
This is the command:
Code:
YCMD:turfs(playerid, params[], help) {
	if(gLogged[playerid] == 0) return SCM(playerid, COLOR_ERROR, "You are not logged in.");
	if(TurfsON[playerid] == 0) {
		TurfsON[playerid] = 1;
		SCM(playerid,	COLOR_SYN2,"Turfs ON");
		for(new i = 1; i < sizeof(ZoneInfo); i++) {
			if(ZoneInfo[i][zTeam] == 8) GangZoneShowForPlayerEx(playerid, Zone[i], 0x40863CAA);
			if(ZoneInfo[i][zTeam] == 9) GangZoneShowForPlayerEx(playerid, Zone[i], 0x800080AA);
			if(ZoneInfo[i][zTeam] == 10) GangZoneShowForPlayerEx(playerid, Zone[i], 0x1A1A1AAA);
			if(ZoneInfo[i][zTeam] == 11) GangZoneShowForPlayerEx(playerid, Zone[i], 0x46E3BE99);
		}
	}
	else {
		TurfsON[playerid] = 0;
		SCM(playerid,	COLOR_SYN2,"Turfs OFF");
		for(new i = 0; i < sizeof(ZoneInfo); i++) GangZoneHideForPlayerEx(playerid, Zone[i]);
	}
	return 1;
}
The following are defined here:
Code:
forward zUpdate(zone, type);

#define zTeamx				1
#define zHoursx				2

enum zInfo
{
	Float:zMinX,Float:zMinY,Float:zMaxX,Float:zMaxY,zTeam,zHours,zID
};


#define NUMDIS 40.0
#define MAX_GANGZONES 60

new ZoneInfo[61][zInfo];
new Zone[61];
new TakeON[61];
new PickupHealth1[2048];
new PickupWeapon1[2048];
new PickupHealth2[2048];
new PickupWeapon2[2048];

public zUpdate(zone, type)
{
	gQuery[0] = (EOS);
	switch(type)
	{
		case zTeamx:
		{
			mysql_format(handle, gQuery, sizeof(gQuery), "UPDATE `zones` SET `Team`=%d WHERE `ID`=%d", ZoneInfo[zone][zTeam], zone);
			mysql_query(handle, gQuery);
		}
		case zHoursx:
		{
			mysql_format(handle, gQuery, sizeof(gQuery), "UPDATE `zones` SET `Hours`=%d WHERE `ID`=%d", ZoneInfo[zone][zHours], zone);
			mysql_query(handle, gQuery);
		}
	}
	return 1;
}
Zone 1 is the one on which the cursor is located: https://imgur.com/a/CjUp0x8
Fratzi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with gang zone ProfessorX Scripting Help 5 30/10/2018 05:58 AM
gang zone problem BlackEvils Scripting Help 3 04/10/2014 12:13 PM
Gang zone problem or w/e YanLanger Scripting Help 4 25/08/2014 08:27 PM
Problem with Gang Zone [HELP!] Holnista Help Archive 6 28/03/2010 07:27 PM
Gang Zone problem Anwix Help Archive 10 13/02/2010 05:28 PM


All times are GMT. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.