Enter without a command..
#1

So the problem is that it wont enter.. When I get close to the area that I want to enter nothing happens.
I have to idea where to put it so I've put it under OnPlayerSpawn.

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 1.5, 1833.7703,-1842.5039,13.5781))
    {
        SetPlayerPos(playerid, -25.884498, -185.868988, 1003.546875);
        SetPlayerInterior(playerid, 17);
        SetPlayerVirtualWorld(playerid, 1);
        SetCameraBehindPlayer(playerid);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1.5, -25.884498, -185.868988, 1003.546875))
    {
        SetPlayerPos(playerid, 1833.7703,-1842.5039,13.5781);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 1);
        SetCameraBehindPlayer(playerid);
    }
    return 0;
}
Reply
#2

Try this.

Sorry, I just finished helping out the other person.
When you're near the entrance, press the CROUCH('C') key.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.5, 1833.7703,-1842.5039,13.5781))
        {
            SetPlayerPos(playerid, -25.884498, -185.868988, 1003.546875);
            SetPlayerInterior(playerid, 17);
            SetPlayerVirtualWorld(playerid, 1);
            SetCameraBehindPlayer(playerid);
        }
        else if(IsPlayerInRangeOfPoint(playerid, 1.5, -25.884498, -185.868988, 1003.546875))
        {
            SetPlayerPos(playerid, 1833.7703,-1842.5039,13.5781);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 1);
            SetCameraBehindPlayer(playerid);
        }
    }  
    return 1;
}
Reply
#3

pawn Код:
forward CheckPlayer(playerid);

public OnGameModeInit()
{
    SetTimer("CheckPlayer",1000,true);
    return 1;
}

public CheckPlayer(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 1.5, 1833.7703,-1842.5039,13.5781))
    {
        SetPlayerPos(playerid, -25.884498, -185.868988, 1003.546875);
        SetPlayerInterior(playerid, 17);
        SetPlayerVirtualWorld(playerid, 1);
        SetCameraBehindPlayer(playerid);
    }
    if(IsPlayerInRangeOfPoint(playerid, 1.5, -25.884498, -185.868988, 1003.546875))
    {
        SetPlayerPos(playerid, 1833.7703,-1842.5039,13.5781);
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 1);
        SetCameraBehindPlayer(playerid);
    }
    // do not put the return 1; here don't do that @@ 1 second will check player!!
}
Reply
#4

xganyx why use a timer for this? it'll just teleport him between the two interiors. The 2nd reply will work as well minus the limbo effect between two places.
Reply
#5

I don't know?... Use that 1 second it will check player if(IsPlayerInRangeOfPoint(playerid, 1.5, 1833.7703,-1842.5039,13.5781)) then if is player in that range then set player position...
Reply
#6

Yeah, but when the person teleports to the location, it will teleport them back to the first location.

You enter at point A.
You come out at point B.

Point A & B are both in the CheckPlayer function as the person wants people to both enter/exit positions without typing a command so you just keep getting teleported around.
Reply
#7

I'm understand! Thanks
Reply
#8

EiresJason's method works but isn't it possible to just enter the building without pressing a key?
Or make it press the "W" key? I tried "KEY_UP" but didn't work.
I did just notice that when I put in "KEY_UP" it makes the RMB work but the RMB is for aiming when KEY_UP suppose to be "W".

NVM: Directional keys do not trigger OnPlayerKeyStateChange (up/down/left/right).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)