17.02.2018, 12:01
PHP код:
new teleportfixer[MAX_TELEPORTS][TeleportInfo];
public LoadTeleports()
{
for(new i; i < MAX_TELEPORTS; i++)
{
DestroyDynamicPickup(TeleportPickup1[i]);
DestroyDynamicPickup(TeleportPickup2[i]);
DestroyDynamic3DTextLabel(TeleportText1[i]);
DestroyDynamic3DTextLabel(TeleportText2[i]);
TeleportDB[i][X1] = 0;
TeleportDB[i][Y1] = 0;
TeleportDB[i][Y1] = 0;
TeleportDB[i][A1] = 0;
TeleportDB[i][Interior1] = 0;
TeleportDB[i][VirtualWorld1] = 0;
TeleportDB[i][X2] = 0;
TeleportDB[i][Y2] = 0;
TeleportDB[i][Y2] = 0;
TeleportDB[i][A2] = 0;
TeleportDB[i][Interior2] = 0;
TeleportDB[i][VirtualWorld2] = 0;
TeleportDB[i][Price] = 0;
TeleportDB[i][Owner] = 0;
TeleportDB[i][Lock] = 0;
for(new j; j < 5; j++)
{
TeleportDB[i][Key][j] = 0;
}
}
new rows, fields, getstr[32];
cache_get_data(rows, fields);
if(rows)
{
for(new i = 0; i < rows; i++)
{
teleportfixer[i][ID] = cache_get_field_content_int(i, "id");
teleportfixer[i][Owner] = cache_get_field_content_int(i, "owner");
new str2[32]; format(str2, sizeof(str2), "owner: %d", teleportfixer[i][Owner]); printf(str2);
cache_get_field_content(i, "name", getstr);
format(teleportfixer[i][Name], 32, getstr);
teleportfixer[i][X1] = cache_get_field_content_float(i, "x1");
teleportfixer[i][Y1] = cache_get_field_content_float(i, "y1");
teleportfixer[i][Z1] = cache_get_field_content_float(i, "z1");
teleportfixer[i][A1] = cache_get_field_content_float(i, "a1");
teleportfixer[i][Interior1] = cache_get_field_content_int(i, "interior1");
teleportfixer[i][VirtualWorld1] = cache_get_field_content_int(i, "virtualworld1");
teleportfixer[i][X2] = cache_get_field_content_float(i, "x2");
teleportfixer[i][Y2] = cache_get_field_content_float(i, "y2");
teleportfixer[i][Z2] = cache_get_field_content_float(i, "z2");
teleportfixer[i][A2] = cache_get_field_content_float(i, "a2");
teleportfixer[i][Interior2] = cache_get_field_content_int(i, "interior2");
teleportfixer[i][VirtualWorld2] = cache_get_field_content_int(i, "virtualworld2");
teleportfixer[i][Price] = cache_get_field_content_int(i, "price");
teleportfixer[i][Lock] = cache_get_field_content_int(i, "lock");
new str[32];
for(new j; j < 5; j++)
{
format(str, sizeof(str), "key_%d", j);
teleportfixer[i][Key][j] = cache_get_field_content_int(i, str);
}
}
for(new i = 0; i < rows; i++)
{
TeleportDB[teleportfixer[i][ID]][ID] = teleportfixer[i][ID];
TeleportDB[teleportfixer[i][ID]][Owner] = teleportfixer[i][Owner];
new str2[32]; format(str2, sizeof(str2), "owner x: %d", TeleportDB[teleportfixer[i][ID]][Owner]); printf(str2);
format(str2, sizeof(str2), "owner: %d", teleportfixer[i][Owner]); printf(str2);
TeleportDB[teleportfixer[i][ID]][Name] = teleportfixer[i][Name];
TeleportDB[teleportfixer[i][ID]][X1] = teleportfixer[i][X1];
TeleportDB[teleportfixer[i][ID]][Y1] = teleportfixer[i][Y1];
TeleportDB[teleportfixer[i][ID]][Z1] = teleportfixer[i][Z1];
TeleportDB[teleportfixer[i][ID]][A1] = teleportfixer[i][A1];
TeleportDB[teleportfixer[i][ID]][Interior1] = teleportfixer[i][Interior1];
TeleportDB[teleportfixer[i][ID]][VirtualWorld1] = teleportfixer[i][VirtualWorld1];
TeleportDB[teleportfixer[i][ID]][X2] = teleportfixer[i][X2];
TeleportDB[teleportfixer[i][ID]][Y2] = teleportfixer[i][Y2];
TeleportDB[teleportfixer[i][ID]][Z2] = teleportfixer[i][Z2];
TeleportDB[teleportfixer[i][ID]][A2] = teleportfixer[i][A2];
TeleportDB[teleportfixer[i][ID]][Interior2] = teleportfixer[i][Interior2];
TeleportDB[teleportfixer[i][ID]][VirtualWorld2] = teleportfixer[i][VirtualWorld2];
TeleportDB[teleportfixer[i][ID]][Price] = teleportfixer[i][Price];
for(new j; j < 5; j++)
{
TeleportDB[teleportfixer[i][ID]][Key][j] = teleportfixer[i][Key][j];
}
TeleportPickup1[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamicPickup(19132, 1, TeleportDB[teleportfixer[i][ID]][X1], TeleportDB[teleportfixer[i][ID]][Y1], TeleportDB[teleportfixer[i][ID]][Z1], TeleportDB[teleportfixer[i][ID]][VirtualWorld1],
TeleportDB[teleportfixer[i][ID]][Interior1], -1, 100);
TeleportPickup2[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamicPickup(19132, 1, TeleportDB[teleportfixer[i][ID]][X2], TeleportDB[teleportfixer[i][ID]][Y2], TeleportDB[teleportfixer[i][ID]][Z2], TeleportDB[teleportfixer[i][ID]][VirtualWorld2],
TeleportDB[teleportfixer[i][ID]][Interior2], -1, 100);
new string[256], tpname[32];
format(tpname, sizeof(tpname), "%s", TeleportDB[teleportfixer[i][ID]][Name]);
if(TeleportDB[teleportfixer[i][ID]][Price] > 0)
{
format(string, sizeof(string), "[Teleport: %d]\n{00FFFF}Owner: {FFFFFF}%s\n{00FFFF}For Sale: {FFFFFF}$%s", TeleportDB[teleportfixer[i][ID]][ID], OfflinePlayerName(TeleportDB[teleportfixer[i][ID]][Owner]), Comma(TeleportDB[teleportfixer[i][ID]][Price]));
}
else
{
format(string, sizeof(string), "[Teleport: %d]\n{00FFFF}Owner: {FFFFFF}%s", TeleportDB[teleportfixer[i][ID]][ID], OfflinePlayerName(TeleportDB[teleportfixer[i][ID]][Owner]));
}
TeleportText1[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamic3DTextLabel(string, -1, TeleportDB[teleportfixer[i][ID]][X1], TeleportDB[teleportfixer[i][ID]][Y1], TeleportDB[teleportfixer[i][ID]][Z1], 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, TeleportDB[teleportfixer[i][ID]][VirtualWorld1],
TeleportDB[teleportfixer[i][ID]][Interior1], -1, 100.0);
TeleportText2[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamic3DTextLabel(string, -1, TeleportDB[teleportfixer[i][ID]][X2], TeleportDB[teleportfixer[i][ID]][Y2], TeleportDB[teleportfixer[i][ID]][Z2], 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, TeleportDB[teleportfixer[i][ID]][VirtualWorld2],
TeleportDB[teleportfixer[i][ID]][Interior2], -1, 100.0);
MessageToAll(TYPE_SERVER, "Teleports reloaded");
}
}
}
PHP код:
owner: 1
owner: 2
owner x: 101
owner: 101
owner x: 112
owner: 112