SA-MP Forums Archive
Interior - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Interior (/showthread.php?tid=654134)



Interior - TechSil - 21.05.2018

Hello guys i need tut or help how can i create like when you at bank and press f/enter anything to go in and then teleport you into custom interior. Please help me


Re: Interior - DarkSkull - 21.05.2018

This is how you do it. Under the command called /enter, Check if the player is near a bank.

You can do this by using the function IsPlayerInRangeOfPoint();. The X, Y, Z coord of the function corresponds to the X, Y, Z coord of the bank entrance. Then under the if statement, Set the player pos and his interior.

A list of interior ids and location can be found here: CLICK ME

So in conclusion, Your code should look something like this.

PHP код:
if (strcmp("/enter"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playeridrangeFloat:xFloat:yFloat:z)) {
            
SetPlayerPos(playeridFloat:xFloat:yFloat:z);
            
SetPlayerInterior(playeridinteriorid);
        }
        return 
1;
    } 



Re: Interior - TechSil - 21.05.2018

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
This is how you do it. Under the command called /enter, Check if the player is near a bank.

You can do this by using the function IsPlayerInRangeOfPoint();. The X, Y, Z coord of the function corresponds to the X, Y, Z coord of the bank entrance. Then under the if statement, Set the player pos and his interior.

A list of interior ids and location can be found here: CLICK ME

So in conclusion, Your code should look something like this.

PHP код:
if (strcmp("/enter"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playeridrangeFloat:xFloat:yFloat:z)) {
            
SetPlayerPos(playeridFloat:xFloat:yFloat:z);
            
SetPlayerInterior(playeridinteriorid);
        }
        return 
1;
    } 
I didnt understand you at all


Re: Interior - DarkSkull - 21.05.2018

Quote:
Originally Posted by TechSil
Посмотреть сообщение
I didnt understand you at all
Do you know anything about scripting?


Re: Interior - TechSil - 21.05.2018

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
Do you know anything about scripting?
Not really


Re: Interior - DarkSkull - 22.05.2018

Quote:
Originally Posted by TechSil
Посмотреть сообщение
Not really
Okay, So I made a little error in the previous code. I misread your help.

Add this on top of your script.

PHP код:
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Then put this under OnPlayerKeyStateChange.

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_SECONDARY_ATTACK)) {
        if(
IsPlayerInRangeOfPoint(playerid3Float:xFloat:yFloat:z)) {
        
SetPlayerPos(playerid2315.952880,-1.618174,26.742187);
        
SetPlayerInterior(playerid0);
    }
    return 
1;

Change the Float:x, Float:y, Float:z to the coords in front of the bank.

If You don't know how to script, I suggest you start with the basics first. This forum is filled with a lot of tutorials, You can how to make anything here. I should also remind you, since you're new here, that Scripting Help section is for helping other people with their code, not making it for them. All the best!