11.09.2012, 15:14
pawn Код:
CMD:saveallvehicles(playerid, params[])
{
if(pInfo[playerid][Admin] < 5) return SendClientMessage(playerid, color_red, "This command can use only admins!"); //I suppose you have custom admin system
new Float:VX, Float:VY, Float:VZ, Float:VA, Float:VH, filestring[32];
for(new i; i < MAX_VEHICLES; i++)
{
GetVehiclePos(i, VX, VY, VZ);
GetVehicleZAngle(i, VA);
GetVehicleHealth(i, VH);
format(filestring, sizeof(filestring), "/data/vehicle/%i.ini", i); //Generated ini file name
//Save this... I donґt work with Y_INI, you must complete this yourself
}
return 1;
}
public OnGameModeInit()
{
new Float:VX, Float:VY, Float:VZ, Float:VA, Float:VH, VM, veh, filestring[32];
for(new i; i < MAX_VEHICLES; i++)
{
format(filestring, sizeof(filestring), "/data/vehicle/%i.ini", i); //Generated ini file name
//Load data from file
veh = CreateVehicle(VM, VX, VY, VZ, VA, -1, -1, 10000);
SetVehicleHealth(veh, VH);
}
return 1;
}