little help please
#1

hey scripters
so i got this
Код:
public OnPlayerUpdate(playerid)
{
    new Keys,ud,lr;
    GetPlayerKeys(playerid,Keys,ud,lr);
    //////////////////////////////////////////////////////////////////////// enter
    if(Keys == KEY_JUMP)
	{
	    if(IsPlayerInRangeOfPoint(playerid,5.0,1555.2797851563,-1675.5520019531,16.716053009033))
	    {
	        SetPlayerInterior(playerid,6);
	       	SetPlayerPos(playerid,246.5975,65.4092,1003.6406);
	        GameTextForPlayer(playerid,"LSPD",3000,1);
	    }
 	    else if(IsPlayerInRangeOfPoint(playerid,5.0,1833.7420654297,-1842.4602050781,14.098865509033))
	    {
	        SetPlayerInterior(playerid,4);
	        SetPlayerPos(playerid,-27.3297290802,-31.713777542114,1004.0572509766);
	        GameTextForPlayer(playerid,"24/7",3000,1);
	    }
 	    else if(IsPlayerInRangeOfPoint(playerid,5.0,2105.3913574219,-1806.4764404297,14.5546875))
	    {
	        SetPlayerInterior(playerid,9);
         	SetPlayerPos(playerid,364.88513183594,-11.74192237854,1002.4722900391);
	        GameTextForPlayer(playerid,"Pizza",3000,1);
		}
 		else if(IsPlayerInRangeOfPoint(playerid,5.0,1481.1466064453,-1772.1932373047,19.509523391724))
		{
		SetPlayerInterior(playerid,3);
	 	SetPlayerPos(playerid,387.0635,173.9490,1008.3828);
	 	GameTextForPlayer(playerid,"City Hall",3000,1);
		}
 		else if(IsPlayerInRangeOfPoint(playerid,5.0,1460.3770751953,-1010.1955566406,27.464490890503))
		{
		SetPlayerInterior(playerid,0);
	 	SetPlayerPos(playerid,2315.952880,-1.618174,26.742187);
	 	GameTextForPlayer(playerid,"Bank",3000,1);
		}
		
		
		////////////////////////////////////exit exit exit exit exit exit exit///////////////////////////////////
		
	    else if(IsPlayerInRangeOfPoint(playerid,5.0,246.90249633789,62.694629669189,1004.361328125))
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,1555.2797851563,-1675.5520019531,16.716053009033);
	    }
	    else if(IsPlayerInRangeOfPoint(playerid,5.0,-27.3297290802,-31.713777542114,1004.0572509766))
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,1833.7420654297,-1842.4602050781,14.098865509033);
	    }
	    else if(IsPlayerInRangeOfPoint(playerid,5.0,364.88513183594,-11.74192237854,1002.4722900391))
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,2105.3913574219,-1806.4764404297,14.5546875);
		}
		else if(IsPlayerInRangeOfPoint(playerid,5.0,389.91268920898,173.81463623047,1008.9827880859))
		{
		SetPlayerInterior(playerid,0);
		SetPlayerPos(playerid,1481.1466064453,-1772.1932373047,19.509523391724);
		}

		else if(IsPlayerInRangeOfPoint(playerid,5.0,2315.952880,-1.618174,26.742187))
		{
		SetPlayerInterior(playerid,0);
		SetPlayerPos(playerid,1460.3770751953,-1010.1955566406,27.464490890503);
		}
	}
	
 	return 1;
}
and under
OnPlayerCommandText
Код:
	if(strcmp("/enter",cmdtext,true,10) == 0) //ElkaBlazer
	{
	    if(IsPlayerInRangeOfPoint(playerid,5.0,1555.2797851563,-1675.5520019531,16.716053009033))
	    {
	        SetPlayerInterior(playerid,6);
	       	SetPlayerPos(playerid,246.5975,65.4092,1003.6406);
	        GameTextForPlayer(playerid,"LSPD",3000,1);
	    }
	    if(IsPlayerInRangeOfPoint(playerid,5.0,1833.7420654297,-1842.4602050781,14.098865509033))
	    {
	        SetPlayerInterior(playerid,4);
	        SetPlayerPos(playerid,-27.3297290802,-31.713777542114,1004.0572509766);
	        GameTextForPlayer(playerid,"24/7",3000,1);
	    }
	    if(IsPlayerInRangeOfPoint(playerid,5.0,2105.3913574219,-1806.4764404297,14.5546875))
	    {
	        SetPlayerInterior(playerid,9);
         	SetPlayerPos(playerid,364.88513183594,-11.74192237854,1002.4722900391);
	        GameTextForPlayer(playerid,"Pizza",3000,1);
		}
		if(IsPlayerInRangeOfPoint(playerid,5.0,1481.1466064453,-1772.1932373047,19.509523391724))
		{
		SetPlayerInterior(playerid,3);
	 	SetPlayerPos(playerid,387.0635,173.9490,1008.3828);
	 	GameTextForPlayer(playerid,"City Hall",3000,1);
		}

		if(IsPlayerInRangeOfPoint(playerid,5.0,1460.3770751953,-1010.1955566406,27.464490890503))
		{
		SetPlayerInterior(playerid,0);
	 	SetPlayerPos(playerid,2315.952880,-1.618174,26.742187);
	 	GameTextForPlayer(playerid,"Bank",3000,1);
		}
		


		return 1;
	}

	if(strcmp("/exit",cmdtext,true,10) == 0) //ElkaBlazer
	{
	    if(IsPlayerInRangeOfPoint(playerid,5.0,246.90249633789,62.694629669189,1004.361328125))
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,1555.2797851563,-1675.5520019531,16.716053009033);
	    }
	    if(IsPlayerInRangeOfPoint(playerid,5.0,-27.3297290802,-31.713777542114,1004.0572509766))
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,1833.7420654297,-1842.4602050781,14.098865509033);
	    }
	    if(IsPlayerInRangeOfPoint(playerid,5.0,364.88513183594,-11.74192237854,1002.4722900391))
	    {
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,2105.3913574219,-1806.4764404297,14.5546875);
		}
		if(IsPlayerInRangeOfPoint(playerid,5.0,389.91268920898,173.81463623047,1008.9827880859))
		{
		SetPlayerInterior(playerid,0);
		SetPlayerPos(playerid,1481.1466064453,-1772.1932373047,19.509523391724);
		}

		if(IsPlayerInRangeOfPoint(playerid,5.0,2315.952880,-1.618174,26.742187))
		{
		SetPlayerInterior(playerid,0);
		SetPlayerPos(playerid,1460.3770751953,-1010.1955566406,27.464490890503);
		}

		return 1;
	}
so the thing with the /enter /exit works just fine . but when I press shift(jump key) it gets me into the interior then out then in then out and when i release it it just stays on the same place.
anyway my question is how can I do that when I press a key it gets me into the position I want.
Reply
#2

use
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_ACTION)
    {
        //do something here
    }
    return 1;
}
Note that you can change the key as you like.
Reply
#3

Well, the problem here, is that when you press JUMP_KEY ( to get inside ), it teleports you in the spot, where, if you are pressing JUMP_KEY, it teleports you outside ( if, IsPlayerInRangeOfPoint) ) ... I`m talking about:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,5.0,1555.2797851563,-1675.5520019531,16.716053009033))
        {
            SetPlayerInterior(playerid,6);
            SetPlayerPos(playerid,246.5975,65.4092,1003.6406);
            GameTextForPlayer(playerid,"LSPD",3000,1);
        }
and
pawn Код:
else if(IsPlayerInRangeOfPoint(playerid,5.0,246.90249633789,62.694629669189,1004.361328125))
        {
            SetPlayerInterior(playerid,0);
            SetPlayerPos(playerid,1555.2797851563,-1675.5520019531,16.716053009033);
        }
You see ? The first one, teleports you to the second (if( IsPlayerInRangeOfPoint) ).

Now, what you can do, is set the 'distance' in IsPlayerInRangeOfPoint, to 1.0 and change the coordinates, where it teleports you inside / outside.

For example, when you enter the building it would normally teleport you where is your /exit command location. Go in game and /save coordinates again, this time a bit further, like ... 2-3 meters away. Same with the exit.
Reply
#4

thank you guys.
really helped me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)