19850,1196.842651,-1322.121337,15.398437,0.000000,0.000000,90.000000 1985,1196.842651,-1322.121337,23.938106,0.000000,0.000000,90.000000 1986,1196.842651,-1322.121337,23.938106,0.000000,0.000000,90.000000 1989,1197.681152,-1319.800903,18.398441,0.000000,0.000000,90.000000
forward LoadMap(inputtext[]); public LoadMap(inputtext[]) { new load[192], path[64]; format(load, sizeof(load), "%s\r\n",load); format(path, sizeof(path), "Objects/%s.txt", inputtext); new File:oFile; oFile = fopen(path, io_read); fread(oFile, load); new count; while (fread(oFile, load)) { CreateObject(load); count++; } fclose(oFile); return count; }
(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0)
CreateObject(load);
#include <a_samp>
#include <core>
#include <float>
public OnFilterScriptInit()
{
LoadObjectsFromFile("/Objects/Objects.txt");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
stock LoadObjectsFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new var_from_line[64];
new Object;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRX;
new index;
new Objects_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
Objects_loaded = 0;
while(fread(file_ptr,line,256) > 0)
{
index = 0;
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
Object = strval(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRX = floatstr(var_from_line);
CreateObject(Object, SpawnX, SpawnY, SpawnZ, SpawnRX, 0.0, 0.0);
Objects_loaded++;
}
fclose(file_ptr);
printf("Loaded %d Object From: %s",Objects_loaded,filename);
return Objects_loaded;
}
stock token_by_delim(const string[], return_str[], delim, start_index)
{
new x=0;
while(string[start_index] != EOS && string[start_index] != delim) {
return_str[x] = string[start_index];
x++;
start_index++;
}
return_str[x] = EOS;
if(string[start_index] == EOS) start_index = (-1);
return start_index;
}
ok done your fs bellow
PHP код:
|