Need help with replacing "F" key with /enter and /exit
#1

Fixed!
Reply
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
      if(newkeys & KEY_SECONDARY_ATTACK) // Enter / F key
      {
               if( lastPickup[playerid] != -1 || properties[lastPickup[playerid]][eType] > 0 ){
            new
                id = propPickups[lastPickup[playerid]],
                Float:x,
                Float:y,
                Float:z;

            GetPropertyEntrance( id, x, y, z );
            if( IsPlayerInRangeOfPoint( playerid, 3.0, x, y, z )){
                PutPlayerInProperty( playerid, id );
                SendClientMessage( playerid, 0x0BBF6AA, "[ PROPERTY: You have entered a property, type /exit to leave. ]");
                return 1;
            }
           else if( currentInt[playerid] > -1 && GetPlayerInterior(playerid) == GetPropertyInteriorId( currentInt[playerid] )){

            new id2 = currentInt[playerid];
            new Float:x2;
            new Float:y2;
            new Float:z2;
            new Float:a;

            // make sure they're near the exit before allowing them to exit.
            GetPropertyExit( id, x2, y2, z2 );
            if(!IsPlayerInRangeOfPoint(playerid,4.5,x2,y2,z2)) {
                SendClientMessage(playerid,0xFF0000AA, "[ ERROR: You must be near the property's entrance in order to use /exit ]");
                return 1;
            }

            a = GetPropertyEntrance( id2, x2, y2, z2 );
            SetPlayerPos( playerid, x2, y2, z2 );
            SetPlayerFacingAngle( playerid, a );
            SetPlayerInterior( playerid, 0 );
            SetPlayerVirtualWorld( playerid, 0 );
        }
        currentInt[playerid] = -1;
        return 1;
           }
      return 1;
}
Key state changes, and else if is your friend.
Reply
#3

Fixed!
Reply
#4

I updated my original reply, those warnings should be gone - however if they still aren't it's something wrong with YOUR script not mine.
Reply
#5

Fixed!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)