Player name in .txt file
#1

I am new in this dini.inc stuff and i am trying to save a Player name in a .txt file located in a folder. This is what i designed but is not working

Код:
if(dini_Exists("scriptfiles/war/TopKills1.txt"))
	{
	   	dini_Set("scriptfiles/war/TopKills1.txt", "%s", name);
	}
Can someone tell me what i did wrong
Reply
#2

Remove scriptfiles/ from the directory, it's already defined by itself in the SAMP library.
Reply
#3

Yeah.. i figured that out by myself but after this i have another issue, the file is saving the name but idk how to use dini_Get so that the name can show up in another place like this

Код:
if(!dini_Exists("war/TopKills1.txt"))
 	dini_Create("war/TopKills1.txt");
 	format(str, 256,"{63380A}Triads{FFFFFF}-{808000}LSV{FFFFFF}-{008000}Grove{FFFFFF}, Best Killer: [{63380A}%s{FFFFFF}] || Kills: [{63380A}%d{FFFFFF}]",name, PlayerInfo[TopKills1][pWarKills]);
	dini_Set("war/TopKills1.txt", "BK1", name);
This is saving

Код:
format(cstring, sizeof(cstring),"\n \n {FFFFFF}Best Killer: {63380A}%s{FFFFFF} - Kills -[{63380A}%d{FFFFFF}] | {800000}%s{FFFFFF} - Kills - [{800000}%d{FFFFFF}]", dini_Get("war/TopKills1.txt","BK1"), PlayerInfo[TopKills1][pWarKills], dini_Get("war/TopKills2.txt","BK2"), PlayerInfo[TopKills2][pWarKills]);
How can i make so that the Best killer can show in the other place?
Reply
#4

any1 any ideas?
Reply
#5

well, in dini_set second parameter is the tag of value and third is the value itself so we will do:
PHP код:
dini_Set("war/TopKills1.txt""BK1"name); 
you also can save all the names in one file and load:

PHP код:
dini_Set("war/TopKills.txt""BK1"name);
dini_Set("war/TopKills.txt""BK2"name2);
dini_Set("war/TopKills.txt""BK3"name3);
dini_Set("war/TopKills.txt""BK4"name4);
dini_Set("war/TopKills.txt""BK5"name5);
... 
and later for loading:
PHP код:
dini_Get("war/TopKills.txt","BK1");
dini_Get("war/TopKills.txt","BK2");
dini_Get("war/TopKills.txt","BK3");
dini_Get("war/TopKills.txt","BK4");
dini_Get("war/TopKills.txt","BK5");
... 
also /scriptfiles is not required at all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)