public OnGameModeInit()
{
SetGameModeText("DayZ");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
LoadVehicleFile("/DayZ/Cars/Carfile.ini");
return 1;
}
{
SendClientMessage(playerid, COLOR_GREEN, "the position of the car has been saved.");
new string[128];
new Float:x, Float:y, Float:z, Float:a;
new vModel;
vModel=GetVehicleModel(vehicleid);
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
new File:file = fopen("/DayZ/Cars/Carfile.ini",io_append);
format(string,sizeof(string), "%d %f %f %f %f \r\n",vModel, x,y,z,a);
fwrite(file,string);
fclose(file);
return 1;
}
stock LoadVehicleFile(const filename[])
{
new File:file_ptr;
new line[256];
new vehicletype;
new Float:SpawnCarX,Float:SpawnCarY,Float:SpawnCarZ,Float:SpawnRot;
new Color1, Color2;
new vehicles_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr){ printf("%s Not Found!",filename);return 0;}
vehicles_loaded = 0;
while(fread(file_ptr,line,256) > 0)
{
if(!sscanf(line, "iffffii{S}", vehicletype, SpawnCarX,SpawnCarY,SpawnCarZ,SpawnRot,Color1,Color2))
{
AddStaticVehicleEx(vehicletype,SpawnCarX,SpawnCarY,SpawnCarZ,SpawnRot,Color1,Color2,(15*60)); // respawn 15 minutes
vehicles_loaded++;
}
}
fclose(file_ptr);
printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
return vehicles_loaded;
}
bei printf("Loaded 0 vehicles from: MEIN_PFAD",vehicles_loaded,filename); habe ich die Abfrage gemacht. Jedoch befindet sich in der Konfigurationsdatei:
411 1700.458007 -2431.124511 13.281746 180.524154