02.01.2016, 23:23
(
Последний раз редактировалось Juvanii; 16.01.2016 в 12:24.
)
I am kinda new using mysql databases and i have a question about loading interiors from a created table, i scripted something and it works fine for loading, but i don't feel that this is the right way to load. Here is it.. please tell me if it's wrong.
PHP код:
public OnGameModeExit()
{
for(new i = 0; i < MAX_INTERIORS; i++)
{
mysql_tquery(ConnectionHandle, "SELECT * FROM interiors", "LoadInteriorData", "i", i);
}
return 1;
}
forward LoadInteriorData(intid);
public LoadInteriorData(intid)
{
new rows, fields; cache_get_data(rows, fields, ConnectionHandle);
if(!rows) return 1;
cache_get_field_content(intid, "intname", INTInfo[intid][INTName], ConnectionHandle, 64);
cache_get_field_content(intid, "inttype", INTInfo[intid][INTType], ConnectionHandle, 64);
cache_get_field_content(intid, "intlocation", INTInfo[intid][INTLocation], ConnectionHandle, 64);
INTInfo[intid][INTInterior] = cache_get_field_content_int(intid, "intinterior");
INTInfo[intid][INTIcon] = cache_get_field_content_int(intid, "inticon");
INTInfo[intid][INTCPOutX] = cache_get_field_content_float(intid, "intcpoutx");
INTInfo[intid][INTCPOutY] = cache_get_field_content_float(intid, "intcpouty");
INTInfo[intid][INTCPOutZ] = cache_get_field_content_float(intid, "intcpoutz");
INTInfo[intid][INTSPInX] = cache_get_field_content_float(intid, "intspinx");
INTInfo[intid][INTSPInY] = cache_get_field_content_float(intid, "intspiny");
INTInfo[intid][INTSPInZ] = cache_get_field_content_float(intid, "intspinz");
INTInfo[intid][INTSPInA] = cache_get_field_content_float(intid, "intspina");
INTInfo[intid][INTSPOutX] = cache_get_field_content_float(intid, "intspoutx");
INTInfo[intid][INTSPOutY] = cache_get_field_content_float(intid, "intspouty");
INTInfo[intid][INTSPOutZ] = cache_get_field_content_float(intid, "intspoutz");
INTInfo[intid][INTSPOutA] = cache_get_field_content_float(intid, "intspouta");
InteriorCP[intid] = CreateDynamicCP(INTInfo[intid][INTCPOutX], INTInfo[intid][INTCPOutY], INTInfo[intid][INTCPOutZ], 1.5, 0, 0, -1, 20);
CreateDynamic3DTextLabel(INTInfo[intid][INTName], COLOR_YELLOW, INTInfo[intid][INTCPOutX], INTInfo[intid][INTCPOutY], INTInfo[intid][INTCPOutZ], 30);
if(INTInfo[intid][INTIcon] != 0) CreateDynamicMapIcon(INTInfo[intid][INTCPOutX], INTInfo[intid][INTCPOutY], INTInfo[intid][INTCPOutZ], INTInfo[intid][INTIcon],0,0,0,-1,300.0);
printf("Loading Interior (%s)", INTInfo[intid][INTName]);
return 1;
}