OnplayerKey
#1

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
Reply
#2

"Activate a command" ? Explain more...
Reply
#3

For example either send client message, or move an object?
Reply
#4

Quote:
Originally Posted by Jack-
View Post
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
PHP Code:
if 
?

Try this one:
PHP Code:
#include <a_samp>
#define COLOR_BLUE 0x00FF00FF
#define COLOR_RED 0xFF0000FF
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
newkeys == KEY_LOOK_BEHIND)
     {
          if(
IsPlayerInRangeOfPoint(playerid,5.02030.6146,1896.3336,12.1973))
        {
            
SendClientMessage(playeridCOLOR_BLUE"TEST COMPLETE");
            return 
1;
        }
        else
        {
            
SendClientMessage(playerid,COLOR_RED"error");
        }
        return 
1;
      }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)