pawn Код:
#include <a_samp>
#include <sscanf2>
stock LoadGObjectsFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new Object;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRX;
new Float:SpawnRY;
new Float:SpawnRZ;
new Float:draw;
new Objects_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr)
{
printf("[Guff] Couldn't load objects from %s [Reason : File doesn't exist]", filename);
}
else
{
Objects_loaded = 0;
while(fread(file_ptr,line,256))
{
sscanf(line,"p<,>iffffffi",SpawnX, SpawnY, SpawnZ, SpawnRX, SpawnRY, SpawnRZ, draw);
CreateObject(Object, SpawnX, SpawnY, SpawnZ, SpawnRX, SpawnRY, SpawnRZ, draw);
Objects_loaded++;
}
}
fclose(file_ptr);
printf("[Guff] Loaded %d objects from: %s",Objects_loaded,filename);
return Objects_loaded;
}
stock LoadGAddStaticVehiclesFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new modelid, Float:SpawnX, Float:SpawnY, Float:SpawnZ, Float:angle, color1, color2, Cars_Loaded;
file_ptr = fopen(filename, filemode:io_read);
if(!file_ptr)
{
printf("[Guff] Couldn't load permanent vehicles from %s [Reason : File doesn't exist]", filename);
}
else
{
Cars_Loaded = 0;
while(fread(file_ptr, line, 256))
{
sscanf(line, "p<,>iiffffff", SpawnX, SpawnY, SpawnZ, angle, color1, color2);
AddStaticVehicle(modelid, SpawnX, SpawnY, SpawnZ, angle, color1, color2);
Cars_Loaded++;
}
}
fclose(file_ptr);
printf("[Guff] Loaded %d vehicles from: %s",Cars_Loaded,filename);
return Cars_Loaded;
}
stock LoadCreateVehiclesFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new modelid, Float:SpawnX, Float:SpawnY, Float:SpawnZ, Float:angle, color1, color2, respawn, Cars_Loaded;
file_ptr = fopen(filename, filemode:io_read);
if(!file_ptr)
{
printf("[Guff] Couldn't load temporary vehicles from %s [Reason : File doesn't exist]", filename);
}
else
{
Cars_Loaded = 0;
while(fread(file_ptr, line, 256))
{
sscanf(line, "p<,>iifffffff", SpawnX, SpawnY, SpawnZ, angle, color1, color2, respawn);
CreateVehicle(modelid, SpawnX, SpawnY, SpawnZ, angle, color1, color2, respawn);
Cars_Loaded++;
}
}
fclose(file_ptr);
printf("[Guff] Loaded %d vehicles from: %s",Cars_Loaded,filename);
return Cars_Loaded;
}