How can i load from file - RemoveBuildingForPlayer ?
#1

Hello World.
I need a stock which will load from file - 'RemoveBuildingForPlayer' .

Like there is - 'stock LoadObjectsFromFile(filename[])'
What I need is - 'stock RemoveObjectsFromFile(filename[], playerid)'


So that I will use it on public 'OnPlayerConnect'.

Thanks you very much,
I Hope you got what I said.
Reply
#2

i made a simple one hope it works:

pawn Код:
stock RemoveObjectsFromFile(filename[], playerid)
{
    new File:file = fopen(filename, io_read);
   
    new line[100];
   
    while(fread(file, line))
    {
        new modelid, Float:fx, Float:fy, Float:fz, Float:fRadius;
       
        sscanf(line, "p<,>iffff", modelid, fx, fy, fz, fRadius);
       
        RemoveBuildingForPlayer(playerid, modelid, fx, fy, fz, fRadius);
    }
    return 1;
}
example for what you will write inside the file:

Код:
3573,1798.6484,-2057.9141,14.9844,0.25
5086,1892.5391,-2012.8281,21.3750,0.25
6130,1117.5859,-1490.0078,32.7188,0.25
6255,1117.5859,-1490.0078,32.7188,0.25
762,1175.3594,-1420.1875,19.8828,0.25
615,1166.3516,-1417.6953,13.9531,0.25
8229,1142.0313,1362.5000,12.4844,0.25
8740,2798.6328,1246.6641,17.1094,0.25
8741,2842.5781,1290.7891,16.1406,0.25
8740,2798.6328,1246.6641,17.1094,0.25
8741,2842.5781,1290.7891,16.1406,0.25
8578,2798.6328,1246.6641,17.1094,0.25
963,2842.0000,1252.5469,11.4453,0.25
963,2855.8125,1267.0391,11.4453,0.25
963,2842.0000,1276.3047,11.4453,0.25
8575,2842.5781,1290.7891,16.1406,0.25
956,2845.7266,1295.0469,10.7891,0.25
962,2855.8125,1314.6250,11.4453,0.25
962,2842.0000,1324.0391,11.4453,0.25
962,2842.0000,1303.9766,11.4453,0.25
where synatx is

Код:
MODELID|X|Y|Z|RADIUS
Reply
#3

pawn Код:
stock RemoveObjectsFromFile(filename[], playerid)
{
new File:hFile;
hFile = fopen(filename, io_readwrite);
{
if(hFile)
{
//Put here the objects
} else print(" That file doesnt exist");
return 1;
}
Reply
#4

Quote:
Originally Posted by kirollos
Посмотреть сообщение
i made a simple one hope it works:

pawn Код:
stock RemoveObjectsFromFile(filename[], playerid)
{
    new File:file = fopen(filename, io_read);
   
    new line[100];
   
    while(fread(file, line))
    {
        new modelid, Float:fx, Float:fy, Float:fz, Float:fRadius;
       
        sscanf(line, "p<,>iffff", modelid, fx, fy, fz, fRadius);
       
        RemoveBuildingForPlayer(playerid, modelid, fx, fy, fz, fRadius);
    }
    return 1;
}
example for what you will write inside the file:

Код:
3573,1798.6484,-2057.9141,14.9844,0.25
5086,1892.5391,-2012.8281,21.3750,0.25
6130,1117.5859,-1490.0078,32.7188,0.25
6255,1117.5859,-1490.0078,32.7188,0.25
762,1175.3594,-1420.1875,19.8828,0.25
615,1166.3516,-1417.6953,13.9531,0.25
8229,1142.0313,1362.5000,12.4844,0.25
8740,2798.6328,1246.6641,17.1094,0.25
8741,2842.5781,1290.7891,16.1406,0.25
8740,2798.6328,1246.6641,17.1094,0.25
8741,2842.5781,1290.7891,16.1406,0.25
8578,2798.6328,1246.6641,17.1094,0.25
963,2842.0000,1252.5469,11.4453,0.25
963,2855.8125,1267.0391,11.4453,0.25
963,2842.0000,1276.3047,11.4453,0.25
8575,2842.5781,1290.7891,16.1406,0.25
956,2845.7266,1295.0469,10.7891,0.25
962,2855.8125,1314.6250,11.4453,0.25
962,2842.0000,1324.0391,11.4453,0.25
962,2842.0000,1303.9766,11.4453,0.25
where synatx is

Код:
MODELID|X|Y|Z|RADIUS
Thanks man, your awsome.
I will try to rep you up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)