Question on switching /enter and /exit
#1

How would I make /enter and /exit to where I just do "F"
Reply
#2

you can use this
Код:
IsKeyJustDown(key, newkeys, oldkeys)
{
	if((newkeys & key) && !(oldkeys & key)) return 1;
	return 0;
}
then you would be able to detect if player is pressing their KEY_ENTER so use
Код:
if(IsKeyJustDown(KEY_ENTER, newkeys, oldkeys)
Reply
#3

Quote:
Originally Posted by Qeux
you can use this
Код:
IsKeyJustDown(key, newkeys, oldkeys)
{
	if((newkeys & key) && !(oldkeys & key)) return 1;
	return 0;
}
then you would be able to detect if player is pressing their KEY_ENTER so use
Код:
if(IsKeyJustDown(KEY_ENTER, newkeys, oldkeys)
well I want it to be F key so would I do KEY_F?
Reply
#4

I don't think you can detect the F key.
Reply
#5

Quote:
Originally Posted by backwardsman97
I don't think you can detect the F key.
sure you can, it's the same as the return (enter) key, so it's KEY_SECONDARY_ATTACK.
Reply
#6

Код:
C:\Documents and Settings\Austin\Desktop\LSL-RP\gamemodes\LSL-RP.pwn(15562) : error 017: undefined symbol "newkeys"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

Quote:
Originally Posted by Austin_Lynn
Код:
C:\Documents and Settings\Austin\Desktop\LSL-RP\gamemodes\LSL-RP.pwn(15562) : error 017: undefined symbol "newkeys"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
You need to put it in public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
Reply
#8

I still got error can you post everything I need lol using KEY_SECONDARY_ATTACK
Reply
#9

Quote:
Originally Posted by Austin_Lynn
I still got error can you post everything I need lol using KEY_SECONDARY_ATTACK
pawn Код:
public OnPlayerKeyStateChange(playerid, newstate, oldstate)
{
  if (IsKeyJustDown(KEY_SECONDARY_ATTACK, newkeys, oldkeys))
  {
    // put here your /enter stuff, ex.
    // IsPlayerToPoint(2.0, playerid, 0.0, 0.0, 0.0);
    // SetPlayerInteriour(playerid, 1);
    // SetPlayerPos(playerid, 0.0, 0.0, 0.0);
    // And put here your /exit stuff
  }
}
IsKeyJustDown:
pawn Код:
IsKeyJustDown(key, newkeys, oldkeys)
{
  if((newkeys & key) && !(oldkeys & key)) return 1;
  return 0;
}
Reply
#10

Thanks sooo much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)