Jump to content

Замена текстур и моделей дисков для тачек


Recommended Posts

Сделал замену колёс, но они заменяются когда как - то несколько таких при запуске сервера, то другие

<meta> 
    <info type="script" description="New Wheels" author="el_motoblock, ?" version="1.0" name="wheel_mod" /> 
    <script src="wheel_mod.lua" type="client" /> 
    <file src="wheel_or1.dff"/> 
    <file src="wheel_or1.txd"/> 
    <file src="wheel_sr1.dff"/> 
    <file src="wheel_sr1.txd"/> 
    <file src="wheel_sr2.dff"/> 
    <file src="wheel_sr2.txd"/> 
    <file src="wheel_sr3.dff"/> 
    <file src="wheel_sr3.txd"/> 
    <file src="wheel_sr4.dff"/> 
    <file src="wheel_sr4.txd"/> 
    <file src="wheel_sr5.dff"/> 
    <file src="wheel_sr5.txd"/> 
    <file src="wheel_sr6.dff"/> 
    <file src="wheel_sr6.txd"/> 
    <file src="wheel_lr1.dff"/> 
    <file src="wheel_lr1.txd"/> 
    <file src="wheel_lr2.dff"/> 
    <file src="wheel_lr2.txd"/> 
    <file src="wheel_lr3.dff"/> 
    <file src="wheel_lr3.txd"/> 
    <file src="wheel_lr4.dff"/> 
    <file src="wheel_lr4.txd"/> 
    <file src="wheel_lr5.dff"/> 
    <file src="wheel_lr5.txd"/> 
    <file src="wheel_gn1.dff"/> 
    <file src="wheel_gn1.txd"/> 
    <file src="wheel_gn2.dff"/> 
    <file src="wheel_gn2.txd"/> 
    <file src="wheel_gn3.dff"/> 
    <file src="wheel_gn3.txd"/> 
    <file src="wheel_gn4.dff"/> 
    <file src="wheel_gn4.txd"/> 
    <file src="wheel_gn5.dff"/> 
    <file src="wheel_gn5.txd"/> 
</meta>  

function ReplaceWheels()  
  txd01 = engineLoadTXD ( "wheel_or1.txd" ) 
  engineImportTXD ( txd01, 1025 ) 
  dff01 = engineLoadDFF ( "wheel_or1.dff", 0 ) 
  engineReplaceModel ( dff01, 1025 ) 
   
  txd02 = engineLoadTXD ( "wheel_sr1.txd" ) 
  engineImportTXD ( txd02, 1079 ) 
  dff02 = engineLoadDFF ( "wheel_sr1.dff", 0 ) 
  engineReplaceModel ( dff02, 1079 ) 
   
  txd03 = engineLoadTXD ( "wheel_sr2.txd" ) 
  engineImportTXD ( txd03, 1075 ) 
  dff03 = engineLoadDFF ( "wheel_sr2.dff", 0 ) 
  engineReplaceModel ( dff03, 1075 ) 
   
  txd04 = engineLoadTXD ( "wheel_sr3.txd" ) 
  engineImportTXD ( txd04, 1074 ) 
  dff04 = engineLoadDFF ( "wheel_sr3.dff", 0 ) 
  engineReplaceModel ( dff04, 1074 ) 
   
  txd05 = engineLoadTXD ( "wheel_sr4.txd" ) 
  engineImportTXD ( txd05, 1081 ) 
  dff05 = engineLoadDFF ( "wheel_sr4.dff", 0 ) 
  engineReplaceModel ( dff05, 1081 ) 
   
  txd06 = engineLoadTXD ( "wheel_sr5.txd" ) 
  engineImportTXD ( txd06, 1080 ) 
  dff06 = engineLoadDFF ( "wheel_sr5.dff", 0 ) 
  engineReplaceModel ( dff06, 1080 ) 
   
  txd07 = engineLoadTXD ( "wheel_sr6.txd" ) 
  engineImportTXD ( txd07, 1073 ) 
  dff07 = engineLoadDFF ( "wheel_sr6.dff", 0 ) 
  engineReplaceModel ( dff07, 1073 ) 
   
  txd08 = engineLoadTXD ( "wheel_lr1.txd" ) 
  engineImportTXD ( txd08, 1077 ) 
  dff08 = engineLoadDFF ( "wheel_lr1.dff", 0 ) 
  engineReplaceModel ( dff08, 1077 ) 
   
  txd09 = engineLoadTXD ( "wheel_lr2.txd" ) 
  engineImportTXD ( txd09, 1083 ) 
  dff09 = engineLoadDFF ( "wheel_lr2.dff", 0 ) 
  engineReplaceModel ( dff09, 1083 ) 
   
  txd10 = engineLoadTXD ( "wheel_lr3.txd" ) 
  engineImportTXD ( txd10, 1078 ) 
  dff10 = engineLoadDFF ( "wheel_lr3.dff", 0 ) 
  engineReplaceModel ( dff10, 1078 ) 
   
  txd11 = engineLoadTXD ( "wheel_lr4.txd" ) 
  engineImportTXD ( txd11, 1076 ) 
  dff11 = engineLoadDFF ( "wheel_lr4.dff", 0 ) 
  engineReplaceModel ( dff11, 1076 ) 
   
  txd12 = engineLoadTXD ( "wheel_lr5.txd" ) 
  engineImportTXD ( txd12, 1084 ) 
  dff12 = engineLoadDFF ( "wheel_lr5.dff", 0 ) 
  engineReplaceModel ( dff12, 1084 ) 
   
  txd13 = engineLoadTXD ( "wheel_gn1.txd" ) 
  engineImportTXD ( txd13, 1082 ) 
  dff13 = engineLoadDFF ( "wheel_gn1.dff", 0 ) 
  engineReplaceModel ( dff13, 1082 ) 
   
  txd14 = engineLoadTXD ( "wheel_gn2.txd" ) 
  engineImportTXD ( txd14, 1085 ) 
  dff14 = engineLoadDFF ( "wheel_gn2.dff", 0 ) 
  engineReplaceModel ( dff14, 1085 ) 
   
  txd15 = engineLoadTXD ( "wheel_gn3.txd" ) 
  engineImportTXD ( txd15, 1096 ) 
  dff15 = engineLoadDFF( "wheel_gn3.dff", 0 ) 
  engineReplaceModel ( dff15, 1096 ) 
   
  txd16 = engineLoadTXD ( "wheel_gn4.txd" ) 
  engineImportTXD ( txd16, 1097 ) 
  dff16 = engineLoadDFF ( "wheel_gn4.dff", 0 ) 
  engineReplaceModel ( dff16, 1097 ) 
   
  txd16 = engineLoadTXD ( "wheel_gn5.txd" ) 
  engineImportTXD ( txd16, 1098 ) 
  dff16 = engineLoadDFF ( "wheel_gn5.dff", 0 ) 
  engineReplaceModel ( dff16, 1098 ) 
     
end 
setTimer ( ReplaceWheels, 3000, 1) 
outputChatBox ( "#0026FFWheel #4CBA00Mod #FF6A00loaded!!!", 255, 106, 0, true ) 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), ReplaceWheels) 
addCommandHandler ( "rewheel", ReplaceWheels ) 
outputChatBox ( "#4CBA00Type #FF6A00/rewheel #4CBA00to reload wheels", 76, 190, 0, true) 

Link to comment
function ReplaceWheels()  
  txd01 = engineLoadTXD ( "wheel_or1.txd" ) 
  engineImportTXD ( txd01, 1025 ) 
  dff01 = engineLoadDFF ( "wheel_or1.dff", 0 ) 
  engineReplaceModel ( dff01, 1025 ) 
  outputChatBox ( "txd01 = "..tostring(txd1)..", dff01 = "..tostring(dff1) )   
  
  txd02 = engineLoadTXD ( "wheel_sr1.txd" ) 
  engineImportTXD ( txd02, 1079 ) 
  dff02 = engineLoadDFF ( "wheel_sr1.dff", 0 ) 
  engineReplaceModel ( dff02, 1079 ) 
  outputChatBox ( "txd02 = "..tostring(txd1)..", dff02 = "..tostring(dff1) )   
   
  ... 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, ReplaceWheels) 
  

сморим, что функции вернут.

А по команде заменять таким способом - неправильно, потому что каждый ввод команды загружает в память все ту же модель, но не выгружает из памяти предыдущую. Если текстурки и модельки успешно загрузились (LOAD) в первый раз, их ИДы нужно сохранить. И потом с помощью этих ИДов перезаменять (REPLACE).

Link to comment

txd01 = nil, dff01 = nil 
txd02 = nil, dff02 = nil 
txd03 = nil, dff03 = nil 
txd04 = nil, dff04 = nil 
txd05 = nil, dff05 = nil 
txd06 = nil, dff06 = nil 
txd07 = nil, dff07 = nil 
txd08 = nil, dff08 = nil 
txd09 = nil, dff09 = nil 
txd10 = nil, dff10 = nil 
txd11 = nil, dff11 = nil 
txd12 = nil, dff12 = nil 
txd13 = nil, dff13 = nil 
txd14 = nil, dff14 = nil 
txd15 = nil, dff15 = nil 
txd16 = nil, dff16 = nil 
txd17 = nil, dff17 = nil 

Раньше то они через раз в рандомном порядке грузились - теперь не загрузились вовсе

Вот полный код на всякий случай

function ReplaceWheels()  
  txd01 = engineLoadTXD ( "wheel_or1.txd" ) 
  engineImportTXD ( txd01, 1025 ) 
  dff01 = engineLoadDFF ( "wheel_or1.dff", 0 ) 
  engineReplaceModel ( dff01, 1025 ) 
  outputChatBox ( "txd01 = "..tostring(txd1)..", dff01 = "..tostring(dff1) ) 
   
  txd02 = engineLoadTXD ( "wheel_sr1.txd" ) 
  engineImportTXD ( txd02, 1079 ) 
  dff02 = engineLoadDFF ( "wheel_sr1.dff", 0 ) 
  engineReplaceModel ( dff02, 1079 ) 
  outputChatBox ( "txd02 = "..tostring(txd1)..", dff02 = "..tostring(dff1) ) 
   
  txd03 = engineLoadTXD ( "wheel_sr2.txd" ) 
  engineImportTXD ( txd03, 1075 ) 
  dff03 = engineLoadDFF ( "wheel_sr2.dff", 0 ) 
  engineReplaceModel ( dff03, 1075 ) 
  outputChatBox ( "txd03 = "..tostring(txd1)..", dff03 = "..tostring(dff1) ) 
   
  txd04 = engineLoadTXD ( "wheel_sr3.txd" ) 
  engineImportTXD ( txd04, 1074 ) 
  dff04 = engineLoadDFF ( "wheel_sr3.dff", 0 ) 
  engineReplaceModel ( dff04, 1074 ) 
  outputChatBox ( "txd04 = "..tostring(txd1)..", dff04 = "..tostring(dff1) ) 
   
  txd05 = engineLoadTXD ( "wheel_sr4.txd" ) 
  engineImportTXD ( txd05, 1081 ) 
  dff05 = engineLoadDFF ( "wheel_sr4.dff", 0 ) 
  engineReplaceModel ( dff05, 1081 ) 
  outputChatBox ( "txd05 = "..tostring(txd1)..", dff05 = "..tostring(dff1) ) 
   
  txd06 = engineLoadTXD ( "wheel_sr5.txd" ) 
  engineImportTXD ( txd06, 1080 ) 
  dff06 = engineLoadDFF ( "wheel_sr5.dff", 0 ) 
  engineReplaceModel ( dff06, 1080 ) 
  outputChatBox ( "txd06 = "..tostring(txd1)..", dff06 = "..tostring(dff1) ) 
   
  txd07 = engineLoadTXD ( "wheel_sr6.txd" ) 
  engineImportTXD ( txd07, 1073 ) 
  dff07 = engineLoadDFF ( "wheel_sr6.dff", 0 ) 
  engineReplaceModel ( dff07, 1073 ) 
  outputChatBox ( "txd07 = "..tostring(txd1)..", dff07 = "..tostring(dff1) ) 
   
  txd08 = engineLoadTXD ( "wheel_lr1.txd" ) 
  engineImportTXD ( txd08, 1077 ) 
  dff08 = engineLoadDFF ( "wheel_lr1.dff", 0 ) 
  engineReplaceModel ( dff08, 1077 ) 
  outputChatBox ( "txd08 = "..tostring(txd1)..", dff08 = "..tostring(dff1) ) 
   
  txd09 = engineLoadTXD ( "wheel_lr2.txd" ) 
  engineImportTXD ( txd09, 1083 ) 
  dff09 = engineLoadDFF ( "wheel_lr2.dff", 0 ) 
  engineReplaceModel ( dff09, 1083 ) 
  outputChatBox ( "txd09 = "..tostring(txd1)..", dff09 = "..tostring(dff1) ) 
   
  txd10 = engineLoadTXD ( "wheel_lr3.txd" ) 
  engineImportTXD ( txd10, 1078 ) 
  dff10 = engineLoadDFF ( "wheel_lr3.dff", 0 ) 
  engineReplaceModel ( dff10, 1078 ) 
  outputChatBox ( "txd10 = "..tostring(txd1)..", dff10 = "..tostring(dff1) ) 
   
  txd11 = engineLoadTXD ( "wheel_lr4.txd" ) 
  engineImportTXD ( txd11, 1076 ) 
  dff11 = engineLoadDFF ( "wheel_lr4.dff", 0 ) 
  engineReplaceModel ( dff11, 1076 ) 
  outputChatBox ( "txd11 = "..tostring(txd1)..", dff11 = "..tostring(dff1) ) 
   
  txd12 = engineLoadTXD ( "wheel_lr5.txd" ) 
  engineImportTXD ( txd12, 1084 ) 
  dff12 = engineLoadDFF ( "wheel_lr5.dff", 0 ) 
  engineReplaceModel ( dff12, 1084 ) 
  outputChatBox ( "txd12 = "..tostring(txd1)..", dff12 = "..tostring(dff1) ) 
   
  txd13 = engineLoadTXD ( "wheel_gn1.txd" ) 
  engineImportTXD ( txd13, 1082 ) 
  dff13 = engineLoadDFF ( "wheel_gn1.dff", 0 ) 
  engineReplaceModel ( dff13, 1082 ) 
  outputChatBox ( "txd13 = "..tostring(txd1)..", dff13 = "..tostring(dff1) ) 
   
  txd14 = engineLoadTXD ( "wheel_gn2.txd" ) 
  engineImportTXD ( txd14, 1085 ) 
  dff14 = engineLoadDFF ( "wheel_gn2.dff", 0 ) 
  engineReplaceModel ( dff14, 1085 ) 
  outputChatBox ( "txd14 = "..tostring(txd1)..", dff14 = "..tostring(dff1) ) 
   
  txd15 = engineLoadTXD ( "wheel_gn3.txd" ) 
  engineImportTXD ( txd15, 1096 ) 
  dff15 = engineLoadDFF( "wheel_gn3.dff", 0 ) 
  engineReplaceModel ( dff15, 1096 ) 
  outputChatBox ( "txd15 = "..tostring(txd1)..", dff15 = "..tostring(dff1) ) 
   
  txd16 = engineLoadTXD ( "wheel_gn4.txd" ) 
  engineImportTXD ( txd16, 1097 ) 
  dff16 = engineLoadDFF ( "wheel_gn4.dff", 0 ) 
  engineReplaceModel ( dff16, 1097 ) 
  outputChatBox ( "txd16 = "..tostring(txd1)..", dff16 = "..tostring(dff1) ) 
   
  txd16 = engineLoadTXD ( "wheel_gn5.txd" ) 
  engineImportTXD ( txd16, 1098 ) 
  dff16 = engineLoadDFF ( "wheel_gn5.dff", 0 ) 
  engineReplaceModel ( dff16, 1098 ) 
  outputChatBox ( "txd17 = "..tostring(txd1)..", dff17 = "..tostring(dff1) ) 
     
end 
addEventHandler ( "onClientResourceStart", resourceRoot, ReplaceWheels) 

http://narod.yandex.ru/disk/34561996001/_wheel_mod.zip

Link to comment
function ReplaceWheels()  
  txd01 = engineLoadTXD ( "wheel_or1.txd" ) 
  engineImportTXD ( txd01, 1025 ) 
  dff01 = engineLoadDFF ( "wheel_or1.dff", 0 ) 
  engineReplaceModel ( dff01, 1025 ) 
  outputChatBox ( "txd01 = "..tostring(txd1)..", dff01 = "..tostring(dff1) ) 
   
  txd02 = engineLoadTXD ( "wheel_sr1.txd" ) 
  engineImportTXD ( txd02, 1079 ) 
  dff02 = engineLoadDFF ( "wheel_sr1.dff", 0 ) 
  engineReplaceModel ( dff02, 1079 ) 
  outputChatBox ( "txd02 = "..tostring(txd1)..", dff02 = "..tostring(dff1) ) 
   
  txd03 = engineLoadTXD ( "wheel_sr2.txd" ) 
  engineImportTXD ( txd03, 1075 ) 
  dff03 = engineLoadDFF ( "wheel_sr2.dff", 0 ) 
  engineReplaceModel ( dff03, 1075 ) 
  outputChatBox ( "txd03 = "..tostring(txd1)..", dff03 = "..tostring(dff1) ) 
   
  txd04 = engineLoadTXD ( "wheel_sr3.txd" ) 
  engineImportTXD ( txd04, 1074 ) 
  dff04 = engineLoadDFF ( "wheel_sr3.dff", 0 ) 
  engineReplaceModel ( dff04, 1074 ) 
  outputChatBox ( "txd04 = "..tostring(txd1)..", dff04 = "..tostring(dff1) ) 
   
  txd05 = engineLoadTXD ( "wheel_sr4.txd" ) 
  engineImportTXD ( txd05, 1081 ) 
  dff05 = engineLoadDFF ( "wheel_sr4.dff", 0 ) 
  engineReplaceModel ( dff05, 1081 ) 
  outputChatBox ( "txd05 = "..tostring(txd1)..", dff05 = "..tostring(dff1) ) 
   
  txd06 = engineLoadTXD ( "wheel_sr5.txd" ) 
  engineImportTXD ( txd06, 1080 ) 
  dff06 = engineLoadDFF ( "wheel_sr5.dff", 0 ) 
  engineReplaceModel ( dff06, 1080 ) 
  outputChatBox ( "txd06 = "..tostring(txd1)..", dff06 = "..tostring(dff1) ) 
   
  txd07 = engineLoadTXD ( "wheel_sr6.txd" ) 
  engineImportTXD ( txd07, 1073 ) 
  dff07 = engineLoadDFF ( "wheel_sr6.dff", 0 ) 
  engineReplaceModel ( dff07, 1073 ) 
  outputChatBox ( "txd07 = "..tostring(txd1)..", dff07 = "..tostring(dff1) ) 
   
  txd08 = engineLoadTXD ( "wheel_lr1.txd" ) 
  engineImportTXD ( txd08, 1077 ) 
  dff08 = engineLoadDFF ( "wheel_lr1.dff", 0 ) 
  engineReplaceModel ( dff08, 1077 ) 
  outputChatBox ( "txd08 = "..tostring(txd1)..", dff08 = "..tostring(dff1) ) 
   
  txd09 = engineLoadTXD ( "wheel_lr2.txd" ) 
  engineImportTXD ( txd09, 1083 ) 
  dff09 = engineLoadDFF ( "wheel_lr2.dff", 0 ) 
  engineReplaceModel ( dff09, 1083 ) 
  outputChatBox ( "txd09 = "..tostring(txd1)..", dff09 = "..tostring(dff1) ) 
   
  txd10 = engineLoadTXD ( "wheel_lr3.txd" ) 
  engineImportTXD ( txd10, 1078 ) 
  dff10 = engineLoadDFF ( "wheel_lr3.dff", 0 ) 
  engineReplaceModel ( dff10, 1078 ) 
  outputChatBox ( "txd10 = "..tostring(txd1)..", dff10 = "..tostring(dff1) ) 
   
  txd11 = engineLoadTXD ( "wheel_lr4.txd" ) 
  engineImportTXD ( txd11, 1076 ) 
  dff11 = engineLoadDFF ( "wheel_lr4.dff", 0 ) 
  engineReplaceModel ( dff11, 1076 ) 
  outputChatBox ( "txd11 = "..tostring(txd1)..", dff11 = "..tostring(dff1) ) 
   
  txd12 = engineLoadTXD ( "wheel_lr5.txd" ) 
  engineImportTXD ( txd12, 1084 ) 
  dff12 = engineLoadDFF ( "wheel_lr5.dff", 0 ) 
  engineReplaceModel ( dff12, 1084 ) 
  outputChatBox ( "txd12 = "..tostring(txd1)..", dff12 = "..tostring(dff1) ) 
   
  txd13 = engineLoadTXD ( "wheel_gn1.txd" ) 
  engineImportTXD ( txd13, 1082 ) 
  dff13 = engineLoadDFF ( "wheel_gn1.dff", 0 ) 
  engineReplaceModel ( dff13, 1082 ) 
  outputChatBox ( "txd13 = "..tostring(txd1)..", dff13 = "..tostring(dff1) ) 
   
  txd14 = engineLoadTXD ( "wheel_gn2.txd" ) 
  engineImportTXD ( txd14, 1085 ) 
  dff14 = engineLoadDFF ( "wheel_gn2.dff", 0 ) 
  engineReplaceModel ( dff14, 1085 ) 
  outputChatBox ( "txd14 = "..tostring(txd1)..", dff14 = "..tostring(dff1) ) 
   
  txd15 = engineLoadTXD ( "wheel_gn3.txd" ) 
  engineImportTXD ( txd15, 1096 ) 
  dff15 = engineLoadDFF( "wheel_gn3.dff", 0 ) 
  engineReplaceModel ( dff15, 1096 ) 
  outputChatBox ( "txd15 = "..tostring(txd1)..", dff15 = "..tostring(dff1) ) 
   
  txd16 = engineLoadTXD ( "wheel_gn4.txd" ) 
  engineImportTXD ( txd16, 1097 ) 
  dff16 = engineLoadDFF ( "wheel_gn4.dff", 0 ) 
  engineReplaceModel ( dff16, 1097 ) 
  outputChatBox ( "txd16 = "..tostring(txd1)..", dff16 = "..tostring(dff1) ) 
   
  txd16 = engineLoadTXD ( "wheel_gn5.txd" ) 
  engineImportTXD ( txd16, 1098 ) 
  dff16 = engineLoadDFF ( "wheel_gn5.dff", 0 ) 
  engineReplaceModel ( dff16, 1098 ) 
  outputChatBox ( "txd17 = "..tostring(txd1)..", dff17 = "..tostring(dff1) ) 
     
end 
addEventHandler ( "onClientResourceStart", resourceRoot, ReplaceWheels) 

Ты хоть понял что ты написал ваще? :x

У тебя nil будет в любом случае т.к переменной ( txd1 ) и ( dff1 ) не существует.

Посмотри эту тему viewtopic.php?f=141&t=32458 и наконец то пойми скриптовой язык Lua.

  
 outputChatBox ( "txd01 = "..tostring(txd1)..", dff01 = "..tostring(dff1) ) 
... 
outputChatBox ( "txd17 = "..tostring(txd1)..", dff17 = "..tostring(dff1) ) 
  

Надеюсь ты понял что я имею ввиду .

Попробуй

local wheels = { 
    {"wheel_or1",1025}, 
    {"wheel_sr1",1079}, 
    {"wheel_sr2",1075}, 
    {"wheel_sr3",1074}, 
    {"wheel_sr4",1081}, 
    {"wheel_sr5",1080}, 
    {"wheel_sr6",1073}, 
    {"wheel_lr1",1077}, 
    {"wheel_lr2",1083}, 
    {"wheel_lr3",1078}, 
    {"wheel_lr4",1076}, 
    {"wheel_lr5",1084}, 
    {"wheel_gn1",1082}, 
    {"wheel_gn2",1085}, 
    {"wheel_gn3",1096}, 
    {"wheel_gn4",1097},  
    {"wheel_gn5",1098}                                               
} 
  
function replace( ) 
    for _,v in pairs( wheels ) do 
        engineImportTXD( engineLoadTXD ( v[1]..".txd" ),v[2] ) 
        engineReplaceModel( engineLoadDFF( v[1]..".dff", 0 ),v[2] ) 
    end 
end 
setTimer( replace,1000,1 ) 

Link to comment

Он эту ошибку у меня подцепил (: и, Kenix, такое сокращение вызывает непонятки как у обработчика, так и у скриптера при поиске ошибок. Цикл - есть хорошо, но только подсовывать в функцию возможно неправильные значения - плохо.

вот так вот

function ReplaceWheels()  
  txd01 = engineLoadTXD ( "wheel_or1.txd" ) 
  engineImportTXD ( txd01, 1025 ) 
  dff01 = engineLoadDFF ( "wheel_or1.dff", 0 ) 
  engineReplaceModel ( dff01, 1025 ) 
  outputChatBox ( "txd01 = "..tostring(txd01)..", dff01 = "..tostring(dff01) ) 
   
  txd02 = engineLoadTXD ( "wheel_sr1.txd" ) 
  engineImportTXD ( txd02, 1079 ) 
  dff02 = engineLoadDFF ( "wheel_sr1.dff", 0 ) 
  engineReplaceModel ( dff02, 1079 ) 
  outputChatBox ( "txd02 = "..tostring(txd02)..", dff02 = "..tostring(dff02) ) 
   
  txd03 = engineLoadTXD ( "wheel_sr2.txd" ) 
  engineImportTXD ( txd03, 1075 ) 
  dff03 = engineLoadDFF ( "wheel_sr2.dff", 0 ) 
  engineReplaceModel ( dff03, 1075 ) 
  outputChatBox ( "txd03 = "..tostring(txd03)..", dff03 = "..tostring(dff03) ) 
   
  txd04 = engineLoadTXD ( "wheel_sr3.txd" ) 
  engineImportTXD ( txd04, 1074 ) 
  dff04 = engineLoadDFF ( "wheel_sr3.dff", 0 ) 
  engineReplaceModel ( dff04, 1074 ) 
  outputChatBox ( "txd04 = "..tostring(txd04)..", dff04 = "..tostring(dff04) ) 
   
  txd05 = engineLoadTXD ( "wheel_sr4.txd" ) 
  engineImportTXD ( txd05, 1081 ) 
  dff05 = engineLoadDFF ( "wheel_sr4.dff", 0 ) 
  engineReplaceModel ( dff05, 1081 ) 
  outputChatBox ( "txd05 = "..tostring(txd05)..", dff05 = "..tostring(dff05) ) 
   
  txd06 = engineLoadTXD ( "wheel_sr5.txd" ) 
  engineImportTXD ( txd06, 1080 ) 
  dff06 = engineLoadDFF ( "wheel_sr5.dff", 0 ) 
  engineReplaceModel ( dff06, 1080 ) 
  outputChatBox ( "txd06 = "..tostring(txd06)..", dff06 = "..tostring(dff06) ) 
   
  txd07 = engineLoadTXD ( "wheel_sr6.txd" ) 
  engineImportTXD ( txd07, 1073 ) 
  dff07 = engineLoadDFF ( "wheel_sr6.dff", 0 ) 
  engineReplaceModel ( dff07, 1073 ) 
  outputChatBox ( "txd07 = "..tostring(txd07)..", dff07 = "..tostring(dff07) ) 
   
  txd08 = engineLoadTXD ( "wheel_lr1.txd" ) 
  engineImportTXD ( txd08, 1077 ) 
  dff08 = engineLoadDFF ( "wheel_lr1.dff", 0 ) 
  engineReplaceModel ( dff08, 1077 ) 
  outputChatBox ( "txd08 = "..tostring(txd08)..", dff08 = "..tostring(dff08) ) 
   
  txd09 = engineLoadTXD ( "wheel_lr2.txd" ) 
  engineImportTXD ( txd09, 1083 ) 
  dff09 = engineLoadDFF ( "wheel_lr2.dff", 0 ) 
  engineReplaceModel ( dff09, 1083 ) 
  outputChatBox ( "txd09 = "..tostring(txd09)..", dff09 = "..tostring(dff09) ) 
   
  txd10 = engineLoadTXD ( "wheel_lr3.txd" ) 
  engineImportTXD ( txd10, 1078 ) 
  dff10 = engineLoadDFF ( "wheel_lr3.dff", 0 ) 
  engineReplaceModel ( dff10, 1078 ) 
  outputChatBox ( "txd10 = "..tostring(txd10)..", dff10 = "..tostring(dff10) ) 
   
  txd11 = engineLoadTXD ( "wheel_lr4.txd" ) 
  engineImportTXD ( txd11, 1076 ) 
  dff11 = engineLoadDFF ( "wheel_lr4.dff", 0 ) 
  engineReplaceModel ( dff11, 1076 ) 
  outputChatBox ( "txd11 = "..tostring(txd11)..", dff11 = "..tostring(dff11) ) 
   
  txd12 = engineLoadTXD ( "wheel_lr5.txd" ) 
  engineImportTXD ( txd12, 1084 ) 
  dff12 = engineLoadDFF ( "wheel_lr5.dff", 0 ) 
  engineReplaceModel ( dff12, 1084 ) 
  outputChatBox ( "txd12 = "..tostring(txd12)..", dff12 = "..tostring(dff12) ) 
   
  txd13 = engineLoadTXD ( "wheel_gn1.txd" ) 
  engineImportTXD ( txd13, 1082 ) 
  dff13 = engineLoadDFF ( "wheel_gn1.dff", 0 ) 
  engineReplaceModel ( dff13, 1082 ) 
  outputChatBox ( "txd13 = "..tostring(txd13)..", dff13 = "..tostring(dff13) ) 
   
  txd14 = engineLoadTXD ( "wheel_gn2.txd" ) 
  engineImportTXD ( txd14, 1085 ) 
  dff14 = engineLoadDFF ( "wheel_gn2.dff", 0 ) 
  engineReplaceModel ( dff14, 1085 ) 
  outputChatBox ( "txd14 = "..tostring(txd14)..", dff14 = "..tostring(dff14) ) 
   
  txd15 = engineLoadTXD ( "wheel_gn3.txd" ) 
  engineImportTXD ( txd15, 1096 ) 
  dff15 = engineLoadDFF( "wheel_gn3.dff", 0 ) 
  engineReplaceModel ( dff15, 1096 ) 
  outputChatBox ( "txd15 = "..tostring(txd15)..", dff15 = "..tostring(dff15) ) 
   
  txd16 = engineLoadTXD ( "wheel_gn4.txd" ) 
  engineImportTXD ( txd16, 1097 ) 
  dff16 = engineLoadDFF ( "wheel_gn4.dff", 0 ) 
  engineReplaceModel ( dff16, 1097 ) 
  outputChatBox ( "txd16 = "..tostring(txd16)..", dff16 = "..tostring(dff16) ) 
   
  txd16 = engineLoadTXD ( "wheel_gn5.txd" ) 
  engineImportTXD ( txd16, 1098 ) 
  dff16 = engineLoadDFF ( "wheel_gn5.dff", 0 ) 
  engineReplaceModel ( dff16, 1098 ) 
  outputChatBox ( "txd17 = "..tostring(txd17)..", dff17 = "..tostring(dff17) ) 
     
end 
addEventHandler ( "onClientResourceStart", resourceRoot, ReplaceWheels) 

Link to comment

Ну так пусть проверяет возвращаемое значение в цикле ...

local wheels = { 
    {"wheel_or1",1025}, 
    {"wheel_sr1",1079}, 
    {"wheel_sr2",1075}, 
    {"wheel_sr3",1074}, 
    {"wheel_sr4",1081}, 
    {"wheel_sr5",1080}, 
    {"wheel_sr6",1073}, 
    {"wheel_lr1",1077}, 
    {"wheel_lr2",1083}, 
    {"wheel_lr3",1078}, 
    {"wheel_lr4",1076}, 
    {"wheel_lr5",1084}, 
    {"wheel_gn1",1082}, 
    {"wheel_gn2",1085}, 
    {"wheel_gn3",1096}, 
    {"wheel_gn4",1097},  
    {"wheel_gn5",1098}                                               
} 
  
function replace( ) 
    for _,v in pairs( wheels ) do 
        outputChatBox( "Import TXD NAME = '"..v[1].."' ID = '"..v[2].."' RETURN = '"..tostring( engineImportTXD( outputChatBox( "Load TXD NAME = '"..v[1].."' RETURN = '"..tostring( engineLoadTXD ( v[1]..".txd" ) ).."'" ),v[2] ) ).."'" ) 
        outputChatBox( "Replace DFF NAME = '"..v[1].." ID = '"..v[2].."' RETURN = '"..tostring( engineReplaceModel( outputChatBox( "Load DFF NAME = '"..v[1].."' RETURN = '"..tostring( engineLoadDFF( v[1]..".dff", 0 ) ).."'" ),v[2] ) ).."'" ) 
        outputChatBox( "------------------------------------------------------") 
    end 
end 
setTimer( replace,1000,1 ) 

Link to comment

Ошибся

Скрипт рабочий проверял только что , возвращает true но колёса не заменяет.

local wheels = { 
    {"wheel_or1",1025}, 
    {"wheel_sr1",1079}, 
    {"wheel_sr2",1075}, 
    {"wheel_sr3",1074}, 
    {"wheel_sr4",1081}, 
    {"wheel_sr5",1080}, 
    {"wheel_sr6",1073}, 
    {"wheel_lr1",1077}, 
    {"wheel_lr2",1083}, 
    {"wheel_lr3",1078}, 
    {"wheel_lr4",1076}, 
    {"wheel_lr5",1084}, 
    {"wheel_gn1",1082}, 
    {"wheel_gn2",1085}, 
    {"wheel_gn3",1096}, 
    {"wheel_gn4",1097},  
    {"wheel_gn5",1098}                                               
} 
  
function replace( ) 
    for i,v in pairs( wheels ) do 
        engineImportTXD( engineLoadTXD ( v[1]..".txd" ),tonumber( v[2] ) ) 
        engineReplaceModel( engineLoadDFF( v[1]..".dff", 0 ),tonumber( v[2] ) ) 
    end 
end 
setTimer( replace,1000,1 ) 
  

P.S Давно помню заменял тоже такие проблемы были, попробуй заменить другие модельки колёс.

Link to comment

Скрипт самый стабильный но частично. Заменял модельки все на другие тот же результат - какие то заменились, какие-то нет. Запустил host game - работает, дисконнект, снова host game - все не заменились.

Кароче тут баг как и с заменой некотрого оружия - трости например(modloader даже на помог, не знаю может сейчас исправили).

Вот список номеров моделей дисков, которые не заменяются:

1073

1075

1076

1077

1080

1082

1083

1084

1096

1097

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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