Ayuda con codigo
#1

Alguien me puede decir porque esto no funciona?
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10.0, 1182.5060,-1323.3358,13.5791) || !IsPlayerInRangeOfPoint(playerid, 10.0, 2029.8267,-1414.0364,16.9989) || !IsPlayerInRangeOfPoint(playerid, 7.0, 1605.5345,1823.2488,10.8203) || !IsPlayerInRangeOfPoint(playerid, 7.0, -2655.6201,627.4501,14.4531))
        return SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
Cuando estoy en el lugar pongo el comando y me sale que devo estar en el hospital, porque?
Reply
#2

pawn Код:
#define             PlayerToPoint(%1,%2,%3,%4,%5)       IsPlayerInRangeOfPoint(%2,%1,%3,%4,%5)
if(!PlayerToPoint(10.0, playerid, 1182.5060,-1323.3358,13.5791) || !PlayerToPoint(10.0, playerid, 2029.8267,-1414.0364,16.9989) || !PlayerToPoint(10.0, playerid, 1605.5345,1823.2488,10.8203) || !PlayerToPoint(10.0, playerid, -2655.6201,627.4501,14.4531))  return SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
Reply
#3

cambia || por &&
Reply
#4

Quote:
Originally Posted by JGomez97
Посмотреть сообщение
Alguien me puede decir porque esto no funciona?
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10.0, 1182.5060,-1323.3358,13.5791) || !IsPlayerInRangeOfPoint(playerid, 10.0, 2029.8267,-1414.0364,16.9989) || !IsPlayerInRangeOfPoint(playerid, 7.0, 1605.5345,1823.2488,10.8203) || !IsPlayerInRangeOfPoint(playerid, 7.0, -2655.6201,627.4501,14.4531))
        return SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
Cuando estoy en el lugar pongo el comando y me sale que devo estar en el hospital, porque?
Sуlo quitales los "!" a los dos IsPlayerInRangeOfPoint con ese signo al inicio indicas que por fuera de esa coordenada, algo asн es.
Reply
#5

Quote:
Originally Posted by Jose_grana
Посмотреть сообщение
pawn Код:
#define             PlayerToPoint(%1,%2,%3,%4,%5)       IsPlayerInRangeOfPoint(%2,%1,%3,%4,%5)
if(!PlayerToPoint(10.0, playerid, 1182.5060,-1323.3358,13.5791) || !PlayerToPoint(10.0, playerid, 2029.8267,-1414.0364,16.9989) || !PlayerToPoint(10.0, playerid, 1605.5345,1823.2488,10.8203) || !PlayerToPoint(10.0, playerid, -2655.6201,627.4501,14.4531))  return SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
їEn serio? Supongo que es una broma...

La soluciуn es como dice OTACON.
Reply
#6

Quote:
Originally Posted by Jose_grana
Посмотреть сообщение
pawn Код:
#define             PlayerToPoint(%1,%2,%3,%4,%5)       IsPlayerInRangeOfPoint(%2,%1,%3,%4,%5)
if(!PlayerToPoint(10.0, playerid, 1182.5060,-1323.3358,13.5791) || !PlayerToPoint(10.0, playerid, 2029.8267,-1414.0364,16.9989) || !PlayerToPoint(10.0, playerid, 1605.5345,1823.2488,10.8203) || !PlayerToPoint(10.0, playerid, -2655.6201,627.4501,14.4531))  return SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
Es lo mismo....

Quote:
Originally Posted by OTACON
Посмотреть сообщение
cambia || por &&
Muchas gracias me funciono.

Quote:
Originally Posted by DekaAlexander
Посмотреть сообщение
Sуlo quitales los "!" a los dos IsPlayerInRangeOfPoint con ese signo al inicio indicas que por fuera de esa coordenada, algo asн es.
Es lo que quiero, igual gracias man.

Quote:
Originally Posted by LiMPiTo
Посмотреть сообщение
їEn serio? Supongo que es una broma...

La soluciуn es como dice OTACON.
Tienes toda la razуn.
Reply
#7

Lo que estб haciendo esa funciуn es verificar si estб en cada uno(todos) de los puntos, їno serнa mejor hacerlo asн?
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1182.5060,-1323.3358,13.5791) || IsPlayerInRangeOfPoint(playerid, 10.0, 2029.8267,-1414.0364,16.9989) || IsPlayerInRangeOfPoint(playerid, 7.0, 1605.5345,1823.2488,10.8203) || IsPlayerInRangeOfPoint(playerid, 7.0, -2655.6201,627.4501,14.4531))
else SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
Lo que estб haciendo OTACON es utilizar '&&' que serнa 'y', es decir, si estб en el punto 1, el punto 2, el punto 3, y todos los demбs.
Reply
#8

Quote:
Originally Posted by xTexTx
Посмотреть сообщение
Lo que estб haciendo esa funciуn es verificar si estб en cada uno(todos) de los puntos, їno serнa mejor hacerlo asн?
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1182.5060,-1323.3358,13.5791) || IsPlayerInRangeOfPoint(playerid, 10.0, 2029.8267,-1414.0364,16.9989) || IsPlayerInRangeOfPoint(playerid, 7.0, 1605.5345,1823.2488,10.8203) || IsPlayerInRangeOfPoint(playerid, 7.0, -2655.6201,627.4501,14.4531))
else SendClientMessage(playerid,-1,"Necesitas estar en la entrada de un hospital.");
Lo que estб haciendo OTACON es utilizar '&&' que serнa 'y', es decir, si estб en el punto 1, el punto 2, el punto 3, y todos los demбs.
Lo que pasa es que quiero retornar el mensaje si no esta enfrente de algъn hospital , pero ya me funciona bien. Tambiйn se podrнa hacer de tu manera pero por alguna razуn se me hace menos confuso.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)