13.02.2017, 22:51
How can i make something save and load?
save their ID, Position
save their ID, Position
Код:
#define MAX_REPAIR_PICKUPS 20
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;
}
}
}
bool:IsPlayerAtRepair(playerid)
{
for(new i; i != sizeof(ARepairPickups); i++)
if(IsPlayerInRangeOfPoint(playerid, 5.0, ARepairPickups[i][pux], ARepairPickups[i][puy], ARepairPickups[i][puz]))
return true;
return false;
}
CMD:createrepair(playerid, params[])
{
new Float:x, Float:y, Float:z;
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOUR_RED, "Administrator status required.");
GetPlayerPos(playerid, x, y, z);
AddARepairPickups(x, y, z);
return 1;
}
CMD:repair(playerid, params[])
{
SendMessageToAdmins(playerid, "/repair", params);
if(!IsPlayerAtRepair(playerid)) SendClientMessage(playerid, COLOUR_RED, "You are not at repair station!");
else if(GetPlayerVehicleSeat(playerid) != 0) SendClientMessage(playerid, COLOUR_RED, "You are not in a vehicle");
else{
SetTimerEx("Repair", 5000, false, "i", playerid);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "~r~Fixing...~n~Please Wait...", 7000, 6);
}
return 1;
}
forward Repair(playerid);
public Repair(playerid)
{
GameTextForPlayer(playerid, "~g~Fixed!", 3000, 6);
RepairVehicle(GetPlayerVehicleID(playerid));
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, -1, "{FFFF00}[GARAGE]: {FFFFFF}Your vehicle has been serviced!");
return 1;
}



