Entrance System: Wanting to link two different entrances together
#1

Hi there. This is probably going to be a pretty long topic. I need some ideas in how to script this.

I have an entrance system, which allows people to enter an entrance say for example the front of LSPD and it'll put them in the LSPD interior at the front.

I also have another entrance which is LSPD Garage from the garage and it puts you in the same virtual world and all that but it spawns you in the LSPD interior at the back.

What I'm wanting to do is have it so that whatever entrance you came in. Only Entrance Type 6 (LSPD FRONT) and 11(LSPD BACK) to be able to enter and exit wherever you like.

Here are my codes that I have.

PHP код:
Entrance_Inside(playerid)
{
    if (
PlayerData[playerid][pEntrance] != -1)    
    {
        for (new 
0!= MAX_ENTRANCES++) if (EntranceData[i][entranceExists] && EntranceData[i][entranceID] == PlayerData[playerid][pEntrance] && GetPlayerInterior(playerid) == EntranceData[i][entranceInterior] && GetPlayerVirtualWorld(playerid) == EntranceData[i][entranceWorld])
            return 
i;
    }
    return -
1;
}
Entrance_GetLink(playerid)
{
    if (
GetPlayerVirtualWorld(playerid) > 0)
    {
        for (new 
0!= MAX_ENTRANCES++) if (EntranceData[i][entranceExists] && EntranceData[i][entranceID] == GetPlayerVirtualWorld(playerid) - 7000)
            return 
EntranceData[i][entranceID];
    }
    return -
1;
}
Entrance_Nearest(playerid)
{
    for (new 
0!= MAX_ENTRANCES++) if (EntranceData[i][entranceExists] && IsPlayerInRangeOfPoint(playerid2.5EntranceData[i][entrancePos][0], EntranceData[i][entrancePos][1], EntranceData[i][entrancePos][2]))
    {
        if (
GetPlayerInterior(playerid) == EntranceData[i][entranceExterior] && GetPlayerVirtualWorld(playerid) == EntranceData[i][entranceExteriorVW])
            return 
i;
    }
    return -
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
newkeys KEY_SECONDARY_ATTACK)
     {
        static
            
id = -1;
        if ((
id Entrance_Nearest(playerid)) != -1)
        {
            if (
EntranceData[id][entranceLocked])
                return 
SendErrorMessage(playerid"This entrance is locked at the moment.");
            if (
PlayerData[playerid][pTask])
            {
                if (
EntranceData[id][entranceType] == && !PlayerData[playerid][pBankTask])
                {
                    
PlayerData[playerid][pBankTask] = 1;
                    
Dialog_Show(playeridShowOnlyDIALOG_STYLE_MSGBOX"Banking""This is one of the banks of San Andreas. You can manage your bank accounts here.\nEach player has a standard bank account and a savings account for extra funds.\n\nYou can type /bank inside this building to manage either of your bank accounts.\nIf you are near any ATM machine, you can use the /atm command for your banking needs.""Close""");
                    if (
IsTaskCompleted(playerid))
                    {
                        
PlayerData[playerid][pTask] = 0;
                        
ShowPlayerFooter(playerid"You have ~g~completed~w~ all your tasks!");
                    }
                }
                else if (
EntranceData[id][entranceType] == && !PlayerData[playerid][pTestTask])
                {
                    
PlayerData[playerid][pTestTask] = 1;
                    
Dialog_Show(playeridShowOnlyDIALOG_STYLE_MSGBOX"DMV""The DMV is where a player can attempt the driving test to obtain their licenses.\nYou must avoid hitting obstacles, damaging the vehicle or speeding during the test.\n\nIt is legally required to possess a driving license to drive in San Andreas.\nDriving without a license can result in several consequences by law enforcement.""Close""");
                    if (
IsTaskCompleted(playerid))
                    {
                        
PlayerData[playerid][pTask] = 0;
                        
ShowPlayerFooter(playerid"You have ~g~completed~w~ all your tasks!");
                    }
                }                    
            }
            if (
EntranceData[id][entranceCustom])
                
SetPlayerPosEx(playeridEntranceData[id][entranceInt][0], EntranceData[id][entranceInt][1], EntranceData[id][entranceInt][2]);
            else
                
SetPlayerPos(playeridEntranceData[id][entranceInt][0], EntranceData[id][entranceInt][1], EntranceData[id][entranceInt][2]);
            
SetPlayerFacingAngle(playeridEntranceData[id][entranceInt][3]);
            
SetPlayerInterior(playeridEntranceData[id][entranceInterior]);
            
SetPlayerVirtualWorld(playeridEntranceData[id][entranceWorld]);
            
SetCameraBehindPlayer(playerid);
            
PlayerData[playerid][pEntrance] = EntranceData[id][entranceID];
            return 
1;
        }
        if ((
id Entrance_Inside(playerid)) != -&& IsPlayerInRangeOfPoint(playerid2.5EntranceData[id][entranceInt][0], EntranceData[id][entranceInt][1], EntranceData[id][entranceInt][2]))
        {
            if (
EntranceData[id][entranceCustom])
                
SetPlayerPosEx(playeridEntranceData[id][entrancePos][0], EntranceData[id][entrancePos][1], EntranceData[id][entrancePos][2]);
            else
                
SetPlayerPosEx(playeridEntranceData[id][entrancePos][0], EntranceData[id][entrancePos][1], EntranceData[id][entrancePos][2]);
            
SetPlayerFacingAngle(playeridEntranceData[id][entrancePos][3] - 180.0);
            
SetPlayerInterior(playeridEntranceData[id][entranceExterior]);
            
SetPlayerVirtualWorld(playeridEntranceData[id][entranceExteriorVW]);
            
SetCameraBehindPlayer(playerid);
            
PlayerData[playerid][pEntrance] = Entrance_GetLink(playerid);
            return 
1;
        } 
I think my brain just isn't working. But I need to be able to check and see if the entrance that the player is equal to type 6 or 11 and if it is, I need to get the opposite ID, and change it to that. And check if it's in range of that exit position.

I hope this makes sense.
Reply
#2

Any suggestions please? Is no one understanding this? BUMP.
Reply
#3

Please elaborate more.
Reply
#4

Okay, so I have an entrance system. I would like to know what you guys suggest in order to detect if a player is in two different types of entrances. Since entrances are categorized by types.

Код:
0: None | 1: DMV | 2: Bank | 3: Warehouse | 4: City Hall | 5: Shooting Range |	6: Police Department | 7: Strip Club, 8: Gas Station | 9: Sex Shop | 10: Gym | 11: LS PD Exit
I want people that go in through Type 6. The Police Department Entrance, to also be able to exit out of Type 11, and spawn at the specific Entrance External X, Y, Z in the basement.

So if a player is in a Type 6, it should be checking to see when the player wants to exit (Press F) that if the entrance INT X,Y,Z of both Type 6 and Type 11 is close to them. If either is close then it exits out of the closest one.

Is that enough of an elaboration?
Reply
#5

I dont realy get it.

Basicly you have 2 enters and 2 exits outside and inside the LSPD.

Now you want that the player can enter from the garage and is able to exit trough the main entrance && the garage entrance.

Am i right?
Reply
#6

Yes. That's correct
Reply
#7

Your code looks fine to me so what is the actual problem?
Reply
#8

Well when you go into a specific entrance the only exit it'll let you go out of the entrance you entered.

So I need to figure a way of being able to exit through an exit that isn't specific to the entrance
Reply
#9

Okay but where u stuck?
Code seems legit.
Reply
#10

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
Okay but where u stuck?
Code seems legit.
When inside I did some checks and it will not even check if a player is near a different exit. Once a player enters an entrance it will only look for that specific entrance exit points and nothing else.

Quote:
Originally Posted by TwentyFour
Посмотреть сообщение
'static' remembers its old value.
And that is why he is exiting from the same entrance or whatever..
Do you suggest changing it to new?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)