SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/03/2020, 09:20 PM   #11
Antarovic
Little Clucker
 
Join Date: Mar 2020
Posts: 8
Reputation: 2
Default Re: House Rent System problem!

Quote:
Originally Posted by BugsBunny View Post
You mean like this?
Code:
OnHouseRenterKickSearch(playerid); public OnHouseRenterKickSearch(playerid)
{
	static rows, fields;
	cache_get_data(rows, fields, dbHandle);

	new query[128];
	new houseid = GetPlayerMenuHouse(playerid);

	if(!rows || cache_get_field_content_int(1, "house") != houseid)return
	 	SendClientMessageEx(playerid, COLOR_ERROR, "This player is not your renter.");

    new name[MAX_PLAYER_NAME];
    new tmpID;

	cache_get_field_content(0, "char_name", name, dbHandle, MAX_PLAYER_NAME);
	tmpID = cache_get_field_content_int(1, "id");

	mysql_format(dbHandle, query, sizeof(query), "UPDATE characters SET house = '-1', house_price = '-1' WHERE id = '%d'", tmpID);
	mysql_tquery(dbHandle, query);

	/*foreach(new id : Player)
	{
	 	if(!IsPlayerConnected(id) || id == playerid || tmpID != PlayerInfo[id][pID]) continue;
		if(PlayerInfo[id][pHouse] != houseid || PlayerInfo[id][pHousePrice] == -1)continue;

		SendFormattedMessage(id, COLOR_HOUSE, "%s kicked you from his house (ID: %d).", ReturnRoleplayName(playerid), PlayerInfo[playerid][pHouse]);

		PlayerInfo[id][pHouse] = -1;
		PlayerInfo[id][pHousePrice] = -1;
		if(PlayerInfo[id][pHouseSpawn] == houseid)PlayerInfo[id][pHouseSpawn] = -1;

		break;
	}*/

	SendFormattedMessage(playerid, COLOR_HOUSE, "You have kicked %s from your house renters (ID: %d).", name, PlayerInfo[playerid][pHouse]);

	return 1;
}
If yes, still same messages on mysql log!
In game: You have kicked NULL from your house renters (ID: -1)



not like that undo every thing you have done the problem is that you don't have an house to kick someone from it as function GetPlayerMenuHouse always returns -1 so the code is stuck in foreach .
and about sql errors replace this mysql_log(ALL); by the one in your code and show us the log after that.
Antarovic is offline   Reply With Quote
Old 29/03/2020, 09:24 PM   #12
BugsBunny
Little Clucker
 
Join Date: Mar 2014
Posts: 24
Reputation: 0
Default Re: House Rent System problem!

Quote:
Originally Posted by JasonRiggs View Post
Can you please find mysql_log in your gamemode and change it to
Code:
mysql_log(ALL);
Quote:
Originally Posted by Antarovic View Post
not like that undo every thing you have done the problem is that you don't have an house to kick someone from it as function GetPlayerMenuHouse always returns -1 so the code is stuck in foreach .
and about sql errors replace this mysql_log(ALL); by the one in your code and show us the log after that.
This is the whole clean log.
https://paste.ubuntu.com/p/N5qZhphcYm/

I didn't understand what you mean with the GetPlayerMenuHouse, can you do that for me?
BugsBunny is offline   Reply With Quote
Old 29/03/2020, 09:44 PM   #13
Antarovic
Little Clucker
 
Join Date: Mar 2020
Posts: 8
Reputation: 2
Default Re: House Rent System problem!

Quote:
Originally Posted by BugsBunny View Post
This is the whole clean log.
https://paste.ubuntu.com/p/N5qZhphcYm/

I didn't understand what you mean with the GetPlayerMenuHouse, can you do that for me?

first rent a house then try to kick the renter ,
about the sql -> column ID , House change their type in database to int same with toll_tax , and the rest something_tax ,
in banned and ban time their is NULLs in database so try to fix it ,
and in row index error try to start your iterations from row 1 not row 0 -> cache_get_field_content(0, "char_name", name, dbHandle, MAX_PLAYER_NAME); .
Antarovic is offline   Reply With Quote
Old 29/03/2020, 09:46 PM   #14
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 829
Reputation: 52
Default Re: House Rent System problem!

As I can see that Antarovic was right, you have to be an owner of a house first so you can kick a renter, and the renter has to be a renter of YOUR house as well..
__________________
JasonRiggs is offline   Reply With Quote
Old 29/03/2020, 09:52 PM   #15
BugsBunny
Little Clucker
 
Join Date: Mar 2014
Posts: 24
Reputation: 0
Default Re: House Rent System problem!

Quote:
Originally Posted by Antarovic View Post
first rent a house then try to kick the renter ,
about the sql -> column ID , House change their type in database to int same with toll_tax , and the rest something_tax ,
in banned and ban time their is NULLs in database so try to fix it ,
and in row index error try to start your iterations from row 1 not row 0 -> cache_get_field_content(0, "char_name", name, dbHandle, MAX_PLAYER_NAME); .
1. The house is rent already to a player. I cannot rent my house to myself.
2. ID, House, toll_tax etc... are int already.
3. They are by default NULL, and this is ok in every other system.
4. I changed row 0 to 1, same problem
BugsBunny is offline   Reply With Quote
Old 29/03/2020, 09:58 PM   #16
BugsBunny
Little Clucker
 
Join Date: Mar 2014
Posts: 24
Reputation: 0
Default Re: House Rent System problem!

Quote:
Originally Posted by JasonRiggs View Post
As I can see that Antarovic was right, you have to be an owner of a house first so you can kick a renter, and the renter has to be a renter of YOUR house as well..
I'm the owner of the house, if i'm the owner i got -1 in database. The player is the renter of my house already!

Code:
OnHouseRentersSearch(playerid); public OnHouseRentersSearch(playerid)
{
	static rows, fields;
	cache_get_data(rows, fields, dbHandle);

	if(!rows)return
		SendClientMessageEx(playerid, COLOR_ERROR, "There are no renters.");

	new renterName[MAX_PLAYER_NAME], renterPrice;

	for(new r; r < rows; r++)
	{
		cache_get_field_content(r, "char_name", renterName, dbHandle, MAX_PLAYER_NAME);
		renterPrice = cache_get_field_content_int(r, "house_price");

		SendFormattedMessage(playerid, COLOR_HOUSE, "%s ($%d)", renterName, renterPrice);
	}

	return 1;
}
Like this, there's a code that show me my renters in my home! And it works!
BugsBunny is offline   Reply With Quote
Old 30/03/2020, 09:35 PM   #17
BugsBunny
Little Clucker
 
Join Date: Mar 2014
Posts: 24
Reputation: 0
Default Re: House Rent System problem!

bump pls
BugsBunny is offline   Reply With Quote
Old 01/04/2020, 08:39 PM   #18
BugsBunny
Little Clucker
 
Join Date: Mar 2014
Posts: 24
Reputation: 0
Default Re: House Rent System problem!

help pls guys
BugsBunny is offline   Reply With Quote
Old 06/04/2020, 12:39 PM   #19
BugsBunny
Little Clucker
 
Join Date: Mar 2014
Posts: 24
Reputation: 0
Default Re: House Rent System problem!

bump
BugsBunny 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
Job System, House Rent System and Event System AngeloBrand98 Scripting Help 2 08/11/2016 07:34 AM
Rent system - problem NoDi522 Scripting Help 17 13/03/2015 10:53 PM
Gagi's House System's House cords problem Wahaj Scripting Help 2 03/07/2014 03:15 PM
Compile problem. car rent system guaid Help Archive 4 23/08/2010 11:29 PM
Help With Car Rent System Keeboo13 Help Archive 0 16/03/2010 07:52 AM


All times are GMT. The time now is 06:35 PM.


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