SA-MP Forums Archive
House - 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: House (/showthread.php?tid=641207)



House - Puff - 12.09.2017

Код:
if(Gates[gate][EGateHouseSQLID] != 0 && !aoverride)
	{
		new house = houseIDFromSQLID(Gates[gate][EGateHouseSQLID]);
		if(house != -1)
		{
			if(getHouseOwner(house) != 0 && !hasHouseKeys(playerid, house))
			{
				SendClientMessage(playerid, X11_TOMATO_2, "You don't have access to that gate");
				return 1;
			}
		}
	}
this doesn't seem to be working.. anyone can open gate even when HouseSQLID is set here:
Код:
enum EGateInfo {
	EGateCmd[32],
	EGateModelID,
	Float:EGateX,
	Float:EGateY,
	Float:EGateZ, 	
	Float:EGateRotX,
	Float:EGateRotY,
	Float:EGateRotZ,
	FactionType:EGateFactionType,
	EGateJob,
	EGateState, //0 if closed, 1 if opened, 2 if disabled, 3 if forced opened
	Float:EOpenPosX,
	Float:EOpenPosY,
	Float:EOpenPosZ,
	EGateObjectID,
	EGateRoleText[64],
	Float:EGateFindDistance,
	Float:EGateMoveSpeed,
	Float:EGateOpenRotX,
	Float:EGateOpenRotY,
	Float:EGateOpenRotZ,
	EGateInterior,
	EGateVW,
	EGateFaction,
	EGateLastMoveTime, //unix timestamp of last move time
	EGateHouseSQLID, //SQLID of the house its associated with
	EGateBizSQLID, //SQLID of business
Код:
{"hgate6",971, -1048.2001953125, -1313.9990234375, 131.19999694824,   0.00, 0.00, 0.00,EFactionType_None, -1, 0, 0.0, 0.0, -9.5, 0, "* %s uses %s remote to %s the house gate.",15.0,7.0 , 0.0, 0.0, 0.0,0,0,0,0,1910,-1},



Re: House - Kane - 12.09.2017

Код:
(getHouseOwner(house) != 0
Is this by any chance meant to be true?

Would be better if you show the functions. getHouseOwner and hasHousekeys.


Re: House - JasonRiggs - 12.09.2017

There is no "else" I see, You said that if the Player is not the owner or Doesn't have the house key, send him the message of
Quote:

You don't have access to that gate

But What if he has got the keys or he is the house owner? You haven't created a case for it.


Re: House - Puff - 13.09.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Код:
(getHouseOwner(house) != 0
Is this by any chance meant to be true?

Would be better if you show the functions. getHouseOwner and hasHousekeys.
Код:
hasHouseKeys(playerid, house) {
	new rent = GetPVarInt(playerid, "Rent");
	return Houses[house][EHouseOwnerSQLID] == GetPVarInt(playerid, "CharID") || rent == Houses[house][EHouseSQLID];
}
getHouseOwner(house) {
	return Houses[house][EHouseOwnerSQLID];
}



Re: House - Puff - 13.09.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
There is no "else" I see, You said that if the Player is not the owner or Doesn't have the house key, send him the message of But What if he has got the keys or he is the house owner? You haven't created a case for it.
It works for JOB and Faction gates though..

Код:
	if(Gates[gate][EGateJob] != -1 && !aoverride)
	{
		if(job != Gates[gate][EGateJob])
		{
			SendClientMessage(playerid, X11_TOMATO_2, "You don't have access to that gate");
			return 1;
		}
	}
	if(Gates[gate][EGateFactionType] != EFactionType_None && !aoverride)
	{
		if(Gates[gate][EGateFactionType] != getPlayerFactionType(playerid))
		{
			SendClientMessage(playerid, X11_TOMATO_2, "You don't have access to that gate");
			return 1;
		}
	}
	if(Gates[gate][EGateFaction] != 0 && !aoverride)
	{
		new faction = GetPVarInt(playerid, "Faction");
		if(faction != Gates[gate][EGateFaction])
		{
			SendClientMessage(playerid, X11_TOMATO_2, "You don't have access to that gate");
			return 1;
		}
	}



Re: House - Puff - 13.09.2017

Issue fixed, +REP


Re: House - Puff - 13.09.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
There is no "else" I see, You said that if the Player is not the owner or Doesn't have the house key, send him the message of But What if he has got the keys or he is the house owner? You haven't created a case for it.
btw is it possible to add 2 SQL ids? like create a second enum and add the sql id of the second house to access that gate aswell?


Re: House - JasonRiggs - 13.09.2017

Quote:
Originally Posted by Puff
Посмотреть сообщение
btw is it possible to add 2 SQL ids? like create a second enum and add the sql id of the second house to access that gate aswell?
It would be same like "House Keys" which you've got in your script, You can take help from it to create that system.

And create an extra column in the gates to make it look like that "Owner, Guy got an access, etc..."