Keys problems - 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: Keys problems (
/showthread.php?tid=136195)
Keys problems -
ivex - 23.03.2010
Hi, i got some problems with updown keys.
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!)
Re: Keys problems -
adsy - 23.03.2010
you have no returns in your function
Re: Keys problems -
ivex - 24.03.2010
Can you give me an example because because my english is not well!tnx
Re: Keys problems -
VirSpectorX - 24.03.2010
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)