06.08.2016, 17:06
Quote:
Can you give us example when player can enter and EXIT house pls ?
|
PHP Code:
// global:
new gPlayer_InHouse[MAX_PLAYERS];
// OnPlayerConnect:
gPlayer_InHouse[playerid] = -1;
// OnPlayerPickUpDynamicPickup:
switch (Streamer_GetIntData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_MODEL_ID))
{
case 1272, 1273:
{
// getting the "index" of the house to access the array
new houseid = Streamer_GetIntData(STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_EXTRA_ID) - MAX_HOUSES;
if (gPlayer_InHouse[playerid] == -1) // player is not in any house, so this is "entering"
{
gPlayer_InHouse[playerid] = houseid;
// set position for interior of house.
SetPlayerPos(...);
}
else // player is in a house, so this is "exiting"
{
// set position for exterior of house and set some offset (for x, y) so the player won't be teleported on top of the pickup
SetPlayerPos(...);
gPlayer_InHouse[playerid] = -1;
}
}
}