SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/06/2019, 11:51 AM   #1
Coox
Little Clucker
 
Coox's Avatar
 
Join Date: Feb 2018
Posts: 26
Reputation: 0
Default Query doesnt execute

Hello, so I was createing SQL house system but when I finished I created saving system but it doesn't seem to execute it UPDATE query. Would appreciate some help.

HTML Code:
SaveHouse(id) {
	new DB_Query1[1024];
	format(DB_Query1, sizeof(DB_Query1), "`NAME` = '%s', `LEVEL` = %d, `PRICE` = %d, `RENT` = %d, `RENTPRICE` = %d, `POSX` = '%f', `POSY` = '%f', `POSZ` = '%f'",
	kInfo[id][kOwner],
	kInfo[id][kLevel],
	kInfo[id][kPrice],
	kInfo[id][kRent],
	kInfo[id][kRentPrice],
	kInfo[id][kPosX],
	kInfo[id][kPosY],
	kInfo[id][kPosZ]);
	mysql_format(Database, DB_Query1, sizeof(DB_Query1), "UPDATE `HOUSES` SET %s WHERE `ID` = %d", DB_Query1, id);
	mysql_tquery(Database, DB_Query1);

	format(DB_Query1, sizeof(DB_Query1), "`EXITX` = '%f', `EXITY` = '%f', `EXITZ` = '%f', `TYPE` = %d, `INTERIOR` = %d, `VW` = %d, `LOCK` = %d",
	kInfo[id][kExitX],
	kInfo[id][kExitY],
	kInfo[id][kExitZ],
	kInfo[id][kType],
	kInfo[id][kInterior],
	kInfo[id][kVW],
	kInfo[id][kLock]);
	mysql_format(Database, DB_Query1, sizeof(DB_Query1), "UPDATE `HOUSES` SET %s WHERE `ID` = %d", DB_Query1,id);
	mysql_tquery(Database, DB_Query1);
	return true;
}

CreateHouse(playerid, level, price, type, Float:x, Float:y, Float:z) {
	new 
		DB_Query[246+50],
		label[268+50],
		rentallowed[10],
		type1[20];
	mysql_format(Database, DB_Query, sizeof DB_Query, "INSERT INTO `HOUSES` (`OWNER`, `LEVEL`, `PRICE`, `RENT`, `RENTPRICE`, `POSX`, `POSY`, `POSZ`, `EXITX`,`EXITY`,`EXITZ`,`TYPE`, `INTERIOR`, `VW`, `LOCK`) \
	VALUES ('N/A', '%d', '%d', '1', '100', '%f', '%f', '%f',0.0,0.0,0.0, '%d', '0', '0', '0')", level, price, x,y,z, type);
	mysql_tquery(Database, DB_Query, "OnHouseCreated", "d", playerid);
	kInfo[houseID][kLevel] = level;
	kInfo[houseID][kPrice] = price;
	kInfo[houseID][kRent] = true;
	kInfo[houseID][kRentPrice] = 100;
	kInfo[houseID][kPosX] = x;
	kInfo[houseID][kPosY] = y;
	kInfo[houseID][kPosZ] = z;
	kInfo[houseID][kType] = type;
	if(type == 4) {
		kInfo[houseID][kInterior] = 5;
		kInfo[houseID][kExitX] = 140.17;
		kInfo[houseID][kExitY] = 1366.07;
		kInfo[houseID][kExitZ] = 1083.65;
	}
	else if(type == 3) {
		kInfo[houseID][kInterior] = 6;
		kInfo[houseID][kExitX] = 234.19;
		kInfo[houseID][kExitY] = 1063.73;
		kInfo[houseID][kExitZ] = 1084.21;
	}
	else if(type == 2) {
		kInfo[houseID][kInterior] = 2;
		kInfo[houseID][kExitX] = 2237.59;
		kInfo[houseID][kExitY] = -1081.64;
		kInfo[houseID][kExitZ] = 1049.02;
	}
	else if(type == 1) {
		kInfo[houseID][kInterior] = 1;
		kInfo[houseID][kExitX] = 243.72;
		kInfo[houseID][kExitY] = 304.91;
		kInfo[houseID][kExitZ] = 999.15;
	}
	kInfo[houseID][kVW] = houseID;
	kInfo[houseID][kLock] = 0;
	if(kInfo[houseID][kRent] == true) rentallowed = "Da";
	else rentallowed = "Ne";
	if(type == 1) type1 = "Mala kuca";
	else if(type == 2) type1 = "Srednja kuca";
	else if(type == 3) type1 = "Velika kuca";
	else if(type == 4) type1 = "Villa";
	format(label, sizeof label, ""COLOR_HOUSE"[ "COLOR_WHITE"KUCA NA PRODAJU"COLOR_HOUSE" ]\n"COLOR_HOUSE"Vlasnik: "COLOR_WHITE"Drzava\n"COLOR_HOUSE"Level: "COLOR_WHITE"%d\
	\n"COLOR_HOUSE"Cijena: "COLOR_WHITE"$%d\n"COLOR_HOUSE"Rent: "COLOR_WHITE"%s\n"COLOR_HOUSE"Vrsta: "COLOR_WHITE"%s\n'/buyhouse'", level, price, rentallowed, type1);
	kLabel[houseID] = CreateDynamic3DTextLabel(label, 0xFFFFFFFF,  kInfo[houseID][kPosX], kInfo[houseID][kPosY],kInfo[houseID][kPosZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0, -1, 20.0);
	kPickup[houseID] = CreateDynamicPickup(1273, 1, kInfo[houseID][kPosX], kInfo[houseID][kPosY],kInfo[houseID][kPosZ], 0, 0);
	houseID = -1;
	return true;
}
Coox is offline   Reply With Quote
Old 24/06/2019, 01:30 PM   #2
YouShootIDodge
Little Clucker
 
Join Date: May 2019
Posts: 42
Reputation: 11
Default Re: Query doesnt execute

Show mysql log.
YouShootIDodge is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can not execute this query mysql mcreed Scripting Help 1 21/11/2016 07:29 PM
Mysql query don't execute ?! HELP Metharon Scripting Help 1 15/03/2016 01:36 PM
doesnt repond to query iBots Scripting Help 2 17/07/2014 02:45 PM
MySQL doesn't execute a query kamiliuxliuxliux Scripting Help 27 06/06/2014 11:57 AM
Mysql query succeeded but doesnt get in database! HELP! thimo Scripting Help 0 26/02/2012 08:51 AM


All times are GMT. The time now is 12:32 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.