Question on switching /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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question on switching /enter and /exit (
/showthread.php?tid=75445)
Question on switching /enter and /exit -
Austin_Lynn - 01.05.2009
How would I make /enter and /exit to where I just do "F"
Re: Question on switching /enter and /exit -
Qeux - 01.05.2009
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)
Re: Question on switching /enter and /exit -
Austin_Lynn - 01.05.2009
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?
|
Re: Question on switching /enter and /exit -
Backwardsman97 - 01.05.2009
I don't think you can detect the F key.
Re: Question on switching /enter and /exit -
[nl]daplayer - 02.05.2009
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.
Re: Question on switching /enter and /exit -
Austin_Lynn - 02.05.2009
Код:
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.
Re: Question on switching /enter and /exit -
[nl]daplayer - 02.05.2009
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)
Re: Question on switching /enter and /exit -
Austin_Lynn - 02.05.2009
I still got error can you post everything I need lol using KEY_SECONDARY_ATTACK
Re: Question on switching /enter and /exit -
[nl]daplayer - 02.05.2009
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;
}
Re: Question on switching /enter and /exit -
Austin_Lynn - 02.05.2009
Thanks sooo much