Entering a Interior
#1

How can i make a pickup with ID 1318, and when player is in it and they press "F" to get enter Cluckin Bell?
And when they want to exit, they will need to Press "F" again.
The pickup will always there, without disappearing, here's the Cluckin' Bell Coords:
X = 365.7158
X = -9.8873
Y = 1001.8516

Need help desperately.
Reply
#2

Use this: https://sampwiki.blast.hk/wiki/CreatePickup to create the pickup at the location that you want.

And use this: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange to TP him when he presses F, again do a check using https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint to see if he is at the position that you placed the Pickup.
Reply
#3

Thanks for the reply.
I've created that already, but it just TPed me without even pressing F.
And also, it TPed to Blueberry Accress.
Reply
#4

pawn Code:
#include <a_samp>

public OnGameModeInit()
{
    CreatePickup(1318, 1, 1554.38, -1675.69, 16.195, 0); //This pickup is placed at LSPD, change to where you want it to be.
    return true;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_SECONDARY_ATTACK){
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 1554.38, -1675.69, 16.195)){ //When changing the pickup position, change this to the same coordinate <<<
            SetPlayerPos(playerid, 365.7158, -9.8873, 1001.8516); //Set their position as you stated
            SetPlayerInterior(playerid, 9); //Set them into interior ID 9 as that is the cluckin bell interior ID (Reference: http://weedarr.wikidot.com/interior)
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3.0, 365.7158, -9.8873, 1001.8516)){ //Check to see if they're near the interior doors
            SetPlayerPos(playerid, 1554.38, -1675.69, 16.195); //When changing the pickup position, change this to the same coordinate <<<
            SetPlayerInterior(playerid, 0); //Set them back to interior ID 0 so they're in the real world.
        }
    }
    return true;
}
If you need anymore details please let me know via this thread.
Reply
#5

Well, i've changed the Pickup place in front of Cluckin Bell, then it teleported me to no where.

Reply
#6

Show the code you've change to please. (Firstly, try setting the SetPlayerInterior to the correct interior that you're using, if changing)
Reply
#7

Here's the code:
pawn Code:
#include <a_samp>

public OnGameModeInit()
{
    CreatePickup(1318, 1, -1816.5437,618.0901,35.1719, 0);
    return true;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, -1816.5437,618.0901,35.1719))
        {
            SetPlayerPos(playerid, 364.8150,-11.6074,1001.8516);
            SetPlayerInterior(playerid, 9);
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3.0, 364.8150,-11.6074,1001.8516))
        {
            SetPlayerPos(playerid, -1816.5437,618.0901,35.1719);
            SetPlayerInterior(playerid, 0);
        }
    }
    return 1;
}
Reply
#8

Works perfectly fine using this code:

pawn Code:
#include <a_samp>

public OnGameModeInit()
{
    DisableInteriorEnterExits();

    CreatePickup(1318, 1, -1816.5437,618.0901,35.1719, 0);
    return true;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, -1816.5437,618.0901,35.1719))
        {
            SetPlayerPos(playerid, 364.8150,-11.6074,1001.8516);
            SetPlayerInterior(playerid, 9);
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3.0, 364.8150,-11.6074,1001.8516))
        {
            SetPlayerPos(playerid, -1816.5437,618.0901,35.1719);
            SetPlayerInterior(playerid, 0);
        }
    }
    return 1;
}
I went into the server, went to the coordinates and pressed F, it took me inside of the Cluckin Bell and set the interior right, came to the door and pressed F again and it took me to the outside of it, working fine? Strange issue if it's not working for you.
Reply
#9

I don't know man, that's really not working for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)