SA-MP Forums Archive
Getting a "text" from file. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Getting a "text" from file. (/showthread.php?tid=124349)



Getting a "text" from file. - xCoder - 30.01.2010

Hey everybody,

I'm currenty using dudb and i don't know how i can get a "text" from a value. I can save it but i can't get it. My value is LoncaAdi.
It saves it like

LoncaAdi = SA:MP Lonca

but i can't get it to a variable.

ClanInfo[LoncaAdi] == ?


Help me !


Re: Getting a "text" from file. - xCoder - 30.01.2010

Topic Up, Please Help !


Re: Getting a "text" from file. - ray187 - 30.01.2010

Try again to explain what your problem is...


Re: Getting a "text" from file. - xCoder - 30.01.2010

Okey !

I can save my "string" to a file:

LoncaAdi = mystring

but , i can't read it.




Re: Getting a "text" from file. - MadeMan - 30.01.2010

Show the code how you save it.


Re: Getting a "text" from file. - xCoder - 30.01.2010

dcmd_loncakur(playerid,params[]) {
new file[256],string[256];
ServerInfo[ClanID]++;
if (udb_CreateClan(ServerInfo[ClanID]))
{
format(file,sizeof(file),"klanlar/%d.sav",ServerInfo[ClanID]);
dini_Set(file,"LoncaAdi",params);
dini_IntSet(file,"ToplamOyuncu",1);
dini_IntSet(file,"Kaybeden",0);
dini_IntSet(file,"Kazanan",0);
}
format(string,256,"Tebrikler, %s loncası kuruldu ! /loncayal komutu ile oyunculara davet gцnderebilirsiniz",params); // Cong. Messagea
dini_Get(file,"LoncaAdi") = ClanInfo[clanadi];// It doesnt work
return 1;
}


Re: Getting a "text" from file. - ray187 - 30.01.2010

This is the correct code:

Код:
dcmd_loncakur(playerid,params[]) {
	new file[256],string[256];
	ServerInfo[ClanID]++;
	if (udb_CreateClan(ServerInfo[ClanID]))
	{
		format(file,sizeof(file),"klanlar/%d.sav",ServerInfo[ClanID]);
		dini_Set(file,"LoncaAdi",params);
		dini_IntSet(file,"ToplamOyuncu",1);
		dini_IntSet(file,"Kaybeden",0);
		dini_IntSet(file,"Kazanan",0);
	}
	format(string,256,"Tebrikler, %s loncasi kuruldu ! /loncayal komutu ile oyunculara davet gцnderebilirsiniz",params); // Cong. Messagea
	ClanInfo[clanadi] = dini_Get(file,"LoncaAdi");// It doesnt work 
	return 1;
}
What you did was assigning ClanInfo[clanadi] to dini_Get(file,"LoncaAdi") instead of assigning the return value of dini_Get to ClanInfo[clanadi].

Why do you format string btw in the end when you don`t use it afterwards somehow?


Re: Getting a "text" from file. - xCoder - 30.01.2010

It isn't correct code. Because it doesn't work


Re: Getting a "text" from file. - ray187 - 30.01.2010

Yeah if the rest of the code that I can`t see doesn`t fit to what you`ve shown us it doesn`t work - but thats not my fault then


Re: Getting a "text" from file. - Norn - 30.01.2010

Quote:
Originally Posted by ray187
Yeah if the rest of the code that I can`t see doesn`t fit to what you`ve shown us it doesn`t work - but thats not my fault then
Use strmid.