isplayerinrangepoint Problem
#1

i just trying do it:
pawn Код:
else if(newkeys == KEY_FIRE){
         if(IsPlayerInRangeOfPoint(playerid, 2.4, -1343.5695,-210.2208,14.1484))
        {
        new str[86];
       format(str, sizeof(str), "Weapons","AK47\n\nM4");
       ShowPlayerDialog(playerid, DialogBoxEx, DIALOG_STYLE_MSGBOX, "Weapons", str, "Ok", "Ok");
       }
       return 1;
       }
but when i go to this location, and press key fire, not show. what is wrong or what are left?
Reply
#2

Код:
else if(newkeys == KEY_FIRE)
Quote:
Originally Posted by Wiki
How NOT to check for a key

Let's presume that you want to detect when a player presses their FIRE button, the obvious code would be:
if (newkeys == KEY_FIRE)
This code may even work in your testing, but it is wrong and your testing is insufficient. Try crouching and pressing fire - your code will instantly stop working. Why? Because "newkeys" is no longer the same as "KEY_FIRE", it is the same as "KEY_FIRE" COMBINED WITH "KEY_CROUCH".
Use
Код:
if(newkeys & KEY_FIRE)
I don't think the else is necessary either.
Reply
#3

Not work yet
Reply
#4

Show the full OnPlayerKeyStateChange.
Reply
#5

pawn Код:
if(newkeys & KEY_FIRE){
         if(IsPlayerInRangeOfPoint(playerid, 2.4, -1343.5695,-210.2208,14.1484))
        {
        new str[86];
       format(str, sizeof(str), "Weapons","AK47\n\nM4");
       ShowPlayerDialog(playerid, DialogBoxEx, DIALOG_STYLE_MSGBOX, "Weapons", str, "Ok", "Ok");
       }
       return 1;
       }
Dialog called:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(dialogid == DialogBoxEx)
    {
   if(response)
    {
    if(listitem == 0)
    {
    GiveItem[playerid][MED_KIT] = 1;
    }
    if(listitem == 1)
    {
    GiveItem[playerid][binoculars] = 1;
    }
    if(listitem == 2)
        {
    GiveItem[playerid][bandage] = 1;
    }
    if(listitem == 3)
    {
    GiveItem[playerid][AK47] = 1;
    }
    if(listitem == 4)
    {
    GiveItem[playerid][M4A1] = 1;
    }
    if(listitem == 5)
    {
    GiveItem[playerid][MAP] = 1;
    }
    if(listitem == 6)
    {
    GiveItem[playerid][FULL_BOTTLE] = 1;
   }
  }
 }
Reply
#6

Is that everything you have under OnPlayerKeyStateChange?
Reply
#7

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Is that everything you have under OnPlayerKeyStateChange?
this dialog that does not appear yes.
Reply
#8

I'm not only talking about the dialog, show the full OnPlayerKeyStateChange code.
Reply
#9

Fixed ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)