![]() |
|
[AYUDA] Necesito adaptar esto - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: Other languages (https://forum.open.mp/forumdisplay.php?fid=23) +--- Forum: Spanish/Español (https://forum.open.mp/forumdisplay.php?fid=24) +---- Forum: Programación (https://forum.open.mp/forumdisplay.php?fid=51) +---- Thread: [AYUDA] Necesito adaptar esto (/showthread.php?tid=1098) |
[AYUDA] Necesito adaptar esto - BIOS - 2020-05-24 Buenas, Resulta que quiero poner este objeto en mi veh?culo de trabajo pero no se como hacerlo, si me mostrar?an un ejemplo se los agradecer?a. El objeto: [c?digo] nuevo myobject = CreateObject (19433,0,0, -1000,0,0,0,100); AttachObjectToVehicle (myobject, GetPlayerVehicleID (playerid), -0.000000, -1.875000,0.375000,0.000000,121.499954, -91.799980); [/ code] El veh?culo en el cual quiero montar el objeto: [c?digo] nuevo San_Andreas_Vehicles [] [San_Andreas_Vehicles_Info] = { // taxi ls {VEHICLE_TYPE_WORK, WORK_TAXI, 0, 420, 1792.5676, -1868.2953, 13.2887, 0.0000, 6, 1, 0}, }[/c?digo] RE: [AYUDA] Necesito adaptar esto - SKainer - 2020-05-24 No necesitas poner CreateObject en myobject, con s?lo poner la id del objeto ya basta AttachObjectToVehicle(objectid, ...) Puedes mostrar el enum "San_Andreas_Vehicles_Info"? RE: [AYUDA] Necesito adaptar esto - BIOS - 2020-05-24 [quote = "SKainer" pid = '7593' dateline = '1590295858'] No necesitas poner CreateObject en myobject, con solo poner la id del objeto ya basta AttachObjectToVehicle ( objectid , ...) Puedes mostrar el enum " San_Andreas_Vehicles_Info"? [/citar] Claro, es este .... enumeraci?n San_Andreas_Vehicles_Info { san_andreas_vehicle_TYPE, san_andreas_vehicle_TYPE_IN, san_andreas_vehicle_TYPE_IN_EXP, san_andreas_vehicle_MODELID, Flotador: san_andreas_vehicle_SPAWN_X, Flotador: san_andreas_vehicle_SPAWN_Y, Flotador: san_andreas_vehicle_SPAWN_Z, Flotador: san_andreas_vehicle_SPAWN_ANGLE, san_andreas_vehicle_COLOR_1, san_andreas_vehicle_COLOR_2, san_andreas_vehicle_vip }; Si me pasas el codigo completo me ayudas por que asi aprendo mas rapido amigo, Gracias !!! RE: [AYUDA] Necesito adaptar esto - SKainer - 2020-05-26 Te hice este peque?o y sencillo script que tal vez no sea lo que quieras exactamente pero ?salo como ejemplo o plantilla PHP Code: new vehicle_taxi1; // Variable global del veh?culo
public OnVehicleSpawn(vehicleid) // Usamos este callback para cuando el veh?culo se spawnee
{
? ?if(San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_TYPE] == VEHICLE_TYPE_WORK)
// Condicional de si el vehiculo es tipo de?trabajo
? ?{
? ? ? ?if(San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_TYPE_IN] == WORK_TAXI)
// Condicional de si el vehiculos es tipo trabajo taxi
? ? ? ?{
? ? ? ? ? ?// Esto lo hice para que la linea no sea tan larga
? ? ? ? ? ?new modelid = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_MODELID];
? ? ? ? ? ?new floatx = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_X];
? ? ? ? ? ?new floaty = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_Y];
? ? ? ? ? ?new floatz = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_Z];
? ? ? ? ? ?new floata = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_ANGLE];
? ? ? ? ? ?new color1 = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_COLOR_1];
? ? ? ? ? ?new color2 = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_COLOR_2];
? ? ? ? ? ?vehicle_taxi1 = AddStaticVehicle(modelid, floatx, floaty, floatz, floata, color1, color2);
? ? ? ? ? ?AttachObjectToVehicle(objectid, vehicle_taxi1, ...);
? ? ? ?}
? ? ? ?// Tus otros vehiculos de trabajo
? ?}
? ?return 1;
}
RE: [AYUDA] Necesito adaptar esto - BIOS - 2020-05-26 (2020-05-26, 01:47 AM)SKainer Wrote: Te hice este peque?o y sencillo script que tal vez no sea lo que quieras exactamente pero ?salo como ejemplo o plantilla Entonces esto: PHP Code: {VEHICLE_TYPE_WORK, WORK_TAXI, 0, 420, 1792.5676, -1868.2953, 13.2887, 0.0000, 6, 1, 0},
Debe desaparecer?? Se agregar?a en el ejemplo que me pusiste que vendria ir aca ? ? ? ? ? ? PHP Code: vehicle_taxi1 = AddStaticVehicle(modelid, floatx, floaty, floatz, floata, color1, color2);
? ? ? ? ? ?AttachObjectToVehicle(objectid, vehicle_taxi1, ...);
RE: [AYUDA] Necesito adaptar esto - SKainer - 2020-05-26 (2020-05-26, 01:59 AM)BIOS Wrote: Entonces esto: No es necesario, ya que vehicle_taxi1 es solo un identificador,?puedes agregar esto al enum PHP Code: enum San_Andreas_Vehicles_Info
{
? ?san_andreas_vehicle_VARIABLE,
};
y aqu? agregar el ID: PHP Code: {1, VEHICLE_TYPE_WORK, WORK_TAXI, 0, 420, 1792.5676, -1868.2953, 13.2887, 0.0000, 6, 1, 0},
esto para agregarle un identificador a tu variable y as? poder crear m?s veh?culos del mismo tipo (WORK_TAXI). Ahora te mostrar? como ser?a TODO el c?digo?con ese identificador y sin errores (mi c?digo anterior daba errores): PHP Code: enum San_Andreas_Vehicles_Info
{
? ? san_andreas_vehicle_VARIABLE, //id
? ? san_andreas_vehicle_TYPE,
? ? san_andreas_vehicle_TYPE_IN,
? ? san_andreas_vehicle_TYPE_IN_EXP,
? ? san_andreas_vehicle_MODELID,
? ? Float:san_andreas_vehicle_SPAWN_X,
? ? Float:san_andreas_vehicle_SPAWN_Y,
? ? Float:san_andreas_vehicle_SPAWN_Z,
? ? Float:san_andreas_vehicle_SPAWN_ANGLE,
? ? san_andreas_vehicle_COLOR_1,
? ? san_andreas_vehicle_COLOR_2,
? ? san_andreas_vehicle_vip
};
new San_Andreas_Vehicles[][San_Andreas_Vehicles_Info] =
{
? ? { 1, VEHICLE_TYPE_WORK, WORK_TAXI, 0, 420, 1792.5676, -1868.2953, 13.2887, 0.0000, 6, 1, 0 } // El identificador agregado
};
public OnVehicleSpawn(vehicleid) // Usamos este callback para cuando el veh?culo se spawnee
{
? ?if(San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_TYPE] == VEHICLE_TYPE_WORK)
? ?// Condicional de si el vehiculo es tipo de trabajo
? ?{
? ? ? ?if(San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_TYPE_IN] == WORK_TAXI)
? ? ? ?// Condicional de si el vehiculos es tipo trabajo taxi
? ? ? ?{
? ? ? ? ? ?if(San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_VARIABLE] == 1) // Nueva l?nea
? ? ? ? ? ?{
? ? ? ? ? ? ? // Esto lo hice para que la linea no sea tan larga
? ? ? ? ? ? ? ?new modelid = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_MODELID];
? ? ? ? ? ? ? ?new Float:floatx = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_X];
? ? ? ? ? ? ? ?new Float:floaty = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_Y];
? ? ? ? ? ? ? ?new Float:floatz = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_Z];
? ? ? ? ? ? ? ?new Float:floata = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_SPAWN_ANGLE];
? ? ? ? ? ? ? ?new color1 = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_COLOR_1];
? ? ? ? ? ? ? ?new color2 = San_Andreas_Vehicles[vehicleid][san_andreas_vehicle_COLOR_2];
? ? ? ? ? ? ? ?AddStaticVehicle(modelid, floatx, floaty, floatz, floata, color1, color2);
? ? ? ? ? ? ? ?AttachObjectToVehicle(1223, vehicleid, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
? ? ? ? ? ?}
? ? ? ? ? ?// Tus otros tipos de vehiculos de trabajo?taxi
? ? ? ?}
? ? ? ?// Tus otros tipos de vehiculos de trabajo
? ?}
? ?return 1;
}?
Tal vez con el AttachObject te d? un bug... pero si eres inteligente sabr?s c?mo resolverlo, tambi?n ten en cuenta que puedes hacerlo c?mo quieras pero no es necesario usar lo que te puse RE: [AYUDA] Necesito adaptar esto - BIOS - 2020-05-26 El 1 Significa Activo y el 0 significa Inactivo? Perdona por ser reiterativo jajajaja RE: [AYUDA] Necesito adaptar esto - SKainer - 2020-05-26 (2020-05-26, 09:56 PM)BIOS Wrote: El 1 Significa Activo y el 0 significa Inactivo? Perdona por ser reiterativo jajajaja El 1 es un IDentificador, puedes ponerle cualquier otro n?mero para identificar |