House System enter question
#1

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?
Reply
#2

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 :/ ?
Reply
#3

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

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

Reply
#5

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.
Reply
#6

+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)