Jump to content

Vehiculos


DefearT

Recommended Posts

Me pueden ayudar con un script simple de remplazar los vehiculos, ya tengo uno y funciona perfectamente, tiene como 10 vehiculos pero quiero que el script sea mas corto; se podra hacer eso?

Este es el script que tengo, se podra hacer de otra manera pero que funcione porsupuesto, tambien con los skins..

function replaceModel()  
  bandito = engineLoadTXD("vehicles/bandito.txd", 568 ) 
  engineImportTXD(bandito, 568) 
  bandito = engineLoadDFF("vehicles/bandito.dff", 568 ) 
  engineReplaceModel(bandito, 568) 
  buffalo = engineLoadTXD("vehicles/buffalo.txd", 402 ) 
  engineImportTXD(buffalo, 402) 
  buffalo = engineLoadDFF("vehicles/buffalo.dff", 402 ) 
  engineReplaceModel(buffalo, 402) 
  bullet = engineLoadTXD("vehicles/bullet.txd", 541 ) 
  engineImportTXD(bullet, 541) 
  bullet = engineLoadDFF("vehicles/bullet.dff", 541 ) 
  engineReplaceModel(bullet, 541) 
  copcarsf = engineLoadTXD("vehicles/copcarsf.txd", 597 ) 
  engineImportTXD(copcarsf, 597) 
  copcarsf = engineLoadDFF("vehicles/copcarsf.dff", 597 ) 
  engineReplaceModel(copcarsf, 597) 
  euros = engineLoadTXD("vehicles/euros.txd", 587 ) 
  engineImportTXD(euros, 587) 
  euros = engineLoadDFF("vehicles/euros.dff", 587 ) 
  engineReplaceModel(euros, 587) 
  fbirancher = engineLoadTXD("vehicles/fbirancher.txd", 490 ) 
  engineImportTXD(fbirancher, 490) 
  fbirancher = engineLoadDFF("vehicles/fbirancher.dff", 490 ) 
  engineReplaceModel(fbirancher, 490) 
  freight = engineLoadTXD("vehicles/freight.txd", 537 ) 
  engineImportTXD(freight, 537) 
  freight = engineLoadDFF("vehicles/freight.dff", 537 ) 
  engineReplaceModel(freight, 537) 
  hunter = engineLoadTXD("vehicles/hunter.txd", 425 ) 
  engineImportTXD(hunter, 425) 
  hunter = engineLoadDFF("vehicles/hunter.dff", 425 ) 
  engineReplaceModel(hunter, 425) 
  infernus = engineLoadTXD("vehicles/infernus.txd", 411 ) 
  engineImportTXD(infernus, 411) 
  infernus = engineLoadDFF("vehicles/infernus.dff", 411 ) 
  engineReplaceModel(infernus, 411) 
  leviathan = engineLoadTXD("vehicles/leviathan.txd", 417 ) 
  engineImportTXD(leviathan, 417) 
  leviathan = engineLoadDFF("vehicles/leviathan.dff", 417 ) 
  engineReplaceModel(leviathan, 417) 
  maverick = engineLoadTXD("vehicles/maverick.txd", 487 ) 
  engineImportTXD(maverick, 487) 
  maverick = engineLoadDFF("vehicles/maverick.dff", 487 ) 
  engineReplaceModel(maverick, 487) 
  patriot = engineLoadTXD("vehicles/patriot.txd", 470 ) 
  engineImportTXD(patriot, 470) 
  patriot = engineLoadDFF("vehicles/patriot.dff", 470 ) 
  engineReplaceModel(patriot,470 ) 
  sabre = engineLoadTXD("vehicles/sabre.txd", 475 ) 
  engineImportTXD(sabre, 475) 
  sabre = engineLoadDFF("vehicles/sabre.dff", 475 ) 
  engineReplaceModel(sabre, 475) 
  sandking = engineLoadTXD("vehicles/sandking.txd", 495 ) 
  engineImportTXD(sandking, 495) 
  sandking = engineLoadDFF("vehicles/sandking.dff", 495 ) 
  engineReplaceModel(sandking, 495) 
  stretch = engineLoadTXD("vehicles/stretch.txd", 409 ) 
  engineImportTXD(stretch, 409) 
  stretch = engineLoadDFF("vehicles/stretch.dff", 409 ) 
  engineReplaceModel(stretch, 409) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
  
addCommandHandler ( "respawn", replaceModel ) 

Link to comment
Me pueden ayudar con un script simple de remplazar los vehiculos, ya tengo uno y funciona perfectamente, tiene como 10 vehiculos pero quiero que el script sea mas corto; se podra hacer eso?

Este es el script que tengo, se podra hacer de otra manera pero que funcione porsupuesto, tambien con los skins..

function replaceModel()  
  bandito = engineLoadTXD("vehicles/bandito.txd", 568 ) 
  engineImportTXD(bandito, 568) 
  bandito = engineLoadDFF("vehicles/bandito.dff", 568 ) 
  engineReplaceModel(bandito, 568) 
  buffalo = engineLoadTXD("vehicles/buffalo.txd", 402 ) 
  engineImportTXD(buffalo, 402) 
  buffalo = engineLoadDFF("vehicles/buffalo.dff", 402 ) 
  engineReplaceModel(buffalo, 402) 
  bullet = engineLoadTXD("vehicles/bullet.txd", 541 ) 
  engineImportTXD(bullet, 541) 
  bullet = engineLoadDFF("vehicles/bullet.dff", 541 ) 
  engineReplaceModel(bullet, 541) 
  copcarsf = engineLoadTXD("vehicles/copcarsf.txd", 597 ) 
  engineImportTXD(copcarsf, 597) 
  copcarsf = engineLoadDFF("vehicles/copcarsf.dff", 597 ) 
  engineReplaceModel(copcarsf, 597) 
  euros = engineLoadTXD("vehicles/euros.txd", 587 ) 
  engineImportTXD(euros, 587) 
  euros = engineLoadDFF("vehicles/euros.dff", 587 ) 
  engineReplaceModel(euros, 587) 
  fbirancher = engineLoadTXD("vehicles/fbirancher.txd", 490 ) 
  engineImportTXD(fbirancher, 490) 
  fbirancher = engineLoadDFF("vehicles/fbirancher.dff", 490 ) 
  engineReplaceModel(fbirancher, 490) 
  freight = engineLoadTXD("vehicles/freight.txd", 537 ) 
  engineImportTXD(freight, 537) 
  freight = engineLoadDFF("vehicles/freight.dff", 537 ) 
  engineReplaceModel(freight, 537) 
  hunter = engineLoadTXD("vehicles/hunter.txd", 425 ) 
  engineImportTXD(hunter, 425) 
  hunter = engineLoadDFF("vehicles/hunter.dff", 425 ) 
  engineReplaceModel(hunter, 425) 
  infernus = engineLoadTXD("vehicles/infernus.txd", 411 ) 
  engineImportTXD(infernus, 411) 
  infernus = engineLoadDFF("vehicles/infernus.dff", 411 ) 
  engineReplaceModel(infernus, 411) 
  leviathan = engineLoadTXD("vehicles/leviathan.txd", 417 ) 
  engineImportTXD(leviathan, 417) 
  leviathan = engineLoadDFF("vehicles/leviathan.dff", 417 ) 
  engineReplaceModel(leviathan, 417) 
  maverick = engineLoadTXD("vehicles/maverick.txd", 487 ) 
  engineImportTXD(maverick, 487) 
  maverick = engineLoadDFF("vehicles/maverick.dff", 487 ) 
  engineReplaceModel(maverick, 487) 
  patriot = engineLoadTXD("vehicles/patriot.txd", 470 ) 
  engineImportTXD(patriot, 470) 
  patriot = engineLoadDFF("vehicles/patriot.dff", 470 ) 
  engineReplaceModel(patriot,470 ) 
  sabre = engineLoadTXD("vehicles/sabre.txd", 475 ) 
  engineImportTXD(sabre, 475) 
  sabre = engineLoadDFF("vehicles/sabre.dff", 475 ) 
  engineReplaceModel(sabre, 475) 
  sandking = engineLoadTXD("vehicles/sandking.txd", 495 ) 
  engineImportTXD(sandking, 495) 
  sandking = engineLoadDFF("vehicles/sandking.dff", 495 ) 
  engineReplaceModel(sandking, 495) 
  stretch = engineLoadTXD("vehicles/stretch.txd", 409 ) 
  engineImportTXD(stretch, 409) 
  stretch = engineLoadDFF("vehicles/stretch.dff", 409 ) 
  engineReplaceModel(stretch, 409) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
  
addCommandHandler ( "respawn", replaceModel ) 

local myvehicles = { 
    {fileName="models/banshee", model=429}, 
      {fileName="models/infernus", model=411}, 
    {fileName="models/cheetah", model=415}, 
    {fileName="models/sultan", model=560}, 
     
} 
  
function change() 
    for index, models in pairs(myvehicles) do 
    txd = engineLoadTXD ( models.fileName ..".txd" ) 
    engineImportTXD ( txd, models.model ) 
    dff = engineLoadDFF ( models.fileName ..".dff", models.model ) 
    engineReplaceModel ( dff, models.model ) 
    end 
end 
addEventHandler("onClientResourceStart",resourceRoot, change ) 

para ponerles mas vehiculos agregales mas lineas de estas:

{fileName="models/nombre-de-vehiculo", model=ID-del-vehiculo}, 

dentro de la carpeta del script creas una carpeta que se llame 'models' y metes los .txd y .dff dentro de la misma para mas organización. Por mi parte te recomiendo Modloader... Pero si te da peresa usar el modloader, usa esto :).

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...