Keys problems
#1

Hi, i got some problems with updown keys.
Код:
forward keytimer();
then
Код:
	if(strcmp(cmd, "/test", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
         SetTimer("keytimer",1000,1);
         }
       return 1;
       }
Код:
public keytimer()
{
new keys, updown, leftright;
  for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  {
    if(IsPlayerConnected(playerid))
    {
      GetPlayerKeys(playerid, keys, updown, leftright);

      if(updown == KEY_UP)
      {
        SendClientMessage(playerid, 0xFF0000AA, "UP");
      }
    }
  }
}
Now when i press that button it doesent detect that i press it. But when i put that code with keys in OnPlayerUpdate then detect but why it doesent now?
I need ths for textdraw box updating !
This is realy important to me and pls aneswer soon.Tnxxx (Sorry for bad language!)
Reply
#2

you have no returns in your function
Reply
#3

Can you give me an example because because my english is not well!tnx
Reply
#4

Try this script:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_UP) && (newkeys & KEY_DOWN))
    {
      //Script if button UP and button DOWN are pressed together
    }
    else if(newkeys & KEY_UP)
    {
      //Script if button UP is pressed
    }
    else if(newkeys & KEY_DOWN)
    {
      //Script if button DOWN is pressed
    }
    return 1;
}
More information: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
(PS: Doesn't speak English? Use ****** TRANSLATE! http://translate.******.com)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)