-
Posts
17 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
rapgod1's Achievements
Square (6/54)
0
Reputation
-
When player enters to the server, he can remove cache files and can walk through objects. How I can fix it? enablesd: 14,22 meta.xml: <file src="cmodels/object.dff" type="client" download="false" /> client.lua: local replace = { {"object.txd","object.dff","object.col",2242}, } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),function() for _, data in ipairs(replace) do local name_txd = md5(data[1]) local name_dff = md5(data[2]) local name_col = md5(data[3]) if not fileExists("cmodels/"..name_txd) then downloadFile("cmodels/"..data[1]) end if not fileExists("cmodels/"..name_dff) then downloadFile("cmodels/"..data[2]) end if not fileExists("cmodels/"..name_col) then downloadFile("cmodels/"..data[3]) end if fileExists("cmodels/"..name_txd) then engineImportTXD(engineLoadTXD("cmodels/"..name_txd),data[4]) end if fileExists("cmodels/"..name_dff) then engineReplaceModel(engineLoadDFF("cmodels/"..name_dff,0),data[4]) end if fileExists("cmodels/"..name_col) then engineReplaceCOL(engineLoadCOL("cmodels/"..name_col,0),data[4]) end engineSetModelLODDistance(data[4],500) end end) addEventHandler("onClientFileDownloadComplete", getResourceRootElement(getThisResource()),function(file) for _, data in ipairs(replace) do if file == "cmodels/"..data[1] then local name_txd = md5(data[1]) if not fileExists("cmodels/"..data[1]) then return end fileRename("cmodels/"..data[1],"cmodels/"..name_txd) engineImportTXD(engineLoadTXD("cmodels/"..name_txd),data[4]) end if file == "cmodels/"..data[2] then local name_dff = md5(data[2]) if not fileExists("cmodels/"..data[2]) then return end fileRename("cmodels/"..data[2],"cmodels/"..name_dff) engineReplaceModel(engineLoadDFF("cmodels/"..name_dff,0),data[4]) end if file == "cmodels/"..data[3] then local name_col = md5(data[3]) if not fileExists("cmodels/"..data[3]) then return end fileRename("cmodels/"..data[3],"cmodels/"..name_col) engineReplaceCOL(engineLoadCOL("cmodels/"..name_col,0),data[4]) end end end)
-
You can use this: getDistanceBetweenPoints3D
-
Семь кругов ада одного дня хайпа (МТА и Массовый вход)
rapgod1 replied to PrototypeX's topic in Помощь / Отчеты об ошибках
Что лучше использовать вместо setElementData? -
No errors / warnings in debug. I think it's wrong: local hit,x,y,z,elementHit = processLineOfSight(x,y,z,vx,vy,vz) Can I get objects near the player?
-
Hello everyone. I tried to do a system, when player from one clan do anything, to near the player checked objects. 3 months ago it's worked, but now not function checkClick(button, state) if (button == "-") and state and tempOb[localPlayer] --[[and not isGui]] then local dist = 50 local x,y,z = getElementPosition(getLocalPlayer()) local xr,yr,zr = getElementRotation(getLocalPlayer()) local px, py, pz = getElementPosition(getLocalPlayer()) local prot = getCameraMatrix(getLocalPlayer()) local offsetRot = math.rad(prot+90) local vx = px + dist * math.cos(offsetRot) local vy = py + -(dist) * math.sin(offsetRot) local vz = pz local vrot = prot+180 local hit,x,y,z,elementHit = processLineOfSight(x,y,z,vx,vy,vz) local x1,y1,z1 = getElementPosition(localPlayer) local x2,y2,z2 = getElementPosition(tempOb[localPlayer]) if isElementWithinMarker(localPlayer, area51) then return end if isElementWithinMarker(localPlayer, zaerolv) then return end if isElementWithinMarker(localPlayer, sfarmy) then return end if getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) > 5 then exports.dayz:startRollMessage2("Inventory", "Подойдите ближе к объекту!", 255, 255, 0) return end if elementHit and isElement(elementHit) and getElementType(elementHit) == "object" then -- HERE local objectCreator = getElementData(elementHit,"bc.creator") local objectGroup = getElementData(elementHit,"bc.gang") if objectCreator then if getElementData(localPlayer,"playerlogin") == objectCreator or getElementData(localPlayer,"gang") == objectGroup then local x, y, z = getElementPosition(tempOb[localPlayer]) local rx, ry, rz = getElementRotation(tempOb[localPlayer]) local model = getElementModel(tempOb[localPlayer]) removeEventHandler("onClientRender", root, updatePos) destroyElement(tempOb[localPlayer]) tempOb[localPlayer] = nil triggerServerEvent("basecreator:newObject", localPlayer, model, x, y, z, rx, ry, rz, health ) active = false removeEventHandler("onClientKey", root, checkClick) removeEventHandler("onClientKey",root,setRotationOfObject) removeEventHandler("onClientKey", root, handleObDelete) takeItemsFromPlayer(model) guiSetVisible(baseCPanel.window[1], true) showCursor(not isCursorShowing()) else exports.dayz:startRollMessage2("Inventory", "Здесь нельзя строить!", 255, 255, 0) end end else local x, y, z = getElementPosition(tempOb[localPlayer]) local rx, ry, rz = getElementRotation(tempOb[localPlayer]) local model = getElementModel(tempOb[localPlayer]) removeEventHandler("onClientRender", root, updatePos) destroyElement(tempOb[localPlayer]) tempOb[localPlayer] = nil triggerServerEvent("basecreator:newObject", localPlayer, model, x, y, z, rx, ry, rz, health ) active = false removeEventHandler("onClientKey", root, checkClick) removeEventHandler("onClientKey",root,setRotationOfObject) removeEventHandler("onClientKey", root, handleObDelete) takeItemsFromPlayer(model) guiSetVisible(baseCPanel.window[1], true) showCursor(not isCursorShowing()) end end end What's wrong?
-
Hello everyone. If I build objects far from the standard map, I can look through objects (turning the camera). How to fix it? screenshot 1 screenshot 2
-
Rataj, thanks. Solved.
-
This is basically what I meant, thanks for detailing it I already set 'auto increment'. Now I try to set 'primary'.
-
I fix it. But I have any problem with ID's in database. For example: I place 3 objects And when I remove/destory object with ID 2, and again place 2 object. In database will be this: How to make, that there was no repetition in ID's?
-
Problem still exists. And yet another object removed. Can you give me your skype?
-
Hello everyone. I have a problem with this resource: click I place object, destroy it and after restart resource this object again created (why?). function newObject(model,x,y,z,rx,ry,rz,health,id) if model and x and y and z and rx and ry and rz then local ob = createObject(model, x, y, z, rx, ry, rz) local acName = getAccountName(getPlayerAccount(client)) setElementData(ob,"bc.creator",acName) setElementData(ob,"object.health",health) setElementData(ob,"bc.ID",id) triggerClientEvent("setTheObjectUnbreakable",root,ob) local encampment = getElementData(client,"Gang") if model == 3093 or model == 3029 then setupDoor(ob,encampment) end if ob then local x,y,z = getElementPosition(ob) local rx,ry,rz = getElementRotation(ob) local model = getElementModel(ob) dbExec(db, "INSERT INTO baseobjects VALUES (?,?,?,?,?,?,?,?,?,?,?)", count, model, acName, x, y, z, rx, ry, rz, health, tostring(encampment)) count = count+1 end end end addEvent("addon.basecreator:newObject", true) addEventHandler("addon.basecreator:newObject", root, newObject) function onObjectDamage(object,health,id) if object then dbExec(db,'UPDATE baseobjects SET health=? WHERE id=?',health,id) end end addEvent("onObjectDamage",true) addEventHandler("onObjectDamage",root,onObjectDamage) function onObjectDestroy(object,id) if object then if getElementData(object,"parent") then destroyElement(getElementData(object,"parent")) end destroyElement(object) dbExec(db,"DELETE FROM baseobjects WHERE id=?",id) count = count-1 end end addEvent("onObjectDestroy",true) addEventHandler("onObjectDestroy",root,onObjectDestroy) local db local count = 0 local DoorsTable = {} function onStart() if not fileExists("bases.db") then local h = fileCreate("bases.db") if h then fileClose(h) outputDebugString("[DayZ] Bases database not found, creating...") end db = dbConnect( "sqlite", "bases.db" ) outputDebugString("[DayZ] Inserting tables into database...") dbExec(db, "CREATE TABLE IF NOT EXISTS baseobjects(id INT AUTO_INCREMENT, model INT, owner VARCHAR, x FLOAT, y FLOAT, z FLOAT, rx FLOAT, ry FLOAT, rz FLOAT, health FLOAT, encampment VARCHAR)") outputDebugString("[DayZ] Tables inserted.") else db = dbConnect( "sqlite", "bases.db" ) local qh = dbQuery( db, "SELECT * FROM baseobjects" ) local result = dbPoll( qh, 10000 ) for i, ob in ipairs(result) do local tOb = createObject(ob['model'], ob['x'], ob['y'], ob['z'], ob['rx'], ob['ry'], ob['rz']) setTimer(function() if ob['health'] > 0 then triggerClientEvent("setTheObjectUnbreakable",root,tOb) end end,1000,1,tOb) setElementData(tOb, "bc.creator", ob['owner']) setElementData(tOb, "bc.ID", ob['id']) if ob['model'] == 3093 or ob['model'] == 3029 then setupDoor(tOb,ob['encampment']) end setElementData(tOb,"object.health",ob['health']) if getElementData(tOb,"object.health") <= 0 then if getElementData(tOb,"parent") then destroyElement(getElementData(tOb,"parent")) end destroyElement(tOb) end count = count + 1 end outputDebugString("[DayZ] Base objects loaded. TOTAL: "..tostring(count)) end end addEventHandler("onResourceStart", resourceRoot, onStart)
-
[Урок] Встроенные функции для работы с MySQL / SQLite
rapgod1 replied to MX_Master's topic in Уроки / Примеры
local queryHadle = dbQuery( sqlLink, -- ссылка на коннект с базой -- запрос "SELECT * FROM testTable;" ) queryHandle -
Вроде сделал, но вот одна проблема: если игрок поставит объект, он его не сможет удалить, только после рестарта ресурса (ниже будет видео). Как это можно исправить? server.lua:
-
Нет, к примеру игрок пишет команду, и мне нужно проверить его ник и приравнять его к нику (значению) из базы данных (не internal)