How do I let keys return commands
#1

How do I listen to keys and let them return cmds?
For example:
I press F and the command /hi will happen.
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange Is this what you're looking for?
Reply
#3

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;
}
Reply
#4

Quote:

if (PRESSED(KEY_SECONDARY_ATTACK))
{
return cmd_enter(playerid, params);
}

It says undefined symbol params
Reply
#5

Quote:
Originally Posted by NicholasA
Посмотреть сообщение
It says undefined symbol params
Nevermind.
Reply
#6

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)