SA-MP Forums Archive
Street names not saving - 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)
+--- Thread: Street names not saving (/showthread.php?tid=619141)



Street names not saving - IndependentGaming - 14.10.2016

Hello, yesterday I have added that admins are able to add street names but they aren't saving/loading

See house load:

Код:
stock LoadHouses()
{
	if(!fexist("houses.cfg")) return 1;

	new
		szFileStr[1024],
		File: iFileHandle = fopen("houses.cfg", io_read),
		iIndex;

	while(iIndex < sizeof(HouseInfo) && fread(iFileHandle, szFileStr))
	{
		sscanf(szFileStr, "p<|>iiis[24]ffffffffiiiiiiiiiiiiiiiiifff",
			HouseInfo[iIndex][hOwned],
			HouseInfo[iIndex][hLevel],
			HouseInfo[iIndex][hHInteriorWorld],
			//HouseInfo[iIndex][hDescription],
			HouseInfo[iIndex][hOwner],
			HouseInfo[iIndex][hExteriorX],
			HouseInfo[iIndex][hExteriorY],
			HouseInfo[iIndex][hExteriorZ],
			HouseInfo[iIndex][hExteriorR],
			HouseInfo[iIndex][hInteriorX],
			HouseInfo[iIndex][hInteriorY],
			HouseInfo[iIndex][hInteriorZ],
			HouseInfo[iIndex][hInteriorR],
			HouseInfo[iIndex][hLock],
			HouseInfo[iIndex][hRentable],
			HouseInfo[iIndex][hRentFee],
			HouseInfo[iIndex][hValue],
			HouseInfo[iIndex][hSafeMoney],
			HouseInfo[iIndex][hPot],
			HouseInfo[iIndex][hCrack],
			HouseInfo[iIndex][hMaterials],
			HouseInfo[iIndex][hWeapons][0],
			HouseInfo[iIndex][hWeapons][1],
			HouseInfo[iIndex][hWeapons][2],
			HouseInfo[iIndex][hWeapons][3],
			HouseInfo[iIndex][hWeapons][4],
			HouseInfo[iIndex][hGLUpgrade],
			HouseInfo[iIndex][hPickupID],
			HouseInfo[iIndex][hCustomInterior],
			HouseInfo[iIndex][hCustomExterior],
			HouseInfo[iIndex][hExteriorA],
			HouseInfo[iIndex][hInteriorA],
   			HouseInfo[iIndex][hAddress]
		);

		if(HouseInfo[iIndex][hLevel] != 0)
		{
			if(HouseInfo[iIndex][hOwned])
			{
				if(HouseInfo[iIndex][hRentable] == 0) format(szFileStr, sizeof(szFileStr), "House owner: %s\nLevel: %d\nHouse number: %d\n Street name: %s",HouseInfo[iIndex][hOwner],HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress]);
				else format(szFileStr, sizeof(szFileStr), "House owner: %s\nLevel: %d\nHouse number: %d\n Street name: %s\nRent: $%d\nType /rentroom to rent a room",HouseInfo[iIndex][hOwner],HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress],HouseInfo[iIndex][hRentFee]);
			}
			else format(szFileStr, sizeof(szFileStr), "This house is for sale!\n Level: %d\nHouse number: %d\n Street name: %s\nPrice: $%d\nTo buy this house type /buyhouse",HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress],HouseInfo[iIndex][hValue]);
			
			HouseInfo[iIndex][hPickupID] = CreatePickup(19524, 23, HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ], -1);
			HouseInfo[iIndex][hTextID] = CreateDynamic3DTextLabel(szFileStr, COLOR_HOUSEGREEN, HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ]+0.5,20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10.0);
		}
		++iIndex;
	}
	print("Houses successfully loaded[No Mysql]");
	return fclose(iFileHandle);
}
added the f


see house save:

Код:
stock SaveHouses()
{
	new
		szFileStr[1024],
		File: fHandle = fopen("houses.cfg", io_write);

	for(new iIndex; iIndex < MAX_HOUSES; iIndex++) {
		format(szFileStr, sizeof(szFileStr), "%d|%d|%d|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f\r\n",
			HouseInfo[iIndex][hOwned],
			HouseInfo[iIndex][hLevel],
			HouseInfo[iIndex][hHInteriorWorld],
			//HouseInfo[iIndex][hDescription],
			HouseInfo[iIndex][hOwner],
			HouseInfo[iIndex][hExteriorX],
			HouseInfo[iIndex][hExteriorY],
			HouseInfo[iIndex][hExteriorZ],
			HouseInfo[iIndex][hExteriorR],
			HouseInfo[iIndex][hInteriorX],
			HouseInfo[iIndex][hInteriorY],
			HouseInfo[iIndex][hInteriorZ],
			HouseInfo[iIndex][hInteriorR],
			HouseInfo[iIndex][hLock],
			HouseInfo[iIndex][hRentable],
			HouseInfo[iIndex][hRentFee],
			HouseInfo[iIndex][hValue],
   			HouseInfo[iIndex][hSafeMoney],
			HouseInfo[iIndex][hPot],
			HouseInfo[iIndex][hCrack],
			HouseInfo[iIndex][hMaterials],
			HouseInfo[iIndex][hWeapons][0],
			HouseInfo[iIndex][hWeapons][1],
			HouseInfo[iIndex][hWeapons][2],
			HouseInfo[iIndex][hWeapons][3],
			HouseInfo[iIndex][hWeapons][4],
			HouseInfo[iIndex][hGLUpgrade],
			HouseInfo[iIndex][hPickupID],
			HouseInfo[iIndex][hCustomInterior],
			HouseInfo[iIndex][hCustomExterior],
			HouseInfo[iIndex][hExteriorA],
			HouseInfo[iIndex][hInteriorA],
			HouseInfo[iIndex][hAddress]
		);
		fwrite(fHandle, szFileStr);
	}
	return fclose(fHandle);
}
added %f

They aren't saving or loading I don't see what is wrong here..


Re: Street names not saving - NeXoR - 14.10.2016

Is address a float ?


Re: Street names not saving - IndependentGaming - 14.10.2016

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
Is address a float ?
Yep:

hAddress[30]


Re: Street names not saving - IndependentGaming - 14.10.2016

changed f to s[30] and %f to s%[30]


Re: Street names not saving - IndependentGaming - 14.10.2016

Something goes wrong, If I use house ID 10 and ID 11 and edit from those the street name, save the houses and restart the server, If I log back in the house ID's has been changed to ID 20 and 21, if I do it again the ID's has been changed to 30 and 31. How is this possible ?

Код:
stock SaveHouses()
{
	new
		szFileStr[1024],
		File: fHandle = fopen("houses.cfg", io_write);

	for(new iIndex; iIndex < MAX_HOUSES; iIndex++) {
		format(szFileStr, sizeof(szFileStr), "%d|%d|%d|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%s\r\n",
			HouseInfo[iIndex][hOwned],
			HouseInfo[iIndex][hLevel],
			HouseInfo[iIndex][hHInteriorWorld],
			//HouseInfo[iIndex][hDescription],
			HouseInfo[iIndex][hOwner],
			HouseInfo[iIndex][hExteriorX],
			HouseInfo[iIndex][hExteriorY],
			HouseInfo[iIndex][hExteriorZ],
			HouseInfo[iIndex][hExteriorR],
			HouseInfo[iIndex][hInteriorX],
			HouseInfo[iIndex][hInteriorY],
			HouseInfo[iIndex][hInteriorZ],
			HouseInfo[iIndex][hInteriorR],
			HouseInfo[iIndex][hLock],
			HouseInfo[iIndex][hRentable],
			HouseInfo[iIndex][hRentFee],
			HouseInfo[iIndex][hValue],
   			HouseInfo[iIndex][hSafeMoney],
			HouseInfo[iIndex][hPot],
			HouseInfo[iIndex][hCrack],
			HouseInfo[iIndex][hMaterials],
			HouseInfo[iIndex][hWeapons][0],
			HouseInfo[iIndex][hWeapons][1],
			HouseInfo[iIndex][hWeapons][2],
			HouseInfo[iIndex][hWeapons][3],
			HouseInfo[iIndex][hWeapons][4],
			HouseInfo[iIndex][hGLUpgrade],
			HouseInfo[iIndex][hPickupID],
			HouseInfo[iIndex][hCustomInterior],
			HouseInfo[iIndex][hCustomExterior],
			HouseInfo[iIndex][hExteriorA],
			HouseInfo[iIndex][hInteriorA],
			HouseInfo[iIndex][hAddress]
		);
		fwrite(fHandle, szFileStr);
	}
	return fclose(fHandle);
}
Код:
stock LoadHouses()
{
	if(!fexist("houses.cfg")) return 1;

	new
		szFileStr[1024],
		File: iFileHandle = fopen("houses.cfg", io_read),
		iIndex;

	while(iIndex < sizeof(HouseInfo) && fread(iFileHandle, szFileStr))
	{
		sscanf(szFileStr, "p<|>iiis[24]ffffffffiiiiiiiiiiiiiiiiiffs[30]",
			HouseInfo[iIndex][hOwned],
			HouseInfo[iIndex][hLevel],
			HouseInfo[iIndex][hHInteriorWorld],
			//HouseInfo[iIndex][hDescription],
			HouseInfo[iIndex][hOwner],
			HouseInfo[iIndex][hExteriorX],
			HouseInfo[iIndex][hExteriorY],
			HouseInfo[iIndex][hExteriorZ],
			HouseInfo[iIndex][hExteriorR],
			HouseInfo[iIndex][hInteriorX],
			HouseInfo[iIndex][hInteriorY],
			HouseInfo[iIndex][hInteriorZ],
			HouseInfo[iIndex][hInteriorR],
			HouseInfo[iIndex][hLock],
			HouseInfo[iIndex][hRentable],
			HouseInfo[iIndex][hRentFee],
			HouseInfo[iIndex][hValue],
			HouseInfo[iIndex][hSafeMoney],
			HouseInfo[iIndex][hPot],
			HouseInfo[iIndex][hCrack],
			HouseInfo[iIndex][hMaterials],
			HouseInfo[iIndex][hWeapons][0],
			HouseInfo[iIndex][hWeapons][1],
			HouseInfo[iIndex][hWeapons][2],
			HouseInfo[iIndex][hWeapons][3],
			HouseInfo[iIndex][hWeapons][4],
			HouseInfo[iIndex][hGLUpgrade],
			HouseInfo[iIndex][hPickupID],
			HouseInfo[iIndex][hCustomInterior],
			HouseInfo[iIndex][hCustomExterior],
			HouseInfo[iIndex][hExteriorA],
			HouseInfo[iIndex][hInteriorA],
   			HouseInfo[iIndex][hAddress]
		);

		if(HouseInfo[iIndex][hLevel] != 0)
		{
			if(HouseInfo[iIndex][hOwned])
			{
				if(HouseInfo[iIndex][hRentable] == 0) format(szFileStr, sizeof(szFileStr), "House owner: %s\nLevel: %d\nHouse number: %d\n Street name: %s",HouseInfo[iIndex][hOwner],HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress]);
				else format(szFileStr, sizeof(szFileStr), "House owner: %s\nLevel: %d\nHouse number: %d\n Street name: %s\nRent: $%d\nType /rentroom to rent a room",HouseInfo[iIndex][hOwner],HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress],HouseInfo[iIndex][hRentFee]);
			}
			else format(szFileStr, sizeof(szFileStr), "This house is for sale!\n Level: %d\nHouse number: %d\n Street name: %s\nPrice: $%d\nTo buy this house type /buyhouse",HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress],HouseInfo[iIndex][hValue]);
			
			HouseInfo[iIndex][hPickupID] = CreatePickup(19524, 23, HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ], -1);
			HouseInfo[iIndex][hTextID] = CreateDynamic3DTextLabel(szFileStr, COLOR_NEWHOUSEGREEN, HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ]+0.5,20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10.0);
		}
		++iIndex;
	}
	print("Houses successfully loaded[No Mysql]");
	return fclose(iFileHandle);
}



Re: Street names not saving - Logic_ - 14.10.2016

I will suggest you to use MySQL based housing system. Dini/ SII is outdated and too slow.


Re: Street names not saving - IndependentGaming - 14.10.2016

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
I will suggest you to use MySQL based housing system. Dini/ SII is outdated and too slow.
I understand I want to have everything mysql but the problem is my accounts are saving mysql and not my houses gates and doors and other things I'm not good with mysql currently I'm using SA-MP MySQL plugin R5 but I want to upgrade it but I dont know how and the wiki sites don't help me much.

So like I said how can I fix with dini that the hAddress saves good and not the problems you read above??


Re: Street names not saving - Mencent - 14.10.2016

I think it's better to upgrade to the latest mysql version.
R41 => https://github.com/pBlueG/SA-MP-MySQL/releases

Maybe you find a tutorial on the Internet where you can see how you upgrade R5 to R40 / R41.
(Here is a tutorial for R33, maybe you can use this and the link above.
https://sampforum.blast.hk/showthread.php?tid=485633)


Re: Street names not saving - IndependentGaming - 14.10.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
I think it's better to upgrade to the latest mysql version.
R41 => https://github.com/pBlueG/SA-MP-MySQL/releases

Maybe you find a tutorial on the Internet where you can see how you upgrade R5 to R40 / R41.
(Here is a tutorial for R33, maybe you can use this and the link above.
https://sampforum.blast.hk/showthread.php?tid=485633)
Like I said, If I try this again I will f*ckup my game mode again, I have tried this before.


I downloaded mysql plugin R34 and getting the following errors:

Код:
 Roleplay\gamemodes\RP.pwn(3133) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(7183) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(7199) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(8777) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(13363) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(13432) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(13470) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(13570) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(13609) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(13677) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(16138) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(21081) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(21708) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(22631) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(24455) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(25800) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(34587) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(36760) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(36786) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(40856) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(40944) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(45453) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(45462) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(45488) : error 035: argument type mismatch (argument 1)
Roleplay\gamemodes\RP.pwn(45531) : error 025: function heading differs from prototype
Roleplay\gamemodes\RP.pwn(45536) : warning 235: public function lacks forward declaration (symbol "OnQueryFinish")
Roleplay\gamemodes\RP.pwn(45544) : error 017: undefined symbol "mysql_fetch_int"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.



Re: Street names not saving - IndependentGaming - 14.10.2016

Lets continue on my problem please, I will check maybe later if I gonna upgrade the sql or not.