How do I let keys return commands - 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: How do I let keys return commands (
/showthread.php?tid=438688)
How do I let keys return commands -
NicholasA - 21.05.2013
How do I listen to keys and let them return cmds?
For example:
I press F and the command /hi will happen.
Re: How do I let keys return commands -
Mystique - 21.05.2013
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange Is this what you're looking for?
Re: How do I let keys return commands -
Avi Raj - 21.05.2013
use this :-
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
CMD:hi(playerid, params[])
{
/// Your things
}
}
return 1;
}
Re: How do I let keys return commands -
NicholasA - 21.05.2013
Quote:
if (PRESSED(KEY_SECONDARY_ATTACK))
{
return cmd_enter(playerid, params);
}
|
It says undefined symbol params
Re: How do I let keys return commands -
Mystique - 21.05.2013
Quote:
Originally Posted by NicholasA
It says undefined symbol params
|
Nevermind.
Re: How do I let keys return commands -
Littlehelper - 21.05.2013
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SECONDARY_ATTACK))
{
CMD:hi(playerid, params[])
{
/// Your things
}
}
return 1;
}
....There is no "params" defined in the callback so how are you using it without defining it?