Problem with y_ini
#1

I have problem with y_ini saving. I have command /createhouse and it should create file and write in it.
On my local server (home/house server) it work's, but when I put gamemode on host server(hosting) it doesn't work,
y_ini create file, but he won't write anything in there. Same thing is for apartment's, businesses and vehicles.

Here is image: http://prntscr.com/2g6doi

Here is my code:

Код:
	new INI:hFile;
	format(houseFile, sizeof(houseFile), "Kuce\%d.ini", id);

	hFile = INI_Open(houseFile);

case 1:
		{
            INI_SetTag(hFile, "data");

			INI_WriteString(hFile, "Vlasnik", "Drzava");
			INI_WriteString(hFile, "ImeKuce", "Mala Kuca");
			INI_WriteInt(hFile, "Na_Prodaju", 1);
			INI_WriteInt(hFile, "Cijena", 18500);
			INI_WriteInt(hFile, "Level", 3);
			INI_WriteFloat(hFile, "X", X);
			INI_WriteFloat(hFile, "Y", Y);
			INI_WriteFloat(hFile, "Z", Z);
			INI_WriteInt(hFile, "VW", (id + 1));
			INI_WriteFloat(hFile, "IntX", 327.9431);
			INI_WriteFloat(hFile, "IntY", 1478.3801);
			INI_WriteFloat(hFile, "IntZ", 1084.4375);
			INI_WriteInt(hFile, "IntID", 15);
			INI_WriteInt(hFile, "Novac_Vlasnika", 0);
			INI_WriteInt(hFile, "Materijali", 0);
			INI_WriteInt(hFile, "VrataKuce", 0);
			INI_WriteInt(hFile, "RentKuce", 0);
			INI_WriteInt(hFile, "CijenaRenta", 50);
			INI_WriteInt(hFile, "PareRentera", 0);
			INI_WriteInt(hFile, "KucaJeIznajmljena", 0);
			INI_WriteInt(hFile, "Destroyed", 0);

			INI_Close(hFile);

			Load_House(id);

			SendClientMessage(playerid, -1, ""KZ"Mala kuca "KC"je uspjesno napravljena");

			return true;
		}
Reply
#2

Bump!
Reply
#3

Try
format(houseFile, sizeof(houseFile), "Kuce\%d.ini", id);

into
format(houseFile, sizeof(houseFile), "Kuce/%d.ini", id);
Reply
#4

It create's file but it's not writing data in file..
Reply
#5

Could you post your whole switch? That might be the problem, that it never goes into case 1, or is that the ONLY place you create the file Kuce\%d.ini?
Reply
#6

Here

Код:
CMD:createhouse(playerid, params[])
{
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, ERROR" Samo RCON administratori mogu koristiti ovu komandu");
	new Vrsta,
	    id = KucaID();
	if(sscanf(params, "i", Vrsta))
	{
		SendClientMessage(playerid, -1, "Vrsta : 1. Mala Kuca | 2. Srednja Kuca | 3. Velika Kuca | 4. Vila");
		SendClientMessage(playerid, -1, ""ERROR" Koristi: /createhouse [Vrsta]");
		return 1;
	}

	if(id == (-1))
	{
		id = KucaID(true);
		if(id == (-1)) return SendClientMessage(playerid, -1, ERROR" Dostignut je maksimalan broj kuca");
	}

	new INI:hFile;
	format(houseFile, sizeof(houseFile), "Kuce\%d.ini", id);

	hFile = INI_Open(houseFile); print("Otvara fajl");

	GetPlayerPos(playerid, X, Y, Z);
	InfoKuce[id][hIzlazXKuce] = X;
	InfoKuce[id][hIzlazYKuce] = Y;
	InfoKuce[id][hIzlazZKuce] = Z;
	InfoKuce[id][hKucaNaProdaju] = 1;
	
	switch(Vrsta)
	{
		case 1:
		{
            INI_SetTag(hFile, "data"); print("Stavlja tag [data]");

			INI_WriteString(hFile, "Vlasnik", "Drzava");
			INI_WriteString(hFile, "ImeKuce", "Mala Kuca");
			INI_WriteInt(hFile, "Na_Prodaju", 1);
			INI_WriteInt(hFile, "Cijena", 18500);
			INI_WriteInt(hFile, "Level", 3);
			INI_WriteFloat(hFile, "X", X);
			INI_WriteFloat(hFile, "Y", Y);
			INI_WriteFloat(hFile, "Z", Z);
			INI_WriteInt(hFile, "VW", (id + 1));
			INI_WriteFloat(hFile, "IntX", 327.9431);
			INI_WriteFloat(hFile, "IntY", 1478.3801);
			INI_WriteFloat(hFile, "IntZ", 1084.4375);
			INI_WriteInt(hFile, "IntID", 15);
			INI_WriteInt(hFile, "Novac_Vlasnika", 0);
			INI_WriteInt(hFile, "Materijali", 0);
			INI_WriteInt(hFile, "VrataKuce", 0);
			INI_WriteInt(hFile, "RentKuce", 0);
			INI_WriteInt(hFile, "CijenaRenta", 50);
			INI_WriteInt(hFile, "PareRentera", 0);
			INI_WriteInt(hFile, "KucaJeIznajmljena", 0);
			INI_WriteInt(hFile, "Destroyed", 0);
            print("Upisuje podatke");

			INI_Close(hFile);
            print("Zatvara fajl");

			Load_House(id);

			SendClientMessage(playerid, -1, ""CC"Mala kuca "CW"je uspjesno napravljena");

			return true;
		}
		case 2:
		{
			INI_SetTag(hFile, "data");

			INI_WriteString(hFile, "Vlasnik", "Drzava");
			INI_WriteString(hFile, "ImeKuce", "Srednja Kuca");
			INI_WriteInt(hFile, "Na_Prodaju", 1);
			INI_WriteInt(hFile, "Cijena", 32000);
			INI_WriteInt(hFile, "Level", 4);
			INI_WriteFloat(hFile, "X", X);
			INI_WriteFloat(hFile, "Y", Y);
			INI_WriteFloat(hFile, "Z", Z);
			INI_WriteInt(hFile, "VW", (id + 1));
			INI_WriteFloat(hFile, "IntX", 490.9987);
			INI_WriteFloat(hFile, "IntY", 1399.4164);
			INI_WriteFloat(hFile, "IntZ", 1080.2578);
			INI_WriteInt(hFile, "IntID", 2);
			INI_WriteInt(hFile, "Novac_Vlasnika", 0);
			INI_WriteInt(hFile, "Materijali", 0);
			INI_WriteInt(hFile, "VrataKuce", 0);
			INI_WriteInt(hFile, "RentKuce", 0);
			INI_WriteInt(hFile, "CijenaRenta", 50);
			INI_WriteInt(hFile, "PareRentera", 0);
			INI_WriteInt(hFile, "KucaJeIznajmljena", 0);
			INI_WriteInt(hFile, "Destroyed", 0);

			INI_Close(hFile);

			Load_House(id);

			SendClientMessage(playerid, -1, ""CC"Srednja kuca "CW"je uspjesno napravljena");
			return 1;
		}
		case 3:
		{
			INI_SetTag(hFile, "data");

			INI_WriteString(hFile, "Vlasnik", "Drzava");
			INI_WriteString(hFile, "ImeKuce", "Velika Kuca");
			INI_WriteInt(hFile, "Na_Prodaju", 1);
			INI_WriteInt(hFile, "cijena", 97500);
			INI_WriteInt(hFile, "Level", 5);
			INI_WriteFloat(hFile, "X", X);
			INI_WriteFloat(hFile, "Y", Y);
			INI_WriteFloat(hFile, "Z", Z);
			INI_WriteInt(hFile, "VW", (id + 1));
			INI_WriteFloat(hFile, "IntX", 227.1212);
			INI_WriteFloat(hFile, "IntY", 1114.1840);
			INI_WriteFloat(hFile, "IntZ", 1080.9972);
			INI_WriteInt(hFile, "IntID", 5);
			INI_WriteInt(hFile, "Novac_Vlasnika", 0);
			INI_WriteInt(hFile, "Materijali", 0);
			INI_WriteInt(hFile, "VrataKuce", 0);
			INI_WriteInt(hFile, "RentKuce", 0);
			INI_WriteInt(hFile, "CijenaRenta", 50);
			INI_WriteInt(hFile, "PareRentera", 0);
			INI_WriteInt(hFile, "KucaJeIznajmljena", 0);
			INI_WriteInt(hFile, "Destroyed", 0);

			INI_Close(hFile);

			Load_House(id);

			SendClientMessage(playerid, -1, ""CC"Velika kuca "CW"je uspjesno napravljena");
			return 1;
		}
		case 4: // vila (Gotovo)
		{
			INI_SetTag(hFile, "data");

			INI_WriteString(hFile, "Vlasnik", "Drzava");
			INI_WriteString(hFile, "ImeKuce", "Vila");
			INI_WriteInt(hFile, "Na_Prodaju", 1);
			INI_WriteInt(hFile, "cijena", 550000);
			INI_WriteInt(hFile, "Level", 7);
			INI_WriteFloat(hFile, "X", X);
			INI_WriteFloat(hFile, "Y", Y);
			INI_WriteFloat(hFile, "Z", Z);
			INI_WriteInt(hFile, "VW", (id + 1));
			INI_WriteFloat(hFile, "IntX", 1262.3445);
			INI_WriteFloat(hFile, "IntY", -781.323242);
			INI_WriteFloat(hFile, "IntZ", 1091.906250);
			INI_WriteInt(hFile, "IntID", 5);
			INI_WriteInt(hFile, "Novac_Vlasnika", 0);
			INI_WriteInt(hFile, "Materijali", 0);
			INI_WriteInt(hFile, "VrataKuce", 0);
			INI_WriteInt(hFile, "RentKuce", 0);
			INI_WriteInt(hFile, "CijenaRenta", 50);
			INI_WriteInt(hFile, "PareRentera", 0);
			INI_WriteInt(hFile, "KucaJeIznajmljena", 0);
			INI_WriteInt(hFile, "Destroyed", 0);

			INI_Close(hFile);

			Load_House(id);

			SendClientMessage(playerid, -1, ""CC"Vila "CW"je uspjesno napravljena");
			return 1;
		}
	}
	return 1;
}
Код:
stock Load_House(houseid)
{
	format(houseFile, sizeof(houseFile), "Kuce/%d.ini", houseid);
	INI_ParseFile(houseFile, "load_house_%s", .bExtra = true, .extra = houseid);

	Iter_Add(houseIter, houseid);

	if(InfoKuce[houseid][hDestroyed]) return 1;

	if(InfoKuce[houseid][hKucaNaProdaju] == 1)
	{
		InfoKuce[houseid][hPickupKuce] = CreateDynamicPickup(1273, 1, InfoKuce[houseid][hIzlazXKuce], InfoKuce[houseid][hIzlazYKuce], InfoKuce[houseid][hIzlazZKuce]);
		format(Label, sizeof(Label), ""ZU"%s na prodaju!\nVlasnik: "CW"Drzava\n"ZU"Cijena: "CW"$%i\n"ZU"Level: "CW"%i", InfoKuce[houseid][hImeKuce], InfoKuce[houseid][hCijenaKuce], InfoKuce[houseid][hLevelKuce]);
		InfoKuce[houseid][hLabelKuce] = CreateDynamic3DTextLabel(Label, -1, InfoKuce[houseid][hIzlazXKuce], InfoKuce[houseid][hIzlazYKuce], InfoKuce[houseid][hIzlazZKuce] + 1, 15.0);
	}
	else
	{
		InfoKuce[houseid][hPickupKuce] = CreateDynamicPickup(1272, 1, InfoKuce[houseid][hIzlazXKuce], InfoKuce[houseid][hIzlazYKuce], InfoKuce[houseid][hIzlazZKuce]);
		if(InfoKuce[houseid][hRentKuce] == 1) format(Label, sizeof(Label), ""ZU"%s\n"ZU"Vlasnik: "CW"%s\n"ZU"Mogucnost iznajmljivanja: "CW"Da\n"ZU"Cijena najma: "CW"$%i", InfoKuce[houseid][hImeKuce], InfoKuce[houseid][hVlasnikKuce], InfoKuce[houseid][hCijenaRenta]);
		else format(Label, sizeof(Label), ""ZU"%s\n"ZU"Vlasnik: "CW"%s\n"ZU"Mogucnost iznajmljivanja: "CW"Ne", InfoKuce[houseid][hImeKuce], InfoKuce[houseid][hVlasnikKuce]);

		InfoKuce[houseid][hLabelKuce] = CreateDynamic3DTextLabel(Label, -1, InfoKuce[houseid][hIzlazXKuce], InfoKuce[houseid][hIzlazYKuce], InfoKuce[houseid][hIzlazZKuce] + 1, 15.0);
	}
	print("Ucitava kucu");
	return 1;
}

forward load_house_data(houseid, name[], value[]);
public load_house_data(houseid, name[], value[])
{
	INI_String("Vlasnik", InfoKuce[houseid][hVlasnikKuce], 20);
	INI_String("ImeKuce", InfoKuce[houseid][hImeKuce], 30);
	INI_Int("Na_Prodaju", InfoKuce[houseid][hKucaNaProdaju]);
	INI_Int("Cijena", InfoKuce[houseid][hCijenaKuce]);
	INI_Int("Level", InfoKuce[houseid][hLevelKuce]);
	INI_Float("X", InfoKuce[houseid][hIzlazXKuce]);
	INI_Float("Y", InfoKuce[houseid][hIzlazYKuce]);
	INI_Float("Z", InfoKuce[houseid][hIzlazZKuce]);
	INI_Float("IntX", InfoKuce[houseid][hIntXKuce]);
	INI_Float("IntY", InfoKuce[houseid][hIntYKuce]);
	INI_Float("IntZ", InfoKuce[houseid][hIntZKuce]);
	INI_Int("IntID", InfoKuce[houseid][hIntIDKuce]);
	INI_Int("Materijali", InfoKuce[houseid][hMaterijali]);
	INI_Int("VrataKuce", InfoKuce[houseid][hVrataKuce]);
	INI_Int("RentKuce", InfoKuce[houseid][hRentKuce]);
	INI_Int("CijenaRenta", InfoKuce[houseid][hCijenaRenta]);
	INI_Int("VW", InfoKuce[houseid][hVWKuce]);
	INI_Int("Novac_Vlasnika", InfoKuce[houseid][hPareVlasnika]);
	INI_Int("PareRentera", InfoKuce[houseid][hPareRentera]);
	INI_Int("KucaJeIznajmljena", InfoKuce[houseid][hKucaJeIznajmljena]);
	INI_Int("Destroyed", InfoKuce[houseid][hDestroyed]);
	return 1;
}
Reply
#7

I have changed Kuce/%d to Kuce\%d, but it didn't help'd.
Reply
#8

Bump!
Reply
#9

The problem is just simple permission isn't set write.. that's why it ain't aloud to write information in file..

Yeahh 1000 post
Reply
#10

How can i fix that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)