PDA

View Full Version : Entering a Interior


ChandraLouis
27/04/2017, 12:39 PM
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.

AndreiWow
27/04/2017, 12:52 PM
Use this: http://wiki.sa-mp.com/wiki/CreatePickup to create the pickup at the location that you want.

And use this: http://wiki.sa-mp.com/wiki/OnPlayerKeyStateChange to TP him when he presses F, again do a check using http://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint to see if he is at the position that you placed the Pickup.

ChandraLouis
27/04/2017, 01:40 PM
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.

iGetty
27/04/2017, 01:56 PM
#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.

ChandraLouis
27/04/2017, 02:07 PM
Well, i've changed the Pickup place in front of Cluckin Bell, then it teleported me to no where.
http://i.imgur.com/p7f7gxy.png
http://i.imgur.com/2JEv44H.png

iGetty
27/04/2017, 02:08 PM
Show the code you've change to please. (Firstly, try setting the SetPlayerInterior to the correct interior that you're using, if changing)

ChandraLouis
27/04/2017, 02:10 PM
Here's the 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;
}

iGetty
27/04/2017, 02:21 PM
Works perfectly fine using this 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.

ChandraLouis
27/04/2017, 02:42 PM
I don't know man, that's really not working for me.