OnplayerKey - 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: OnplayerKey (
/showthread.php?tid=268764)
OnplayerKey -
Jack- - 13.07.2011
How do I activate a command if the player is in range of point and pressed the right key?
im trying this
pawn Code:
if (newkeys == KEY_LOOK_BEHIND)
{
if IsPlayerInRangeOfPoint(playerid, 2030.6146,1896.3336,12.1973)
{
SendClientMessage(playerid, COLOR_BLUE, "TEST COMPLETE");
}
else
{
SendClientMessage(playerid,COLOR_RED, "error");
}
return 1;
}
idk what to do
Re: OnplayerKey -
Famalamalam - 13.07.2011
"Activate a command"
? Explain more...
Re: OnplayerKey -
Jack- - 13.07.2011
For example either send client message, or move an object?
Re: OnplayerKey -
[MG]Dimi - 13.07.2011
Quote:
Originally Posted by Jack-
How do I activate a command if the player is in range of point and pressed the right key?
im trying this
pawn Code:
if (newkeys == KEY_LOOK_BEHIND) { if IsPlayerInRangeOfPoint(playerid, 2030.6146,1896.3336,12.1973) { SendClientMessage(playerid, COLOR_BLUE, "TEST COMPLETE"); } else { SendClientMessage(playerid,COLOR_RED, "error"); } return 1; }
idk what to do
|
For example you can fix your script. Like missing brackets after
?
Try this one:
PHP Code:
#include <a_samp>
#define COLOR_BLUE 0x00FF00FF
#define COLOR_RED 0xFF0000FF
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys == KEY_LOOK_BEHIND)
{
if(IsPlayerInRangeOfPoint(playerid,5.0, 2030.6146,1896.3336,12.1973))
{
SendClientMessage(playerid, COLOR_BLUE, "TEST COMPLETE");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED, "error");
}
return 1;
}
return 1;
}