Jump to content

Kostyan_Sigaev

Members
  • Posts

    2
  • Joined

  • Last visited

Details

  • Location
    Kramatorsk

Kostyan_Sigaev's Achievements

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody.

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody. (2/54)

0

Reputation

  1. I recently finished building my DayZ server, where I play locally without hosting, as I play alone. I wanted to make a standalone MTA build to work from a USB stick to run on any computer. I have already noticed that the game uses "ProgramData" and "AppData" in addition to the "Program Files (x86)" folder, and without "ProgramData" the client will not run. In fact, I only need the game client, because the server uses login and password for authentication, not the client ID, so I won't lose anything from changing my computer, that's why I thought about a standalone build. How can I solve the problem with "ProgramData"? Maybe you need to write a .bat file to run the game, which before each start will copy the contents of the folder "MTA San Andreas All" to "ProgramData"? Or, continuing with this idea, write a console application that will copy the files into the folder at startup, then start MTA, wait for the game to quit, and delete the MTA folder from "ProgramData"? Or maybe some existing program to create portable copies of any program is 100% compatible with MTA? This question is quite complicated, but I think we can find an unambiguous answer to it by joint efforts. Thank you for your attention. Translated with DeepL.com (free version)
  2. Около года назад с друзьями играли нашем сервере DayZ, сборку которого скачали откуда-то... После того сервер мирно лежал на диске и никому не мешал, но недавно я его случайно нашел и предложил друзьям снова вместе играть, после чего запустил и увидел горсть ошибок в консоли, хотя раньше их не было и сервер работал нормально. В общем, почти все проблемы я решил, только теперь остаются всего 2: 1. Зомби не спавнятся. 2. Сохраненные палатки при загрузке не загружают свой угол поворота, а только позицию и данные. Итак, проблема номер 1: В консоли вылезла ошибка: ERROR: [DayZ-MTA]\DayZ\zombies.lua:338: attempt to perform arithmetic on a boolean value Вот функция, на которую ссылается ошибка: function createZomieForPlayer (x,y,z) x,y,z = getElementPosition(source) counter = 0 --outputChatBox ( "Zumbis Perto: " .. zombiesaliveee, player, 0, 238, 0, true ) --outputChatBox ( "Zumbis Limite: " .. zombieslimite, player, 0, 238, 0, true ) if getElementData(source,"lastzombiespawnposition") then local xL,yL,zL = getElementData(source,"lastzombiespawnposition")[1] or false,getElementData(source,"lastzombiespawnposition")[2] or false,getElementData(source,"lastzombiespawnposition")[3] or false if xL then if getDistanceBetweenPoints3D (x,y,z,xL,yL,zL) < 20 then --outputChatBox("Server: canceled zombie create (reason: is near old position)") return end end end --Строка ниже и есть строка 338 if getElementData(source, "spawnedzombies") + 3 <= gameplayVariables.playerzombies then -- If spawned zombies + 3 lower or equal to 9 -> Create zombies -> Increase digit (default: 9) to let more zombies spawn. WARNING: THE HIGHER THE VALUE, THE MORE LAG CAN OCCUR! -- for i = 1, gameplayVariables["amountzombies"] = 2 do --здесь ранее была ошибка: 'do' expected near '=' for i = 1, gameplayVariables["amountzombies"] do counter = counter+1 local number1 = math.random(-49,40) local number2 = math.random(-38,42) randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zombie = createPed ( tonumber( ZombiePedSkins[randomZskin] ),x+number1, y+number2,z, math.random(0, 360)) local Zx, Zy, Zz = getElementPosition( zombie ) setElementData(zombie,"zombie",true) -- setElementData(zombie,"blood",gameplayVariables["zombieblood"] = 10) -- [ID:0000009 - Zombie menace] //L setElementData(zombie,"blood",gameplayVariables["zombieblood"]) setElementData(zombie,"owner",source) -------------- if not rot then rot = math.random (1,359) end if not interior then interior = 0 end if not dimension then dimension = 0 end setTimer ( setElementInterior, 100, 1, zombie, tonumber(interior)) --sets interior setTimer ( setElementDimension, 100, 1, zombie, tonumber(dimension)) --sets dimension setElementData ( zombie, "zombie", true ) setElementData ( zombie, "forcedtoexist", true ) setTimer ( function (zombie, rot) if ( isElement ( zombie ) ) then setPedRotation ( zombie, rot ) end end, 500, 1, zombie, rot ) setTimer ( function (zombie) if ( isElement ( zombie ) ) then setElementData ( zombie, "status", "idle" ) end end, 2000, 1, zombie ) setTimer ( function (zombie) if ( isElement ( zombie ) ) then setElementData ( zombie, "forcedtoexist", true ) end end, 1000, 1, zombie ) setTimer ( function (zombie) if ( isElement ( zombie ) ) then table.insert( everyZombie, zombie ) end end, 1000, 1, zombie ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zombie ) -- ( "#ff0000[INFO]: #ffffffCriou Zumbi ", player, 0, 238, 0, true ) -------------- end setElementData(source,"lastzombiespawnposition",{x,y,z}) setElementData(source,"spawnedzombies",getElementData(source,"spawnedzombies")+3) zombiesaliveee = zombiesaliveee + 3 end end addEvent("createZomieForPlayer",true) addEventHandler("createZomieForPlayer",getRootElement(),createZomieForPlayer) getElementData(source, "spawnedzombies") ссылается на: function createZombieTable (player) --createtabel setElementData(player,"playerZombies",{"no","no","no","no","no","no","no","no","no"}) setElementData(player,"spawnedzombies",0) end Я, честно говоря, уже и понять не могу, в чём может быть дело... Проблема номер 2: Скрипт сохранения палаток и машин сохраняет их в свой .db файл. Я просматривал содержимое этого файла, там всё впорядке, но вот уже в игре при вводе команды /load всё считывается из базы данных и машины с палатками возвращаются на карту, вот только вращение у машин сохраняется, а у палаток сбрасывается в 0. Вот функции загрузки и сохранения машин и палаток: function loadDataBase() local qh = dbQuery(database,"SELECT * FROM vehicles") if qh then local result,num_affected_rows,errmsg = dbPoll(qh,-1) if num_affected_rows > 0 then for result,row in pairs (result) do createNewVehicle(row) end end end local qh = dbQuery(database,"SELECT * FROM tents") if qh then local result,num_affected_rows,errmsg = dbPoll(qh,-1) if num_affected_rows > 0 then for result,row in pairs (result) do createNewTent(row,"tent") end end end end function saveDataBased() outputChatBox(" ",getRootElement(),255,255,255,true) outputChatBox("#FF0000Project Paradise:#FFFFFF Идет сохранение данных сервера...",getRootElement(),255,255,255,true) destroyDataBase("tents") destroyDataBase("vehicles") for i,tent in ipairs(getElementsByType("colshape")) do if getElementData(tent,"tent") then local x,y,z = getElementPosition(tent) local col = getElementData(tent,"parent") local rotx,roty,rot = getElementRotation(getElementData(tent,"parent")) local dataT = {} local noDeleteTent = false for i,v in ipairs(serverData["items"]) do local data = getElementData(tent,v[1]) or 0 if data > 0 then noDeleteTent = true end table.insert(dataT,{v[1],data}) end if noDeleteTent == true then local result = dbQuery( database,"INSERT INTO `tents` VALUES ('"..x.."', '"..y.."', '"..z.."','"..toJSON(dataT).."', '"..rot.."');") dbFree (result) else destroyElement(tent) destroyElement(col) end end end for index,element in ipairs(getElementsByType("vehicle")) do local x,y,z = getElementPosition(element) local col = getElementData(element,"parent") local rotx,roty,rot = getElementRotation(element) local model = getElementModel(element) local health = getElementHealth(element) local dataT = {} for i,v in ipairs(serverData["items"]) do if col ~= false then local data = getElementData(col,v[1]) or 0 table.insert(dataT,{v[1],data}) end end for i,v in ipairs(serverData["vehicle"]) do if col ~= false then local data = getElementData(col,v[1]) or 0 table.insert(dataT,{v[1],data}) end end local result = dbQuery(database,"INSERT INTO `vehicles` VALUES ('"..model.."','"..x.."', '"..y.."', '"..z.."', '"..rot.."','"..health.."', '"..toJSON(dataT).."');") dbFree(result) end outputChatBox("#FF0000Project Paradise:#FFFFFF Сохранение данных успешно завершено..",getRootElement(),255,255,255,true) setTimer ( function() baseCopy() end,10000,1) end По моему, здесь всё впорядке и я подозреваю, что дело может крыться в функции установки палатки: function createNewTent(row,class) local data = fromJSON(row['data']) local x = tonumber(row['x']) local y = tonumber(row['y']) local z = tonumber(row['z']) local r = tonumber(row['r']) if class == "tent" then tent = createObject(2220,x,y,z,0,0,r) tentCol = createColSphere(x,y,z,4) attachElements(tentCol,tent,0,0,0) setElementData(tentCol,"parent",tent) setElementData(tent,"parent",tentCol) setElementData(tentCol,"tent",true) setElementData(tentCol,"vehicle",true) for i,v in pairs(data) do setElementData(tentCol,v[1],v[2]) end if getElementData(tentCol,"MAX_Slots") == false or nil then setElementData(tentCol,"MAX_Slots",200) end if getElementData(tentCol,"MAX_Slots") == 200 then setElementModel(tent,2220) elseif getElementData(tentCol,"MAX_Slots") == 300 then setElementModel(tent,2218) elseif getElementData(tentCol,"MAX_Slots") == 500 then setElementModel(tent,2222) end end end Хотя она идентична с функцией установки машин, но всё-равно почему-то не хочет работать... Функция установки машин: function createNewVehicle(row) local model = tonumber(row['model']) local data = fromJSON(row['data']) local x = tonumber(row['x']) local y = tonumber(row['y']) local z = tonumber(row['z']) local r = tonumber(row['r']) local health = tonumber(row['health']) veh = createVehicle(model,x,y,z,0,0,r) vehCol = createColSphere(x,y,z,3) attachElements(vehCol,veh,0,0,0) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"ID",row) setElementHealth(veh,health) for i,v in pairs(data) do setElementData(vehCol,v[1],v[2]) end end В общем, я не знаю, в чём проблема... Год назад всё нормальн оработало, но сейчас я просто запустил этот сервер и спавн зомби и загрузка вращения палаток перестали работать...
×
×
  • Create New...