Help!, MYSQL Load - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help!, MYSQL Load (
/showthread.php?tid=566585)
Help!, MYSQL Load -
CoR3 - 07.03.2015
Hi, i made this code, but always print me: [MYSQL]: ERROR GANGS...
What's my mistake?
PHP код:
forward LoadZones();
public LoadZones()
{
new arrCoords[12][64];
new string[256];
new row [512];
new idx;
while (idx < sizeof(GangInfo))
{
format(string, sizeof(string), "SELECT * FROM `zones` WHERE zID=%d",idx);
mysql_query_ex(string);
mysql_store_result();
if(mysql_num_rows() > 0)
{
mysql_fetch_row(row);
split(row, arrCoords, '|');
mysql_free_result();
strmid(GangInfo[idx][zName], arrCoords[1], 0, strlen(arrCoords[1]), 255);
GangInfo[idx][zMinX] = floatstr(arrCoords[2]);
GangInfo[idx][zMinY] = floatstr(arrCoords[3]);
GangInfo[idx][zMaxX] = floatstr(arrCoords[4]);
GangInfo[idx][zMaxY] = floatstr(arrCoords[5]);
GangInfo[idx][zCPX] = floatstr(arrCoords[6]);
GangInfo[idx][zCPY] = floatstr(arrCoords[7]);
GangInfo[idx][zCPZ] = floatstrl(arrCoords[8]);
GangInfo[idx][zTeam] = strval(arrCoords[9]);
GangInfo[idx][zMoney] = strval(arrCoords[10]);
GangInfo[idx][zEXP] = strval(arrCoords[11]);
}
else
{
printf("[MYSQL]: ERROR GANGS (from %s).", SQL_DB);
}
mysql_free_result();
idx++;
CP[idx] = CreateDynamicCP(GangInfo[idx][zCPX], GangInfo[idx][zCPY], GangInfo[idx][zCPZ], 2, -1, -1, -1, 100.0);
Zone[idx] = GangZoneCreate(GangInfo[idx][zMinX], GangInfo[idx][zMinY], GangInfo[idx][zMaxX], GangInfo[idx][zMaxY]);
}
printf("[MYSQL]: GangZones loaded from MYSQL (from %s).", SQL_DB);
return 1;
}
Re: Help!, MYSQL Load -
X337 - 07.03.2015
What about this?
Код:
SELECT * FROM `zones` WHERE `zID` = '%d'
and
Re: Help!, MYSQL Load -
CoR3 - 07.03.2015
Nop, don't work
i have this code and work full.
PHP код:
forward LoadInts();
public LoadInts()
{
new arrCoords[15][64];
new string[256];
new row [512];
new idx;
while (idx < sizeof(IntInfo))
{
format(string, sizeof(string), "SELECT * FROM `interiors` WHERE ID=%d",idx);
mysql_query_ex(string);
mysql_store_result();
if(mysql_num_rows() > 0)
{
mysql_fetch_row(row);
split(row, arrCoords, '|');
mysql_free_result();
IntInfo[idx][iEntrancex] = floatstr(arrCoords[1]);
IntInfo[idx][iEntrancey] = floatstr(arrCoords[2]);
IntInfo[idx][iEntrancez] = floatstr(arrCoords[3]);
IntInfo[idx][iExitx] = floatstr(arrCoords[4]);
IntInfo[idx][iExity] = floatstr(arrCoords[5]);
IntInfo[idx][iExitz] = floatstr(arrCoords[6]);
strmid(IntInfo[idx][iDiscription], arrCoords[7], 0, strlen(arrCoords[7]), 255);
IntInfo[idx][iWorld] = strval(arrCoords[8]);
IntInfo[idx][iInt] = strval(arrCoords[9]);
IntInfo[idx][iType] = strval(arrCoords[10]);
IntInfo[idx][iIcon] = strval(arrCoords[11]);
IntInfo[idx][iIconT] = strval(arrCoords[12]);
IntInfo[idx][iPick] = strval(arrCoords[13]);
IntInfo[idx][iPickT] = strval(arrCoords[14]);
}
mysql_free_result();
idx++;
}
return 1;
}