14.02.2017, 22:40
(
Последний раз редактировалось DerickClark; 15.02.2017 в 01:50.
)
My repair position saves in MySQL. But it's not loading from database
OnGameModeInit:
OnGameModeInit:
Код:
mysql_tquery(mysql, "SELECT * FROM repair_system", "OnLoadRepairPickups");
Код:
enum aInfo { PickupID, Float: pux, Float: puy, Float: puz, Text3D: TextLabel }; new ARepairPickups[MAX_REPAIR_PICKUPS][aInfo];
Код:
AddARepairPickups(Float:x, Float:y, Float:z) { for (new i; i < sizeof(ARepairPickups); i++) { if (ARepairPickups[i][PickupID] == 0) { ARepairPickups[i][PickupID] = CreatePickup(3096, 1, x, y, z, 0); ARepairPickups[i][pux] = x; ARepairPickups[i][puy] = y; ARepairPickups[i][puz] = z; Create3DTextLabel("{FFFF00}Type {00FF00}/repair {FFFF00}to repair your vehicle!", -1, x, y, z +0.5, 50.0, 0); CreateDynamicMapIcon(x, y, z, 63, 0, 0, 0, -1, 300.0); break; } } }
Код:
forward OnLoadRepairPickups(); public OnLoadRepairPickups() { new count; cache_get_row_count(count); for(new i; i < count; i++) { i = cache_get_value_name_int(i, "PickupID", ARepairPickups[i][PickupID]); cache_get_value_name_float(i, "pux", ARepairPickups[i][pux]); cache_get_value_name_float(i, "puy", ARepairPickups[i][puy]); cache_get_value_name_float(i, "puz", ARepairPickups[i][puz]); } return 1; }
Код:
CMD:createrepair(playerid, params[]) { new Float:x, Float:y, Float:z, query[128]; if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOUR_RED, "Administrator status required."); GetPlayerPos(playerid, x, y, z); mysql_format(mysql, query, 128, "INSERT INTO `repair_system` (`pux`,`puy`,`puz`) VALUES (%f, %f, %f)", x, y, z); mysql_tquery(mysql, query, "AddARepairPickups", "fff", x, y, z); AddARepairPickups(x, y, z); return 1; }