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;
}
i scripted something and it works fine for loading, |
Are you sure? it has many mistakes...
public OnGameModeExit() <--------- ? |
mysql_tquery(ConnectionHandle, "SELECT * FROM interiors", "LoadInteriorData");
InteriorCP[intid] = CreateDynamicCP(
INTInfo[intid][INTCPOutX], // x
INTInfo[intid][INTCPOutY], // y
INTInfo[intid][INTCPOutZ], // z
1.5, // size
0, // worldid
0, // interiorid
-1, // playerid
20 // streamdistance
);
I think better usage should be
pawn Код:
|
public OnGameModeInit()
{
mysql_tquery(ConnectionHandle, "SELECT * FROM interiors", "LoadInteriorData");
return 1;
}
forward LoadInteriorData();
public LoadInteriorData()
{
new rows, fields; cache_get_data(rows, fields, ConnectionHandle);
if(!rows) return 1;
for(new i = 0; i < MAX_INTERIORS; i++)
{
cache_get_field_content(i, "intname", INTInfo[i][INTName], ConnectionHandle, 64);
cache_get_field_content(i, "inttype", INTInfo[i][INTType], ConnectionHandle, 64);
cache_get_field_content(i, "intlocation", INTInfo[i][INTLocation], ConnectionHandle, 64);
INTInfo[i][INTInterior] = cache_get_field_content_int(i, "intinterior");
INTInfo[i][INTIcon] = cache_get_field_content_int(i, "inticon");
INTInfo[i][INTCPOutX] = cache_get_field_content_float(i, "intcpoutx");
INTInfo[i][INTCPOutY] = cache_get_field_content_float(i, "intcpouty");
INTInfo[i][INTCPOutZ] = cache_get_field_content_float(i, "intcpoutz");
INTInfo[i][INTSPInX] = cache_get_field_content_float(i, "intspinx");
INTInfo[i][INTSPInY] = cache_get_field_content_float(i, "intspiny");
INTInfo[i][INTSPInZ] = cache_get_field_content_float(i, "intspinz");
INTInfo[i][INTSPInA] = cache_get_field_content_float(i, "intspina");
INTInfo[i][INTSPOutX] = cache_get_field_content_float(i, "intspoutx");
INTInfo[i][INTSPOutY] = cache_get_field_content_float(i, "intspouty");
INTInfo[i][INTSPOutZ] = cache_get_field_content_float(i, "intspoutz");
INTInfo[i][INTSPOutA] = cache_get_field_content_float(i, "intspouta");
InteriorCP[i] = CreateDynamicCP(INTInfo[i][INTCPOutX], INTInfo[i][INTCPOutY], INTInfo[i][INTCPOutZ], 1.5, 0, 0, -1, 20);
CreateDynamic3DTextLabel(INTInfo[i][INTName], COLOR_YELLOW, INTInfo[i][INTCPOutX], INTInfo[i][INTCPOutY], INTInfo[i][INTCPOutZ], 30);
if(INTInfo[i][INTIcon] != 0) CreateDynamicMapIcon(INTInfo[i][INTCPOutX], INTInfo[i][INTCPOutY], INTInfo[i][INTCPOutZ], INTInfo[i][INTIcon],0,0,0,-1,300.0);
}
return 1;
}
It looks fine, to be honest. You could make it look neater by aligning all the "=" symbols and by splitting the Create functions over multiple lines. White-space has no influence on the code whatsoever.
|