Problem
#1

Hello there everyonie i am trying to make onplayerstatchange i made one where i an press sprint so i can enter a building but now when i go in build i made a next code to make me exit the building but it wont work please help here the code
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if ((oldkeys & KEY_SPRINT) && !(newkeys & KEY_SPRINT))
        {
            if(IsPlayerInRangeOfPoint(playerid, 2.0, 1553.7203,-1675.6603,16.1953)) //replace with the position where to press the alt button
            {
            SetPlayerInterior(playerid, 10);
            SetPlayerPos(playerid, 246.40,110.84,1003.22);
            }
            return 1;
        }
        if ((oldkeys & KEY_SPRINT) && !(newkeys & KEY_SPRINT))
        {
            if(IsPlayerInRangeOfPoint(playerid, 2.0, 245.6786,107.3357,1003.2188)) //replace with the position where to press the alt button
            {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, 1553.7203,-1675.6603,16.1953);
            }
            return 1;
    }
        return 0;
    }
please help fix it
Reply
#2

2.0 radius is tiny, you likely aren't standing so close to the point. I'd increase it to at least 5 or 10. 2 is about the radius of a car wheel.
Reply
#3

can you write it out your self i tried no diferent
Reply
#4

Replace
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, 245.6786,107.3357,1003.2188))
with

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.5, 245.6786,107.3357,1003.2188))
...
Reply
#5

Omg man ur so awesome thanks
Reply
#6

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ( newkeys & KEY_SPRINT )
    {
        if( IsPlayerInRangeOfPoint( playerid, 7.5, 1553.7203,-1675.6603,16.1953 ) )
        {
            SetPlayerInterior( playerid, 10 );
            SetPlayerPos( playerid, 246.40,110.84,1003.22 );
        }
        else if( IsPlayerInRangeOfPoint( playerid, 7.5, 245.6786,107.3357,1003.2188 ) )
        {
            SetPlayerInterior( playerid, 0 );
            SetPlayerPos( playerid, 1553.7203,-1675.6603,16.1953 );
        }
        return true;
    }
    return false;
}
Reply
#7

Thank you so much
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)