21.01.2019, 14:51
Hello. I do not get the color from an gang zone when I use /turfs
With this function they take them from the database.
This is the command:
The following are defined here:
Zone 1 is the one on which the cursor is located: https://imgur.com/a/CjUp0x8
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; }
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; }
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; }