SA-MP Forums Archive
House System enter question - 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 System enter question (/showthread.php?tid=573401)



House System enter question - Zloto - 07.05.2015

I have a created a command that insert in db the info of the created house.

/createhouse <price> <interiorID>

Ok for now good when i enter the InteriorID it save the interior positions in the db for example

ID - 5 - 318.564971,1118.209960,1083.882812

When i enter in the house i use this

Код:
CMD:enter(playerid, params[])
{
		
 if(IsPlayerInRangeOfPoint(playerid, 2.0, HInfo[HouseCount][XPos], HInfo[HouseCount][YPos], HInfo[HouseCount][ZPos]))
 {
     SetPlayerPos(playerid, HInfo[HouseCount][IntXPos], HInfo[HouseCount][IntYPos], HInfo[HouseCount][IntZPos]);
	 SetPlayerInterior(playerid,HInfo[HouseCount][InteriorID]);
 }
 return 1;
}
But when 2 people from diferent houses enter with the same interior is it going to put hem on 1 place?


Re: House System enter question - Ahmad45123 - 07.05.2015

Yes it will, Use virtual worlds.

Like:
Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, HInfo[HouseCount][XPos], HInfo[HouseCount][YPos], HInfo[HouseCount][ZPos]))
 {
     SetPlayerPos(playerid, HInfo[HouseCount][IntXPos], HInfo[HouseCount][IntYPos], HInfo[HouseCount][IntZPos]);
	 SetPlayerInterior(playerid,HInfo[HouseCount][InteriorID]);
         SetPlayerVirtualWorld(playerid, HouseCount+1000);
 }
And when he /exit, Make sure to set his VW to HouseCount-1000.
That should fix it.

EDIT: Where is HouseCount ?.. is this code only a part of another code or that var is a global one :/ ?


Re: House System enter question - ZouHeR - 07.05.2015

use SetPlayerVirtualWorld
That happens because both players are in the same interior with the same virtual world


Re: House System enter question - Zloto - 07.05.2015

How can i fix this every time i enter the house?




Re: House System enter question - Ahmad45123 - 07.05.2015

Quote:
Originally Posted by Zloto
Посмотреть сообщение
How can i fix this every time i enter the house?

Try adding a 0.5 to the Z coordinate.


Re: House System enter question - Zloto - 07.05.2015

+rep