üdv,az elözõ témámba kértek ilyet,nemtudom pontosan h ki,de tess
tesztelve nem volt,azt írtam át,elm jó
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <zcmd>
#define MAX_PICKUP 20
enum Adatok
{
ModelID,
X,
Y,
Z
};
new Adat[MAX_PICKUP][Adatok];
stock AdatMentes()
{
new idx = 0,string[128],File:file;
while (idx < MAX_PICKUP)
{
format(string,sizeof(string),\"%d|%f|%f|%f\",
Adat[idx][ModelID],
Adat[idx][X],
Adat[idx][Y],
Adat[idx][Z]);
}
if(idx == 0)
{
file = fopen(\"pickupok.txt\", io_write);
}
else
{
file = fopen(\"pickupok.txt\", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
print(\"Pickupok sikeresen elmentve!\");
}
stock AdatBetoltes()
{
new idx = 0;
new string[256];
new File:file = fopen(\"pickupok.txt\", io_read);
if(file)
{
while(idx < MAX_PICKUP)
{
fread(file, string);
if(Adat[idx][ModelID])
{
printf(\"Pickupok sikeresen betöltve!\");
Adat[idx][ModelID] = CreatePickup(Adat[idx][ModelID],1,Adat[idx][X],Adat[idx][Y],Adat[idx][Z],0);
}
idx++;
}
}
return 1;
}
public OnFilterScriptInit()
{
AdatBetoltes();
return 1;
}
public OnFilterScriptExit()
{
AdatMentes();
return 1;
}
CMD:pickup(playerid,params[])
{
new Model;
if(sscanf(params,\"i\",Model))return SendClientMessage(playerid,-1,\"Használat:/pickup [Model]\");
for(new idx=0; idx<MAX_PICKUP; idx++)
{
if(!Adat[idx][ModelID])
{
Adat[idx][ModelID] = Model;
GetPlayerPos(playerid,Float:Adat[idx][X],Float:Adat[idx][Y],Float:Adat[idx][Z]);
Adat[idx][ModelID] = CreatePickup(Adat[idx][ModelID],1,Adat[idx][X],Adat[idx][Y],Adat[idx][Z],0);
AdatMentes();
AdatBetoltes();
}
}
return 1;
}