SA-MP Forums Archive
Ayuda Objetos,Vehiculos,Funcion... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Ayuda Objetos,Vehiculos,Funcion... (/showthread.php?tid=426914)



Ayuda Objetos,Vehiculos,Funcion... - OTACON - 30.03.2013

Buenas a Todos, alguien me podria decir como puedo verificar si un vehiculo esta encima de un objeto?.

de la forma correcta.

Desde ya muchas Gracias .


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - Fluid016 - 30.03.2013

mmm, no sй para que lo quieres verificar y cuando si dirнas un poco mбs te podrнa dar una mejor ayuda pero:

Podrнas obtener las posiciones del objeto y luego las del vehнculo y chequear si son aproximadamente iguales y si Z es mayor a la del objeto.


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - NeuZz - 30.03.2013

se crea un gz del perimetro del objeto y se toma la pocicion z del objeto, despues con un if verificas si el vehiculo esta en la gz y esta a sierta altura con respecto a la coordenada z.


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - xDarkuzSx - 31.03.2013

Podrias usar este callback:
pawn Код:
stock IsVehicleInRangeOfPoint(vehicleid, Float:radi, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
Poniendo las cordenadas del Objeto con una distancia mas o menos igual para que abarque todo el objeto..
saludos.


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - OTACON - 31.03.2013

Quote:
Originally Posted by xDarkuzSx
Посмотреть сообщение
Podrias usar este callback:
pawn Код:
stock IsVehicleInRangeOfPoint(vehicleid, Float:radi, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
Poniendo las cordenadas del Objeto con una distancia mas o menos igual para que abarque todo el objeto..
saludos.
esa es la ke estoy utilizando, pero no me funciona :S.


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - xDarkuzSx - 31.03.2013

їComo la estas utilizando..? Pasame el cуdigo..


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - OTACON - 31.03.2013

Quote:
Originally Posted by xDarkuzSx
Посмотреть сообщение
їComo la estas utilizando..? Pasame el cуdigo..
pawn Код:
for(new index=0; index<4; index++) {
    TextDrawShowForPlayer(playerid, TextOBJ[playerid][index]);
    GetObjectPos(VariableOBJ[index], PosOBJ[0], PosOBJ[1], PosOBJ[2]);
    for(new veh=0; veh<MAX_VEHICLES; veh++) {
        if(IsVehicleInRangeOfPoint(veh, 3.0, PosOBJ[0], PosOBJ[1], PosOBJ[2])) {
            TextDrawSetPreviewModel(TextOBJ[playerid][index], GetVehicleModel(veh));
        }
    }
}



Respuesta: Ayuda Objetos,Vehiculos,Funcion... - xDarkuzSx - 31.03.2013

Quote:
Originally Posted by bytytus
Посмотреть сообщение
pawn Код:
for(new index=0; index<4; index++) {
    TextDrawShowForPlayer(playerid, TextOBJ[playerid][index]);
    GetObjectPos(VariableOBJ[index], PosOBJ[0], PosOBJ[1], PosOBJ[2]);
    for(new veh=0; veh<MAX_VEHICLES; veh++) {
        if(IsVehicleInRangeOfPoint(veh, 3.0, PosOBJ[0], PosOBJ[1], PosOBJ[2])) {
            TextDrawSetPreviewModel(TextOBJ[playerid][index], GetVehicleModel(veh));
        }
    }
}
si el objeto esta muy grande necesitas aumentar el radio "3.0" por algo que abarque digamos casi todo el objeto..


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - OTACON - 31.03.2013

jaja, solucionado, nada mas era ke tenia ke poner el TextDrawSetPreviewModel primero y despues el TextDrawShowForPlayer , es ke estoy acostumbrado a usar TextDrawSetString ke actualiza el textdraw y sin embargo TextDrawSetPreviewModel establece no actualiza xD.

Bueno igual Gracias a todos .
Saludos.


Respuesta: Ayuda Objetos,Vehiculos,Funcion... - xDarkuzSx - 31.03.2013

Jaja quй bueno que lo hayas solucionado!