I/O functions file load from ini file -
razol - 30.04.2012
Firstly, hello guys.I have a problem.I tried every time to do this.But i couldn't.I need your help guys !
Now my problem is when samp-server opened..I want to load from ini file.
fwrite ini code

for save to scriptfiles )
pawn Код:
CMD:createfaction(playerid, params[])
{
new olusumadi[32],skinid,Float:Xi,Float:Yi,Float:Zi, factionlar[256];
if(sscanf(params, "si", olusumadi,skinid)) return MesajGonder(playerid,"/createfaction [Faction name] [faction start skin]");
GetPlayerPos(playerid,Xi,Yi,Zi);
CreateOrganization(olusumadi, skinid, Xi,Yi,Zi, 24,500,25,500,3,1);
format(factionlar,256,"CreateOrganization(%s,%i,%f,%f,%f,24,500,25,500,3,1);\n\r",olusumadi,skinid,Xi,Yi,Zi);
new File:dosya = fopen("Factionlar.ini", io_append);
fwrite(dosya, factionlar);
fclose(dosya);
return 1;
}
Now how can i load this ini file when samp-server opened ?
Re: I/O functions file load from ini file -
razol - 30.04.2012
Dude i guess you didn't understand me.I mean; when server is opened, this function(createorganization) will create in OnGameModeInit.And yes i looked it.I couldn't find any solution.I don't know how to load ongamemodeinit..
Re: I/O functions file load from ini file -
razol - 30.04.2012
Any help ?
Re: I/O functions file load from ini file -
Jefff - 30.04.2012
pawn Код:
stock LoadOrganizations()
{
new str[128],olusumadi[32],skinid,Float:P[3],Factions;
new File:Org = fopen("Factionlar.ini", io_read);
if(!Org) return print("File Factionlar.ini not found");
while(fread(Org,str))
{
sscanf(str,"p<,>'('s[32]ia<f>[3]",olusumadi,skinid,P);
CreateOrganization(olusumadi,skinid,P[0],P[1],P[2],24,500,25,500,3,1);
Factions++;
}
fclose(Org);
return printf("Loaded %d faction%s",Factions,(Factions == 1) ? ("") : ("s"));
}
CMD:createfaction(playerid, params[])
{
new olusumadi[32],skinid,Float:Xi,Float:Yi,Float:Zi, factionlar[256];
if(sscanf(params, "si", olusumadi,skinid)) return MesajGonder(playerid,"/createfaction [Faction name] [faction start skin]");
GetPlayerPos(playerid,Xi,Yi,Zi);
CreateOrganization(olusumadi, skinid, Xi,Yi,Zi, 24,500,25,500,3,1);
format(factionlar,256,"CreateOrganization(%s,%i,%.4f,%.4f,%.4f,24,500,25,500,3,1);\r\n",olusumadi,skinid,Xi,Yi,Zi);
new File:dosya = fopen("Factionlar.ini", io_append);
fwrite(dosya, factionlar);
fclose(dosya);
return 1;
}
In OnGameModeInit
Re: I/O functions file load from ini file -
razol - 30.04.2012
Thank you so much..Worked fine.