Getting a "text" from file.
#1

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 !
Reply
#2

Topic Up, Please Help !
Reply
#3

Try again to explain what your problem is...
Reply
#4

Okey !

I can save my "string" to a file:

LoncaAdi = mystring

but , i can't read it.

Reply
#5

Show the code how you save it.
Reply
#6

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;
}
Reply
#7

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?
Reply
#8

It isn't correct code. Because it doesn't work
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)