SA-MP Forums Archive
Teleport on keypress? - 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: Teleport on keypress? (/showthread.php?tid=632855)



Teleport on keypress? - DomagojSellug - 20.04.2017

I'm currently working on a private server of my own, probably not going to release the script, but I need help.
I made a 'fake interior', and I need to make it when a player is it at the door, when they press F to make them teleport to this fake interior I made.

Not so important, but how to make a triangle appear at the door like it does in the original game?

REP+ for helping.



Re: Teleport on keypress? - coool - 20.04.2017

Do you mean the yellow triangle, animated, which can be disabled ?? I NEED it too !


Re: Teleport on keypress? - DomagojSellug - 20.04.2017

Quote:
Originally Posted by coool
Посмотреть сообщение
Do you mean the yellow triangle, animated, which can be disabled ?? I NEED it too !
That's optional. My main need is the script that teleports you when you're at a certain spot and you press 'F'.


Re: Teleport on keypress? - coool - 20.04.2017

Use OnPlayerKeyPressed, check if is player in range of point, and teleport it to wherever you want. Understood?


Re: Teleport on keypress? - Bolex_ - 20.04.2017

You mean like this ?

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if (PRESSED(KEY_SECONDARY_ATTACK))
        {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, Your coordinates)) //Is near doors for enter
                {
                        SetPlayerPos(playerid, Your coordinates); //Set player position inside interior
                }
                if(IsPlayerInRangeOfPoint(playerid, 2.0, Your coordinates)) //Is near interior exit doors
                {
                        SetPlayerPos(playerid, Your coordinates); //Set player position to enter doors
                }
        }
        return 1;
}



Re: Teleport on keypress? - DomagojSellug - 20.04.2017

Quote:
Originally Posted by Bolex_
Посмотреть сообщение
You mean like this ?

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if (PRESSED(KEY_SECONDARY_ATTACK))
        {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, Your coordinates)) //Is near doors for enter
                {
                        SetPlayerPos(playerid, Your coordinates); //Set player position inside interior
                }
                if(IsPlayerInRangeOfPoint(playerid, 2.0, Your coordinates)) //Is near interior exit doors
                {
                        SetPlayerPos(playerid, Your coordinates); //Set player position to enter doors
                }
        }
        return 1;
}
You are officially my savior.
<3
REP+