[Tutorial] Smart use of the Streamer [Incognito]
#10

Quote:
Originally Posted by Sioux
View Post
Can you give us example when player can enter and EXIT house pls ?
I use pickups for houses (blue and green house icon) and have set extra ID as "MAX_HOUSES + index" for each house pickup on loading. Retrieving the house and entering/exiting without loops is very simple afterwards.
PHP Code:
// global:
new gPlayer_InHouse[MAX_PLAYERS];
// OnPlayerConnect:
gPlayer_InHouse[playerid] = -1;
// OnPlayerPickUpDynamicPickup:
switch (Streamer_GetIntData(STREAMER_TYPE_PICKUPpickupidE_STREAMER_MODEL_ID))
{
    case 
12721273:
    {
        
// getting the "index" of the house to access the array
        
new houseid Streamer_GetIntData(STREAMER_TYPE_PICKUPpickupidE_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;
        }
    }

PS: There are two pickups, one for interior and the other for exterior. You may keep the one that enters the building and on pressing ENTER or any other key making the player to exit (you have the houseid already anyway).
Reply


Messages In This Thread
Smart use of the Streamer [Incognito] - by Jingles - 09.07.2016, 20:49
Re: Smart use of the Streamer [Incognito] - by Jingles - 09.07.2016, 20:54
Re: Smart use of the Streamer [Incognito] - by Abagail - 09.07.2016, 20:55
Re: Smart use of the Streamer [Incognito] - by Luis- - 09.07.2016, 21:16
Re: Smart use of the Streamer [Incognito] - by Crayder - 09.07.2016, 21:19
Re: Smart use of the Streamer [Incognito] - by PrO.GameR - 09.07.2016, 22:44
Re: Smart use of the Streamer [Incognito] - by RIDE2DAY - 05.08.2016, 18:42
Re: Smart use of the Streamer [Incognito] - by Jingles - 06.08.2016, 09:44
Re: Smart use of the Streamer [Incognito] - by Sioux - 06.08.2016, 16:41
Re: Smart use of the Streamer [Incognito] - by Konstantinos - 06.08.2016, 17:06
Re: Smart use of the Streamer [Incognito] - by zsoolt997 - 11.08.2016, 16:15

Forum Jump:


Users browsing this thread: 1 Guest(s)