Issue with Mysql
#1

My script is a fully Mysql script it is suppose to save everything but i been having issues, it wont save
Dynamic Doors, Map Markers, Houses and it don't update accounts when i restart the server i force save but they just don't save i was looking in another thread with the same issue and the guy said that on this line

Код:
	new string[128], choice[32], houseid, amount;
	if(sscanf(params, "s[32]dD", choice, houseid, amount))
to change it to
Код:
	new string[128], choice[32], houseid, amount;
	if(sscanf(params, "s[32]dd", choice, houseid, amount))
i did that but nothing some one else said to try
Код:
	new string[128], choice[32], houseid, amount;
	if(sscanf(params, "s[32]dd(10)", choice, houseid, amount))
Still nothing any ideas?

Код:
CMD:hedit(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
		return 1;
	}

	new string[128], choice[32], houseid, amount;
	if(sscanf(params, "s[32]dd", choice, houseid, amount))
	{
		SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /hedit [name] [houseid] [(Optional)amount]");
		SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, CustomExterior, Class (1-3), Level, Price");
		return 1;
	}

	if(strcmp(choice, "interior", true) == 0)
	{
		GetPlayerPos(playerid, HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ]);
		GetPlayerFacingAngle(playerid, HouseInfo[houseid][hInteriorA]);
		HouseInfo[houseid][hHInteriorWorld] = GetPlayerInterior( playerid );
		SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
		SaveHouse(houseid);

		format(string, sizeof(string), "%s has edited HouseID %d's Interior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		return 1;
	}
	else if(strcmp(choice, "custominterior", true) == 0)
	{
		if(HouseInfo[houseid][hCustomInterior] == 0)
		{
			HouseInfo[houseid][hCustomInterior] = 1;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom interior!" );
		}
		else
		{
			HouseInfo[houseid][hCustomInterior] = 0;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) interior!" );
		}
		SaveHouse(houseid);

		format(string, sizeof(string), "%s has edited HouseID %d's Custom Interior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		return 1;
	}
	else if(strcmp(choice, "customexterior", true) == 0)
	{
		if(HouseInfo[houseid][hCustomExterior] == 0)
		{
			HouseInfo[houseid][hCustomExterior] = 1;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom exterior!" );
		}
		else
		{
			HouseInfo[houseid][hCustomExterior] = 0;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) exterior!" );
		}
		SaveHouse(houseid);

		format(string, sizeof(string), "%s has edited HouseID %d's Custom Exterior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		return 1;
	}
	else if(strcmp(choice, "exterior", true) == 0)
	{
		GetPlayerPos(playerid, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
		GetPlayerFacingAngle(playerid, HouseInfo[houseid][hExteriorA]);
		SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
		DestroyPickupEx(HouseInfo[houseid][hPickupID]);
		SaveHouse(houseid);

		format(string, sizeof(string), "%s has edited HouseID %d's Exterior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			DestroyPickupEx(HouseInfo[houseid][hPickupID]);
			DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
			format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel( string, COLOR_GREEN, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
			HouseInfo[houseid][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
		}
		else
		{
			if(HouseInfo[houseid][hRentable] == 0)
			{
				DestroyPickupEx(HouseInfo[houseid][hPickupID]);
				DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
				format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
				HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_GREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
				HouseInfo[houseid][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
			}
			else
			{
				DestroyPickupEx(HouseInfo[houseid][hPickupID]);
				DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
				format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hRentFee],HouseInfo[houseid][hLevel],houseid);
				HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_GREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
				HouseInfo[houseid][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
			}
		}
	}
	else if(strcmp(choice, "level", true) == 0)
	{
		HouseInfo[houseid][hLevel] = amount;
		format(string, sizeof(string), "You have set the house level to %d.", amount);
		SendClientMessageEx(playerid, COLOR_WHITE, string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
		}
		else
		{
			if(HouseInfo[houseid][hRentable] == 0)
			{
				format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
				UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
			}
			else
			{
				format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hRentFee],HouseInfo[houseid][hLevel],houseid);
				UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
			}
		}
		format(string, sizeof(string), "%s has edited HouseID %d's Level to %d.", GetPlayerNameEx(playerid), houseid, amount);
		Log("logs/hedit.log", string);
	}
	else if(strcmp(choice, "price", true) == 0)
	{
		HouseInfo[houseid][hValue] = amount;
		format(string, sizeof(string), "You have set the houses price to $%d.", amount );
		SendClientMessageEx(playerid, COLOR_WHITE, string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
		}

		format(string, sizeof(string), "%s has edited HouseID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
		Log("logs/hedit.log", string);
	}
	else if(strcmp(choice, "class", true) == 0)
	{
		switch(amount)
		{
		case 1:
			{
				format(HouseInfo[houseid][hDescription], 128, "Low" );
				SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 1 (Low)" );
			}
		case 2:
			{
				format(HouseInfo[houseid][hDescription], 128, "Medium" );
				SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 2 (Medium)" );
			}
		case 3:
			{
				format(HouseInfo[houseid][hDescription], 128, "High" );
				SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 3 (High)" );
			}
		}
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
		}

		format(string, sizeof(string), "%s has edited HouseID %d's Class to %d.", GetPlayerNameEx(playerid), houseid, amount);
		Log("logs/hedit.log", string);
	}
	SaveHouse(houseid);
	return 1;
}
i've tried to put mysql_debug but it wont debug

Код:
public OnGameModeInit() {
	new
		string[42];

	mysql_debug(1);
This is my database.sql (House part)

Код:
-- ----------------------------
-- Table structure for `houses`
-- ----------------------------
DROP TABLE IF EXISTS `houses`;
CREATE TABLE `houses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Owned` int(11) NOT NULL DEFAULT '0',
  `Level` int(11) NOT NULL DEFAULT '999',
  `HInteriorWorld` int(11) NOT NULL DEFAULT '9',
  `Description` varchar(16) NOT NULL DEFAULT 'High',
  `Owner` varchar(24) NOT NULL DEFAULT 'No-Owner',
  `ExteriorX` float(10,5) NOT NULL DEFAULT '0.00000',
  `ExteriorY` float(10,5) NOT NULL DEFAULT '0.00000',
  `ExteriorZ` float(10,5) NOT NULL DEFAULT '0.00000',
  `ExteriorR` float(10,5) NOT NULL DEFAULT '0.00000',
  `InteriorX` float(10,5) NOT NULL DEFAULT '0.00000',
  `InteriorY` float(10,5) NOT NULL DEFAULT '0.00000',
  `InteriorZ` float(10,5) NOT NULL DEFAULT '0.00000',
  `InteriorR` float(10,5) NOT NULL DEFAULT '0.00000',
  `Lock` int(11) NOT NULL DEFAULT '0',
  `Rentable` int(11) NOT NULL DEFAULT '0',
  `RentFee` int(11) NOT NULL DEFAULT '0',
  `Value` int(11) NOT NULL DEFAULT '0',
  `SafeMoney` int(11) NOT NULL DEFAULT '0',
  `Pot` int(11) NOT NULL DEFAULT '0',
  `Crack` int(11) NOT NULL DEFAULT '0',
  `Materials` int(11) NOT NULL DEFAULT '0',
  `Weapons0` int(11) NOT NULL DEFAULT '0',
  `Weapons1` int(11) NOT NULL DEFAULT '0',
  `Weapons2` int(11) NOT NULL DEFAULT '0',
  `Weapons3` int(11) NOT NULL DEFAULT '0',
  `Weapons4` int(11) NOT NULL DEFAULT '0',
  `GLUpgrade` int(11) NOT NULL DEFAULT '0',
  `PickupID` int(11) NOT NULL DEFAULT '0',
  `CustomInterior` int(11) NOT NULL DEFAULT '0',
  `CustomExterior` int(11) NOT NULL DEFAULT '0',
  `ExteriorA` float(10,5) NOT NULL DEFAULT '0.00000',
  `InteriorA` float(10,5) NOT NULL DEFAULT '0.00000',
  `MailX` float(10,5) NOT NULL DEFAULT '0.00000',
  `MailY` float(10,5) NOT NULL DEFAULT '0.00000',
  `MailZ` float(10,5) NOT NULL DEFAULT '0.00000',
  `MailA` float(10,5) NOT NULL DEFAULT '0.00000',
  `MailType` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of houses
-- ----------------------------
---EDIT---
This is the force save command
Код:
CMD:savechars(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 4) {
        SaveEventPoints();
        SaveHouses();
        SendClientMessageEx(playerid, COLOR_YELLOW, "All houses updated sucessfully.");
        mysql_SaveCrates();
        SendClientMessageEx(playerid, COLOR_YELLOW, "All Crates Saved sucessfully.");
        SaveAllAccountsUpdate();
		//g_mysql_DumpAccounts();
        SendClientMessageEx(playerid, COLOR_YELLOW, "Update Process Started - Wait for Account Saving Finish Confirmation.");
    }
    else {
        SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command.");
    }
    return 1;
}
Something else with Save Houses .
Код:
stock SaveHouses()
{
	for(new i = 0; i < MAX_HOUSES; i++)
	{
		SaveHouse(i);
	}
	return 1;
}
Something else

Код:
public FinishMaintenance()
{

	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Carrier...", 1);
    SaveCarrier();
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Houses...", 1);
	SaveHouses();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Dynamic Doors...", 1);
	SaveDynamicDoors();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Map Icons...", 1);
	SaveDynamicMapIcons();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Gates...", 1);
	SaveGates();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Event Points...", 1);
	SaveEventPoints();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Paintball Arenas...", 1);
	SavePaintballArenas();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Server Configuration", 1);
    Misc_Save();
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Office Elevator...", 1);
	SaveElevatorStuff();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Faction Pay...", 1);
	SaveThePay();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Mail Boxes...", 1);
	SaveMailboxes();

	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Streamer Plugin Shutting Down...", 1);
	DestroyAllDynamicObjects();
	DestroyAllDynamic3DTextLabels();
	DestroyAllDynamicCPs();
	DestroyAllDynamicMapIcons();
	DestroyAllDynamicRaceCPs();
	DestroyAllDynamicAreas();

	SendRconCommand("exit");
	return 1;
}
Another thing might be helpful

Код:
stock SaveHouse(houseid)
{
	new string[2048];

	format(string, sizeof(string), "UPDATE `houses` SET \
		`Owned`=%d, \
		`Level`=%d, \
		`HInteriorWorld`=%d, \
		`Description`='%s', \
		`Owner`='%s', \
		`ExteriorX`=%f, \
		`ExteriorY`=%f, \
		`ExteriorZ`=%f, \
		`ExteriorR`=%f, \
		`InteriorX`=%f, \
		`InteriorY`=%f, \
		`InteriorZ`=%f, \
		`InteriorR`=%f,",
		HouseInfo[houseid][hOwned],
		HouseInfo[houseid][hLevel],
		HouseInfo[houseid][hHInteriorWorld],
		HouseInfo[houseid][hDescription],
		HouseInfo[houseid][hOwner],
		HouseInfo[houseid][hExteriorX],
		HouseInfo[houseid][hExteriorY],
		HouseInfo[houseid][hExteriorZ],
		HouseInfo[houseid][hExteriorR],
		HouseInfo[houseid][hInteriorX],
		HouseInfo[houseid][hInteriorY],
		HouseInfo[houseid][hInteriorZ],
		HouseInfo[houseid][hInteriorR]
	);
If you want to see the full GM PM Me ill give you a link. Only will give link to people who are willing to assist me not trying to get the script for personal use.

i figure if i can get help on houses i can figure the other ones out my self, So anyone know how to fix?

(Before i get yelled at for using NGRP Script i'm using it as reference while i edit another script which i purchased from someone and have rights to use, Also keep in mind that NGG is Black Listed from samp so im told and that a scripter that did most the edits on the script is the one who "leaked" it)
Reply
#2

Did you get any erros/warning from debug log (mysql log)
Reply
#3

Mind showing us the "saveHouse()" method as there is no MySQL in the command you showed us. The formatting of the sscanf line doesn't have anything to do with this.
Reply
#4

Quote:
Originally Posted by doreto
Посмотреть сообщение
Did you get any erros/warning from debug log (mysql log)
this is what shows in debug log
Код:
[09:57:44]  
[09:57:44]  ** MySQL Debugging enabled (09/20/12)
[09:57:44]  
[09:57:44]  
[09:57:44]  ** MySQL Debugging disabled
[09:57:44]
Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Mind showing us the "saveHouse()" method as there is no MySQL in the command you showed us. The formatting of the sscanf line doesn't have anything to do with this.
Just added to main post everything to do with saving the houses
Reply
#5

You still haven't posted the SaveHouse() function. There is still no MySQL in those functions
Reply
#6

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
You still haven't posted the SaveHouse() function. There is still no MySQL in those functions
well everything there is everything related to searching SaveHouses.. damn
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)