Tengo dos dudas
#1

Publique para sacarme la duda necesito saber(quiero saber que funciуn se usa)para detectar que estoy cerca de un coche(tengo en mente un guardado e tunning y otras cosas xD) y una funcion para cuando mantenga pulsada la letra N por asi decirlo aparezca un textdraw y al soltarla se desaparezca.Seria asi?


onplayerkeychange
pawn Код:
if ((newkeys & KEY_NO)
{
//Textdrawforplayer ect
}

if !(oldkeys & KEY_NO))

{
//Texthideforplayer ect
}
Gracias de antemano
Reply
#2

Tъ puedes crear esa funciуn usando GetPlayerPos y GetVehiclePos.
Reply
#3

Ya me di una idea..Creare un stock que tome la posicion del jugador y la del vehiculo y compruebe si estan cerca .Muchas gracias junkbuster eres pro
Reply
#4

Para la Primera duda, Puedes usar el Proxdetector. Yo lo uso para Hacer esto.

u como dice JunkBuster, Puedes hacer una funciуn usando GetPlayerPos y GetVehiclePos. Aquн te la hise:

Код:
stock CercadelAuto(playerid, vehicleid)
{
static Float:x[3], Float:xN[3], Float:Distancia;
GetPlayerPos(playerid, x[0], x[1], x[2]);
GetVehiclePos(vehicleid, xN[0], xN[1], xN[2]);
if(xN[2]-x[2]>15.0 || x[2]-xN[2]>15.0)return 0;
Distancia = floatsqroot(floatpower((x[0]-xN[0]), 2)+floatpower((x[1]-xN[1]), 2)+floatpower((x[2]-xN[2]), 2));
if(Distancia>100.0)return 0;
static Float:xZ[3], Float:rX[3], Float:T[3], Float:nY;
GetPlayerCameraPos(playerid, rX[0], rX[1], rX[2]);
GetPlayerCameraFrontVector(playerid, xZ[0], xZ[1], xZ[2]);
T[0] = xZ[0]*Distancia+rX[0];
T[1] = xZ[1]*Distancia+rX[1];
T[2] = xZ[2]*Distancia+rX[2];
if(xN[2]-T[2]>10.5 || T[2]-xN[2]>10.5)return 0;
if(Distancia<7.0)return 1;
nY=atan2((x[1]-T[1]), (x[0]-T[0]));
if(nY-42.0<(atan2((x[1]-xN[1]), (x[0]-xN[0])))<nY+42.0)return 1;
return 0;
}
Reply
#5

Gracias!me podrias decir como usarlo?por ejemplo yo hize

pawn Код:
if(CercadelAuto(playerid,Autito,2.0)) return SendClientMessage(playerid,-1,"No estбs cerca del auto");
y me da un warning xD
Reply
#6

Asi.

Код:
if(CercadelAuto(playerid, vehicleid)) 
{
// aqui lo que hara si esta.
return 1;
} else SendClientMessage(playerid,-1,"No estбs cerca del auto");
Reply
#7

Gracias men . funciono pero solo funciona cuando estoy arriba
pawn Код:
YCMD:prueba(playerid, params[], help)
{
if (help) SendClientMessage(playerid, 0xFF0000AA, "Hacer cosas estando cerca del coche!!"); // Esto no sale si se usa el comando
else
{
new string[80];
new vehicleid = GetPlayerVehicleID(playerid);
if(CercadelAuto(playerid, vehicleid))
{
format(string,sizeof(string),"[OOC]:Este coche es id %d",vehicleid);
Message(playerid, COLOR_WHITE, string);
// aqui lo que hara si esta.
return 1;
} else SendClientMessage(playerid,-1,"No estбs cerca del auto");
//if(CercadelAuto(playerid,Autito,2.0)) return SendClientMessage(playerid,-1,"No estбs cerca del objeto");
return 1;
}
return 1;
}

ayudame plis
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)