SA-MP Forums Archive
Can someone explain me. - 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: Can someone explain me. (/showthread.php?tid=606454)



Can someone explain me. - Ritzy2K - 04.05.2016

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.


Re: Can someone explain me. - Logic_ - 04.05.2016

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;
}



Re: Can someone explain me. - Ritzy2K - 04.05.2016

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?


Re: Can someone explain me. - Logic_ - 04.05.2016

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.


Re: Can someone explain me. - Ritzy2K - 04.05.2016

Should I save each interior I'm using for house, their interior coord? And spawn player accordingly?


Re: Can someone explain me. - Logic_ - 04.05.2016

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.


Re: Can someone explain me. - Ritzy2K - 04.05.2016

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?


Re: Can someone explain me. - Logic_ - 04.05.2016

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?


Re: Can someone explain me. - Ritzy2K - 04.05.2016

I use 20 different interiors, I need to collect 20 different coords, is that what you mean?


Re: Can someone explain me. - Logic_ - 04.05.2016

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. -