[Help] Save system
#1

Description about the problem: I have created an the state's business system. I want to create save system for it with .ini or .cfg,but I don't know how to do it. I have created an,but not working. I need just to save player's name who is owner of the business.
Part of the script:

Dialog if you want to buy,or just to see who is the owner of any biz

Код:
format(string2, sizeof(string2), "Sprunk firma(400.000$) Vlasnik %s\nKladionica(350.000$) Vlasnik: %s",Drzavica[i][DrzavaName],Drzavica[i][DrzavaName1]);
     				ShowPlayerDialog(playerid, 1667, DIALOG_STYLE_LIST, "Drzavne firme", string2, "Kupi", "Odustani");
This is OnDialOgResponse 1667

Код:
new ime[MAX_PLAYER_NAME];
				GetPlayerName(playerid, ime, sizeof(ime));
    			new nstring[MAX_PLAYER_NAME];
				format(nstring, sizeof(nstring), "%s", ime);
				strmid(Drzavica[DrzavaName], nstring, 0, strlen(nstring), 255);
Код:
}
public LoadFirma()
{
    new idx;
	while (idx < sizeof(Drzavica))
	{
	    new string[128];
	    format(string, sizeof(string), "No-one");
	    if(strcmp(Drzavica[idx][DrzavaName],string, true ) == 0 )
		{
		    return 0;
		}
		foreach(Player, i)
		{
		    if(IsPlayerConnected(i))
		    {
				new wstring[MAX_PLAYER_NAME];
				format(string, sizeof(string), "%s", PlayerName(i));
				strmid(wstring, string, 0, strlen(string), 255);
				new arrCoords[2][64];
				new strFromFile2[256];
				new File: file = fopen("BURPG/drzavice.cfg", io_read);
				if (file)
				{
					fread(file, strFromFile2);
					split(strFromFile2, arrCoords, ',');
					strmid(Drzavica[idx][DrzavaName], arrCoords[0], 0, strlen(arrCoords[0]), 255);
					strmid(Drzavica[idx][DrzavaName1], arrCoords[1], 0, strlen(arrCoords[1]), 255);
					fclose(file);
					idx++;
				}
			}
		}
	}
	return 1;
}

public SaveFirma()
{
	new idx;
	new File: file2;
	while (idx < sizeof(Drzavica))
	{
		new coordsstring[256];
		format(coordsstring, sizeof(coordsstring), "%d|%d\n",Drzavica[idx][DrzavaName],Drzavica[idx][DrzavaName1]);
		if(idx == 0)
		{
			file2 = fopen("BURPG/drzavice.cfg", io_write);
		}
		else
		{
			file2 = fopen("BURPG/drzavice.cfg", io_append);
			fwrite(file2, coordsstring);
			idx++;
			fclose(file2);
		}
	}
	return 1;
When I type /drzavnefirme and want to buy any it says that I have bought,but I can't again type /drzavnefirme,don't know why,that cmd was working after buy,but not now.

Can You please fix it,or tell me how to create better system
Reply
#2

You have a missing closing bracket } at the end of SaveFirma, maybe it's that?
Reply
#3

Quote:
Originally Posted by Ceez
Посмотреть сообщение
You have a missing closing bracket } at the end of SaveFirma, maybe it's that?
No,I haven't
Reply
#4

Help please
Reply
#5

Someone help?
Reply
#6

Slovenija? haha drzavice pa to aa' XD
Reply
#7

Quote:
Originally Posted by wumpyc
Посмотреть сообщение
Slovenija? haha drzavice pa to aa' XD
Ma ne,nego moram tako imam nesto drugo pod Drzavne definisano :P
Reply
#8

Help me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)