SA-MP Forums Archive
onplayerkeystatechange - 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: onplayerkeystatechange (/showthread.php?tid=562076)



onplayerkeystatechange - sn0p - 06.02.2015

Код:
	if( newkeys == KEY_SPRINT )
	{
    printf("IstrintiInformacija(%d);", playerid);
	TextDrawHideForPlayer(playerid, InformacijosDezute[playerid]);
	TextDrawDestroy(InformacijosDezute[playerid]);
	}
	return 1;
}
were is the problem pawn stop working(sublime text) after i put this -.-


Re: onplayerkeystatechange - Maximus0 - 06.02.2015

Код:
TextDrawHideForPlayer(playerid, InformacijosDezute[playerid]);
TextDrawDestroy(InformacijosDezute[playerid]);
A textdraw can't be playerid.


Re: onplayerkeystatechange - Sascha - 06.02.2015

Quote:
Originally Posted by Maximus0
Посмотреть сообщение
Код:
TextDrawHideForPlayer(playerid, InformacijosDezute[playerid]);
TextDrawDestroy(InformacijosDezute[playerid]);
A textdraw can't be playerid.
it can if you defined it like:
pawn Код:
new Text:Textdrawname[MAX_PLAYERS];
not sure why pawn is stopping but what I can tell you is:
You shouldn't check for keys like
pawn Код:
if(newkeys == KEY_SRPINT)
but use
pawn Код:
if(newkeys & KEY_SPRINT)
as this would detect if that key is any of the new keys.. If you check for == KEY_SPRINT it would mean ONLY that key, if you pressed another key (e.g. W) at the same time, it wouldn't work.


Re: onplayerkeystatechange - Maximus0 - 06.02.2015

Thanks for the info Sascha, I am just new to pawn.