Posts: 1,547
Threads: 122
Joined: Jun 2014
Reputation:
0
I have made an house system, can someone explain me how do I add house spawn? Player can toggle or un-toggle. I'm not sure. A little explanation will get me started, thanks.
Posts: 1,506
Threads: 13
Joined: Jun 2015
Save the data in enums using MySQL
pawn Код:
OnPlayerSpawn(playerid)
{
if(HouseSpawn[playerid] == 1) // load the variable data from the DB.
{
SetPlayerPos(dedededed); // set their pos
...... // other code
}
else
{
SetPlayerPos(dedededede);
.......
}
return 1;
}
Posts: 1,547
Threads: 122
Joined: Jun 2014
Reputation:
0
You don't get my point, how do I make sure they spawn in their house? Even though 2 houses might be using same interior they aren't spawned in same house?
Posts: 1,506
Threads: 13
Joined: Jun 2015
Virtual World, use it. If player ID (MySQL ID) is 0, add += 1 and set their virtual world.
EDIT: After they login, show them a dialog to spawn in house 1 or 2.
Posts: 1,547
Threads: 122
Joined: Jun 2014
Reputation:
0
Should I save each interior I'm using for house, their interior coord? And spawn player accordingly?
Posts: 1,506
Threads: 13
Joined: Jun 2015
Quote:
Originally Posted by [ND]xXZeusXx.
Should I save each interior I'm using for house, their interior coord? And spawn player accordingly?
|
Nope, Get player house from the DB, in your script you should have got the interior and pos of the house, and there must be house ids, use them.
Posts: 1,547
Threads: 122
Joined: Jun 2014
Reputation:
0
I do have interior of the house, but I don't have specific position inside the house, for example. I want to spawn them in bedroom if they've enabled house spawn. So I should collect the coords of the interior right?
Posts: 1,506
Threads: 13
Joined: Jun 2015
Ofcourse Zeus, but you will need to collect of few houses as players will be using the default interiors of the houses, won't they be?
Posts: 1,547
Threads: 122
Joined: Jun 2014
Reputation:
0
I use 20 different interiors, I need to collect 20 different coords, is that what you mean?
Posts: 1,506
Threads: 13
Joined: Jun 2015
Yes, and use a function that detect the player house ids and the interior ids, if id is equal to something, set their pos according to it.
EDIT: different virtual worlds are different universe, so it won't mix up the players furniture and two players who own different house but same interior won't spawn in the same vworld but will spawn in the same interior.
- while others avoid to post shits unless they got something else to say. -