SA-MP Forums Archive
How do I create a spot to enter a certain 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: How do I create a spot to enter a certain interior... (/showthread.php?tid=388657)



How do I create a spot to enter a certain interior... - jakejohnsonusa - 29.10.2012

I am trying to allow players to enter a Sherrifs Station (INT 5- 322.197998,302.497985,999.148437) when they are near the point 627.4248, -571.8760, 17.8942 by pressing the vehicle enter key.

How do I do this for my GM? If someone could please write out how to do this that would be great!

Thanks: jakejohnsonusa


Re: How do I create a spot to enter a certain interior... - sgtjones12 - 29.10.2012

Here you go

http://lmgtfy.com/?q=How+to+make+ent...and+exits+samp


Re: How do I create a spot to enter a certain interior... - jakejohnsonusa - 29.10.2012

Thanks But I'm not a good scripter and that confused me even more... Would someone write this for me please. I usually +1 REP people who help me.

BTY sgtjones12 +1 Thanks for the tip...


Re: How do I create a spot to enter a certain interior... - sgtjones12 - 29.10.2012

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
Thanks But I'm not a good scripter and that confused me even more... Would someone write this for me please. I usually +1 REP people who help me.

BTY sgtjones12 +1 Thanks for the tip...
Thank you and Sure I will try to break the tutorial down for you. Are you using strcmp or ZCMD?


Re: How do I create a spot to enter a certain interior... - jakejohnsonusa - 29.10.2012

strcmp. And thanks that would be awesome!


Re: How do I create a spot to enter a certain interior... - sgtjones12 - 29.10.2012

Alright here is the code below
Код:
//Add the commands below under public OnPlayerCommandText as you see.

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, 627.4248, -571.8760, 17.8942))
        {
            SetPlayerPos(playerid, -322.197998,302.497985,999.148437);
            SetPlayerInterior(playerid, 5); // interior id
            SetPlayerVirtualWorld(playerid, 0); // change this if you want to any VirtualWorld
            SetCameraBehindPlayer(playerid);
        }
        return 1;
    }
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,2.0, -322.197998,302.497985,999.148437))
        {
            SetPlayerPos(playerid, 627.4248, -571.8760, 17.8942);
            SetPlayerInterior(playerid, 0);//leave 0
            SetPlayerVirtualWorld(playerid, 0); // leave 0
            SetCameraBehindPlayer(playerid);
            return 1;
        }
    }
    return 0;
}



Re: How do I create a spot to enter a certain interior... - jakejohnsonusa - 29.10.2012

Thx will test soon...


Re: How do I create a spot to enter a certain interior... - jakejohnsonusa - 29.10.2012

Is there a way to make it the enter vehicle exit vehicle key instead of /enter /exit?


Re: How do I create a spot to enter a certain interior... - sgtjones12 - 29.10.2012

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
Is there a way to make it the enter vehicle exit vehicle key instead of /enter /exit?
I have seen servers with the Enter/Exit Vehicle key aka "F" as the command to enter a door but i am not sure how to do that but i will ask someone ok.


Re: How do I create a spot to enter a certain interior... - tyler12 - 29.10.2012

PHP код:
#include <a_samp>

#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
PRESSED(KEY_SECONDARY_ATTACK))
    {
        if(
IsPlayerInRangeOfPoint(playerid2.0627.4248, -571.876017.8942))
        {
            
SetPlayerPos(playerid, -322.197998,302.497985,999.148437);
            
SetPlayerInterior(playerid5); 
            
SetPlayerVirtualWorld(playerid0); 
            
SetCameraBehindPlayer(playerid);
        }
        else if(
IsPlayerInRangeOfPoint(playerid,2.0, -322.197998,302.497985,999.148437))
        {
            
SetPlayerPos(playerid627.4248, -571.876017.8942);
            
SetPlayerInterior(playerid0);
            
SetPlayerVirtualWorld(playerid0);
            
SetCameraBehindPlayer(playerid);
        }
    }
    return 
1;