17.06.2012, 16:32
pawn Код:
command(savevehicle, playerid, params[])
{
if(PlayerInfo[playerid][Admin] >= 4)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicle, Float:vx, Float:vy, Float:vz, Float:vr;
GetPlayerPos(playerid, vx, vw, vz);
GetPlayerFacingAngle(playerid, vr);
vehicle = GetPlayerVehicleID(playerid);
new Vehiclefile[246];
format(Vehiclefile, sizeof(Vehiclefile), "vehicles/Vehicle_%d.ini", SpawnedVehicles);
dini_Create(Vehiclefile);
dini_IntSet(Vehiclefile, "VID", vehicle);
dini_FloatSet(Vehiclefile, "Posvx", Float:vx);
dini_FloatSet(Vehiclefile, "Posvy", Float:vy);
dini_FloatSet(Vehiclefile, "Posvz", Float:vz);
dini_FloatSet(Vehiclefile, "Posvr", Float:vr);
dini_IntSet(Vehiclefile, "FactionID", 0);
SendClientMessage(playerid, COLOUR_ADMIN, "[ADMIN NOTE] You have successfully saved the vehicle. /vfaction to change car faction." );
SpawnedVehicles++;
}
}
return 1;
}
What I was planning for it to do is to set the name of the file to the current value of SpawnedVehicles, create the file and save it. It then increases so that you can save another one, and it won't overlap the other value.
Hope I helped.