[Ajuda] Press key
#1

Ola, tou tentando fazer com que quando o player chegue perto de uma caixa e ele apertar a tecla aparecera um dialog para ele, so que quando o player aperta a tecla nao acontece nada!

ai vai:

OnPlayerKeyStateChange:
PHP Code:
      if(PRESSED(KEY_NO))
    {
         if(
IsPlayerInRangeOfPoint(playerid2.0, -319.5000000,1049.1000000,19.3000000))
         if(
IsPlayerInRangeOfPoint(playerid2.0, -334.3999900,1050.2000000,18.7000000))
     {
     if(
Player[playerid][pegounacaixa] >= 2)
     {
    
SendClientMessage(playerid0xDE6847FFTranslate(Player[playerid][pIdioma], "[INFO]: Vocй jб pegou o maximo de items, espere o proximo respawn!!." ,"[INFO]: You've already got the maximum items, wait for the next respawn."));
      }
      else
     
ShowPlayerDialog(playeridDIALOG_HOSPITALDIALOG_STYLE_LIST,"Hospital","Bandage\nPainkiller\nBlood Bag\nMed Kit\nMorphine","Take","Close");
      }
    } 
OBS: Eu coloquei por comando e deu certo, mas com a tecla nao vai! alguem ajuda?


@Edit Bem, eu descobri que o erro esta aqui:

PHP Code:
     if(Player[playerid][pegounacaixa] >= 2)
     {
    
SendClientMessage(playerid0xDE6847FFTranslate(Player[playerid][pIdioma], "[INFO]: Vocй jб pegou o maximo de items, espere o proximo respawn!!." ,"[INFO]: You've already got the maximum items, wait for the next respawn."));
      } 
pois quando eu tiro isso pega normal, entгo onde eu devo colocar isso? eu quero que o pegue 2 items no maximo! eu acho que e pq isso ta no lugar errado mas nao sei onde colocar, alguem ajuda?
Reply
#2

UMA DICA CRIA UM TOPICO POR SEMANA... se tu fazer muito flood de duvida os cara vai ignorar igual no seu topico do dialog e do KEY se tu ja tinha perguntando antes pq ta perguntnado dnv?...
Cara... serio escuta o que eu to dizendo cada vez mais os cara para de responder o seu topico ate a hora que ninguem mais responder.
Reply
#3

Por que tu esta usando dois range um acima do outro?
Reply
#4

Quote:
Originally Posted by SkullFire
View Post
Por que tu esta usando dois range um acima do outro?
poque eu nao vou querer colocar so em 1 posiзao eu vou colocar em varias mas coloquei so em 2 para testar! para fazer em outra posiзao precisa criar outro tudo dnv ou pode ser assim pode ir?
Reply
#5

Nгo й assim que funciona. Os dois tem que estar dentro do if, fazendo a comparaзгo OU entre os mesmo.

edit
Na verdade, o cуdigo atй funcionaria no primeiro range, mas ai ele faria a verificaзгo do 2 range e voce nгo estaria lб, entгo, й ali que o cуdigo para.
Reply
#6

Use || para fazer uma verificaзгo se ele ta em um dos dois RANGE

|| = OU
&& = E

...
Reply
#7

tirei algumas chaves e foi!

mas nao tou conseguindo fazer a verificaзao dos 2! seria assim?:

PHP Code:
if(IsPlayerInRangeOfPoint(playerid2.0, -319.5000000,1049.1000000,19.3000000 || -319.5000000,1049.1000000,19.3000000)) 
na linha:
Quote:

../modulos/items.inc(1300) : warning 213: tag mismatch
../modulos/items.inc(1300) : warning 202: number of arguments does not match definition
../modulos/items.inc(1300) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Warnings.

@Edit Consegui, obrigado!
Reply
#8

Quote:
Originally Posted by PedroH
View Post
tirei algumas chaves e foi!

mas nao tou conseguindo fazer a verificaзao dos 2! seria assim?:

PHP Code:
if(IsPlayerInRangeOfPoint(playerid2.0, -319.5000000,1049.1000000,19.3000000 || -319.5000000,1049.1000000,19.3000000)) 
na linha:


@Edit Consegui, obrigado!
Code:
if((IsPlayerInRangeOfPoint(playerid, 2.0, -319.5000000,1049.1000000,19.3000000)) ||
 (IsPlayerInRangeOfPoint(playerid, 2.0, -334.3999900,1050.2000000,18.7000000)))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)