SA-MP Forums Archive
Need help with replacing "F" key with /enter and /exit - 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: Need help with replacing "F" key with /enter and /exit (/showthread.php?tid=567530)



Need help with replacing "F" key with /enter and /exit - Sc0pion - 14.03.2015

Fixed!


Re: Need help with replacing "F" key with /enter and /exit - Abagail - 14.03.2015

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.


Re: Need help with replacing "F" key with /enter and /exit - Sc0pion - 14.03.2015

Fixed!


Re: Need help with replacing "F" key with /enter and /exit - Abagail - 14.03.2015

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.


Re: Need help with replacing "F" key with /enter and /exit - Sc0pion - 14.03.2015

Fixed!