• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[AYUDA] Necesito adaptar esto
#1
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]
  Reply
#2
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"?
Languajes de Programaci?n que domino:

Pawn, Lua.

Lenguajes de Programaci?n que estoy aprendiendo:

C, JavaScript & C#.



?Listo para ayudarte!

  Reply
#3
[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 !!!
  Reply
#4
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(modelidfloatxfloatyfloatzfloatacolor1color2);
? ? ? ? ? ?
AttachObjectToVehicle(objectidvehicle_taxi1, ...);
? ? ? ?}
? ? ? ?
// Tus otros vehiculos de trabajo
? ?}
? ?return 
1;

Languajes de Programaci?n que domino:

Pawn, Lua.

Lenguajes de Programaci?n que estoy aprendiendo:

C, JavaScript & C#.



?Listo para ayudarte!

  Reply
#5
(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



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(modelidfloatxfloatyfloatzfloatacolor1color2);

? ? ? ? ? ?
AttachObjectToVehicle(objectidvehicle_taxi1, ...);

? ? ? ?}

? ? ? ?
// Tus otros vehiculos de trabajo

? ?}

? ?return 
1;







Entonces esto:



PHP Code:
{VEHICLE_TYPE_WORKWORK_TAXI04201792.5676, -1868.295313.28870.0000610}, 




Debe desaparecer?? Se agregar?a en el ejemplo que me pusiste que vendria ir aca



? ? ? ? ? ?
PHP Code:
vehicle_taxi1 AddStaticVehicle(modelidfloatxfloatyfloatzfloatacolor1color2);



? ? ? ? ? ?
AttachObjectToVehicle(objectidvehicle_taxi1, ...); 
  Reply
#6
(2020-05-26, 01:59 AM)BIOS Wrote: Entonces esto:

PHP Code:
{VEHICLE_TYPE_WORKWORK_TAXI04201792.5676, -1868.295313.28870.0000610}, 

Debe desaparecer?? Se agregar?a en el ejemplo que me pusiste que vendria ir aca

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:
{1VEHICLE_TYPE_WORKWORK_TAXI04201792.5676, -1868.295313.28870.0000610}, 

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] =
{
? ? { 
1VEHICLE_TYPE_WORKWORK_TAXI04201792.5676, -1868.295313.28870.000061// 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(modelidfloatxfloatyfloatzfloatacolor1color2);
? ? ? ? ? ? ? ?
AttachObjectToVehicle(1223vehicleid0.00.00.00.00.00.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
Languajes de Programaci?n que domino:

Pawn, Lua.

Lenguajes de Programaci?n que estoy aprendiendo:

C, JavaScript & C#.



?Listo para ayudarte!

  Reply
#7
El 1 Significa Activo y el 0 significa Inactivo? Perdona por ser reiterativo jajajaja
  Reply
#8
(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
Languajes de Programaci?n que domino:

Pawn, Lua.

Lenguajes de Programaci?n que estoy aprendiendo:

C, JavaScript & C#.



?Listo para ayudarte!

  Reply


Forum Jump: