NastaseValy

Members
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

0 Neutral

About NastaseValy

  • Rank
    Square
  • Birthday 12/05/1999

Details

  • Location
    Romania
  • Occupation
    Developer
  • Interests
    Scripting

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Who can help me and me with a basic resource for crafting? I have one myself, but I want something more complex CLIENT: baseCPanel = { edit = {}, button = {}, window = {}, label = {}, column = {}, gridlist = {}, tabpanel = {}, tab = {}, } objectTable = { -- Hatchet is a dummy item, in case you need less parts than expected -- DIY (Wood) or DIY (Metal) must always be the first item that is needed {"Wooden Base", 3260, 30, "Wood", "DIY (Wood)","Log","Stone","Hatchet",1,1,2,0}, {"Wood Fence", 1460, 30, "Wood", "DIY (Wood)", "Log","Stone","Hatchet",1,1,1,0}, {"Wooden Door", 3093, 30, "Wood", "DIY (Wood)", "Log", "Stone","Hatchet",1,1,1,0}, {"Wood Structure", 16404, 30, "Wood", "DIY (Wood)", "Log", "Plank", "Nails",1,1,3,5}, {"Metal Fence", 1412, 100, "Metal", "DIY (Metal)","RSJ","Stone","Hatchet",1,1,2,0}, {"Metal Door", 3029, 100, "Metal", "DIY (Metal)","RSJ","Nails","Hatchet",1,2,2,0}, {"Shack", 1457, 100, "Metal", "DIY (Metal)","Metal Sheet (Rusted)","Plank","Hatchet",1,2,2,0} } function render() baseCPanel.window[1] = guiCreateWindow(0.00, 0.37, 0.57, 0.61, "", true) guiWindowSetSizable(baseCPanel.window[1], false) guiSetVisible(baseCPanel.window[1], false) baseCPanel.tabpanel[1] = guiCreateTabPanel(0.03, 0.07, 0.95, 0.90, true, baseCPanel.window[1]) baseCPanel.tab[1] = guiCreateTab("Wood", baseCPanel.tabpanel[1]) baseCPanel.gridlist[1] = guiCreateGridList(0.01, 0.03, 0.36, 0.94, true, baseCPanel.tab[1]) baseCPanel.column[1] = guiGridListAddColumn(baseCPanel.gridlist[1], "Item", 0.9) baseCPanel.label[1] = guiCreateLabel(0.39, 0.04, 0.25, 0.06, "Item:", true, baseCPanel.tab[1]) baseCPanel.label[2] = guiCreateLabel(0.39, 0.10, 0.25, 0.06, "Durability:", true, baseCPanel.tab[1]) baseCPanel.label[3] = guiCreateLabel(0.59, 0.04, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[4] = guiCreateLabel(0.59, 0.10, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[5] = guiCreateLabel(0.39, 0.16, 0.25, 0.06, "Requires:", true, baseCPanel.tab[1]) baseCPanel.label[6] = guiCreateLabel(0.39, 0.22, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[7] = guiCreateLabel(0.39, 0.28, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[8] = guiCreateLabel(0.39, 0.34, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[9] = guiCreateLabel(0.39, 0.40, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[10] = guiCreateLabel(0.39, 0.46, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[11] = guiCreateLabel(0.39, 0.52, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[12] = guiCreateLabel(0.39, 0.68, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.button[1] = guiCreateButton(0.86, 0.88, 0.12, 0.08, "Place", true, baseCPanel.tab[1]) baseCPanel.tab[2] = guiCreateTab("Metal", baseCPanel.tabpanel[1]) baseCPanel.gridlist[2] = guiCreateGridList(0.01, 0.03, 0.36, 0.94, true, baseCPanel.tab[2]) baseCPanel.column[2] = guiGridListAddColumn(baseCPanel.gridlist[2], "Item", 0.9) baseCPanel.label[13] = guiCreateLabel(0.39, 0.04, 0.25, 0.06, "Item:", true, baseCPanel.tab[2]) baseCPanel.label[14] = guiCreateLabel(0.39, 0.10, 0.25, 0.06, "Durability:", true, baseCPanel.tab[2]) baseCPanel.label[15] = guiCreateLabel(0.59, 0.04, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[16] = guiCreateLabel(0.59, 0.10, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[17] = guiCreateLabel(0.39, 0.16, 0.25, 0.06, "Requires:", true, baseCPanel.tab[2]) baseCPanel.label[18] = guiCreateLabel(0.39, 0.22, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[19] = guiCreateLabel(0.39, 0.29, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[20] = guiCreateLabel(0.39, 0.35, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[21] = guiCreateLabel(0.39, 0.41, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[22] = guiCreateLabel(0.39, 0.48, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[23] = guiCreateLabel(0.39, 0.54, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[25] = guiCreateLabel(0.39, 0.60, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.button[2] = guiCreateButton(0.86, 0.88, 0.12, 0.08, "Place", true, baseCPanel.tab[2]) baseCPanel.tab[3] = guiCreateTab("Help", baseCPanel.tabpanel[1]) local row = 0 local row2 = 0 local name = "" local name2 = "" for i, item in ipairs(objectTable) do if item[4] == "Wood" then name = item[1] row = guiGridListAddRow (baseCPanel.gridlist[1]) end if item[4] == "Metal" then name2 = item[1] row2 = guiGridListAddRow(baseCPanel.gridlist[2]) end guiGridListSetItemText ( baseCPanel.gridlist[1], row, baseCPanel.column[1], name, false, false ) guiGridListSetItemText ( baseCPanel.gridlist[2], row2, baseCPanel.column[2], name2, false, false ) end addEventHandler("onClientGUIClick", baseCPanel.gridlist[1], function() getRequiredItems(1) end, false) addEventHandler("onClientGUIClick", baseCPanel.gridlist[2], function() getRequiredItems(2) end, false) end render() active = false function togPanel() if active then return end if isPedInVehicle(localPlayer) then return end guiSetVisible(baseCPanel.window[1], not guiGetVisible ( baseCPanel.window[1] )) showCursor(not isCursorShowing()) end bindKey ("F6", "down", togPanel) tempOb = {} dep = 5 multip = 1 local health = 0 --[[ function updatePos() local ob = tempOb[localPlayer] if ob then local x, y = getCursorPosition() local cX, cY, cZ = getCameraMatrix() if getKeyState("lshift") then multip = 4 else multip = 1 end if getKeyState("arrow_u") then dep = dep + .1 * multip outputChatBox("Dep = "..tostring(dep)) elseif getKeyState("arrow_d") then dep = dep - .1 * multip end local nX, nY, nZ = getWorldFromScreenPosition(x*cX, y*cY, dep) local aX, aY, aZ = getElementPosition(ob) if (aX ~= nX) or (aY ~= nY) or (aZ ~= nZ) then setElementPosition(ob, nX, nY, nZ) end end end ]] function updatePos() local object = tempOb[localPlayer] if object then local screenX, screenY = guiGetScreenSize() local x,y = getCursorPosition() local x,y = x*screenX,y*screenY local sX,sY,sZ = getWorldFromScreenPosition(x,y,0) local sX2,sY2,sZ2 = getWorldFromScreenPosition(x,y,20) local hit,oX,oY,oZ = processLineOfSight(sX,sY,sZ,sX2,sY2,sZ2,true,false,false,true,false,true,false,false,object) if not hit then return end setElementPosition(object,oX,oY,oZ + getElementDistanceFromCentreOfMassToBaseOfModel(object)) end end local rotationAxis = "z" function setRotationOfObject(button,state) local object = tempOb[localPlayer] if button == "arrow_u" or button == "arrow_d" then if state then rotationAxis="y" else rotationAxis="z" end elseif button == "arrow_r" or button == "arrow_l" then if state then rotationAxis="x" else rotationAxis="z" end end if not state then return end if button == "mouse_wheel_up" or button == "pgup" then if rotationAxis == "z" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y,z+5) elseif rotationAxis == "y" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y+5,z) elseif rotationAxis == "x" then local x,y,z = getElementRotation(object) setElementRotation(object,x+5,y,z) end elseif button == "mouse_wheel_down" or button == "pgdn" then if rotationAxis == "z" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y,z-5) elseif rotationAxis == "y" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y-5,z) elseif rotationAxis == "x" then local x,y,z = getElementRotation(object) setElementRotation(object,x-5,y,z) end end end isGui = false addEventHandler( "onClientMouseEnter", root, function () isGui = true end) addEventHandler( "onClientMouseLeave", root, function () isGui = false end) function checkClick(bt, state) if bt == "left" and state == "down" and tempOb[localPlayer] and not isGui 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("addon.basecreator:newObject", localPlayer, model, x, y, z, rx, ry, rz, health ) active = false removeEventHandler("onClientClick", root, checkClick) removeEventHandler("onClientKey",root,setRotationOfObject) removeEventHandler("onClientClick", root, handleObDelete) takeItemsFromPlayer(model) end end local gridlistnumber = 0 function handleObSpawn(_, state, x, y) if state == "up" and not tempOb[localPlayer] then local theObjectName = guiGridListGetItemText ( baseCPanel.gridlist[gridlistnumber], guiGridListGetSelectedItem ( baseCPanel.gridlist[gridlistnumber] ), 1 ) if theObjectName then for i, item in ipairs(objectTable) do if item[1] == theObjectName then if getElementData(localPlayer,item[5]) and getElementData(localPlayer,item[5]) >= item[9] then if getElementData(localPlayer,item[6]) and getElementData(localPlayer,item[6]) >= item[10] then if getElementData(localPlayer,item[7]) and getElementData(localPlayer,item[7]) >= item[11] then if getElementData(localPlayer,item[8]) and getElementData(localPlayer,item[8]) >= item[12] then local id = item[2] local pX,pY,pZ = getElementPosition(localPlayer) tempOb[localPlayer] = createObject(id, pX+2, pY+2, pZ, 0, 0, 0) health = item[3] if tempOb[localPlayer] then addEventHandler("onClientRender", root, updatePos) addEventHandler("onClientClick", root, checkClick) addEventHandler("onClientKey",root,setRotationOfObject) addEventHandler("onClientClick", root, handleObDelete) active = true setElementCollisionsEnabled(tempOb[localPlayer], false) setElementAlpha(tempOb[localPlayer],150) end else outputChatBox("You need "..item[8].." to build this!",255,0,0) return end else outputChatBox("You need "..item[7].." to build this!",255,0,0) return end else outputChatBox("You need "..item[6].." to build this!",255,0,0) return end else outputChatBox("You need "..item[5].." to build this!",255,0,0) return end end end
  2. I want a resource similar but more complex, better
  3. It can help myself and someone with a similar but more complex resource? A basic resource for the crefting CLIENT: ]]-- baseCPanel = { edit = {}, button = {}, window = {}, label = {}, column = {}, gridlist = {}, tabpanel = {}, tab = {}, } objectTable = { -- Hatchet is a dummy item, in case you need less parts than expected -- DIY (Wood) or DIY (Metal) must always be the first item that is needed {"Wooden Base", 3260, 30, "Wood", "DIY (Wood)","Log","Stone","Hatchet",1,1,2,0}, {"Wood Fence", 1460, 30, "Wood", "DIY (Wood)", "Log","Stone","Hatchet",1,1,1,0}, {"Wooden Door", 3093, 30, "Wood", "DIY (Wood)", "Log", "Stone","Hatchet",1,1,1,0}, {"Wood Structure", 16404, 30, "Wood", "DIY (Wood)", "Log", "Plank", "Nails",1,1,3,5}, {"Metal Fence", 1412, 100, "Metal", "DIY (Metal)","RSJ","Stone","Hatchet",1,1,2,0}, {"Metal Door", 3029, 100, "Metal", "DIY (Metal)","RSJ","Nails","Hatchet",1,2,2,0}, {"Shack", 1457, 100, "Metal", "DIY (Metal)","Metal Sheet (Rusted)","Plank","Hatchet",1,2,2,0} } function render() baseCPanel.window[1] = guiCreateWindow(0.00, 0.37, 0.57, 0.61, "", true) guiWindowSetSizable(baseCPanel.window[1], false) guiSetVisible(baseCPanel.window[1], false) baseCPanel.tabpanel[1] = guiCreateTabPanel(0.03, 0.07, 0.95, 0.90, true, baseCPanel.window[1]) baseCPanel.tab[1] = guiCreateTab("Wood", baseCPanel.tabpanel[1]) baseCPanel.gridlist[1] = guiCreateGridList(0.01, 0.03, 0.36, 0.94, true, baseCPanel.tab[1]) baseCPanel.column[1] = guiGridListAddColumn(baseCPanel.gridlist[1], "Item", 0.9) baseCPanel.label[1] = guiCreateLabel(0.39, 0.04, 0.25, 0.06, "Item:", true, baseCPanel.tab[1]) baseCPanel.label[2] = guiCreateLabel(0.39, 0.10, 0.25, 0.06, "Durability:", true, baseCPanel.tab[1]) baseCPanel.label[3] = guiCreateLabel(0.59, 0.04, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[4] = guiCreateLabel(0.59, 0.10, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[5] = guiCreateLabel(0.39, 0.16, 0.25, 0.06, "Requires:", true, baseCPanel.tab[1]) baseCPanel.label[6] = guiCreateLabel(0.39, 0.22, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[7] = guiCreateLabel(0.39, 0.28, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[8] = guiCreateLabel(0.39, 0.34, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[9] = guiCreateLabel(0.39, 0.40, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[10] = guiCreateLabel(0.39, 0.46, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[11] = guiCreateLabel(0.39, 0.52, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.label[12] = guiCreateLabel(0.39, 0.68, 0.25, 0.06, "", true, baseCPanel.tab[1]) baseCPanel.button[1] = guiCreateButton(0.86, 0.88, 0.12, 0.08, "Place", true, baseCPanel.tab[1]) baseCPanel.tab[2] = guiCreateTab("Metal", baseCPanel.tabpanel[1]) baseCPanel.gridlist[2] = guiCreateGridList(0.01, 0.03, 0.36, 0.94, true, baseCPanel.tab[2]) baseCPanel.column[2] = guiGridListAddColumn(baseCPanel.gridlist[2], "Item", 0.9) baseCPanel.label[13] = guiCreateLabel(0.39, 0.04, 0.25, 0.06, "Item:", true, baseCPanel.tab[2]) baseCPanel.label[14] = guiCreateLabel(0.39, 0.10, 0.25, 0.06, "Durability:", true, baseCPanel.tab[2]) baseCPanel.label[15] = guiCreateLabel(0.59, 0.04, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[16] = guiCreateLabel(0.59, 0.10, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[17] = guiCreateLabel(0.39, 0.16, 0.25, 0.06, "Requires:", true, baseCPanel.tab[2]) baseCPanel.label[18] = guiCreateLabel(0.39, 0.22, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[19] = guiCreateLabel(0.39, 0.29, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[20] = guiCreateLabel(0.39, 0.35, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[21] = guiCreateLabel(0.39, 0.41, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[22] = guiCreateLabel(0.39, 0.48, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[23] = guiCreateLabel(0.39, 0.54, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.label[25] = guiCreateLabel(0.39, 0.60, 0.25, 0.06, "", true, baseCPanel.tab[2]) baseCPanel.button[2] = guiCreateButton(0.86, 0.88, 0.12, 0.08, "Place", true, baseCPanel.tab[2]) baseCPanel.tab[3] = guiCreateTab("Help", baseCPanel.tabpanel[1]) local row = 0 local row2 = 0 local name = "" local name2 = "" for i, item in ipairs(objectTable) do if item[4] == "Wood" then name = item[1] row = guiGridListAddRow (baseCPanel.gridlist[1]) end if item[4] == "Metal" then name2 = item[1] row2 = guiGridListAddRow(baseCPanel.gridlist[2]) end guiGridListSetItemText ( baseCPanel.gridlist[1], row, baseCPanel.column[1], name, false, false ) guiGridListSetItemText ( baseCPanel.gridlist[2], row2, baseCPanel.column[2], name2, false, false ) end addEventHandler("onClientGUIClick", baseCPanel.gridlist[1], function() getRequiredItems(1) end, false) addEventHandler("onClientGUIClick", baseCPanel.gridlist[2], function() getRequiredItems(2) end, false) end render() active = false function togPanel() if active then return end if isPedInVehicle(localPlayer) then return end guiSetVisible(baseCPanel.window[1], not guiGetVisible ( baseCPanel.window[1] )) showCursor(not isCursorShowing()) end bindKey ("F6", "down", togPanel) tempOb = {} dep = 5 multip = 1 local health = 0 --[[ function updatePos() local ob = tempOb[localPlayer] if ob then local x, y = getCursorPosition() local cX, cY, cZ = getCameraMatrix() if getKeyState("lshift") then multip = 4 else multip = 1 end if getKeyState("arrow_u") then dep = dep + .1 * multip outputChatBox("Dep = "..tostring(dep)) elseif getKeyState("arrow_d") then dep = dep - .1 * multip end local nX, nY, nZ = getWorldFromScreenPosition(x*cX, y*cY, dep) local aX, aY, aZ = getElementPosition(ob) if (aX ~= nX) or (aY ~= nY) or (aZ ~= nZ) then setElementPosition(ob, nX, nY, nZ) end end end ]] function updatePos() local object = tempOb[localPlayer] if object then local screenX, screenY = guiGetScreenSize() local x,y = getCursorPosition() local x,y = x*screenX,y*screenY local sX,sY,sZ = getWorldFromScreenPosition(x,y,0) local sX2,sY2,sZ2 = getWorldFromScreenPosition(x,y,20) local hit,oX,oY,oZ = processLineOfSight(sX,sY,sZ,sX2,sY2,sZ2,true,false,false,true,false,true,false,false,object) if not hit then return end setElementPosition(object,oX,oY,oZ + getElementDistanceFromCentreOfMassToBaseOfModel(object)) end end local rotationAxis = "z" function setRotationOfObject(button,state) local object = tempOb[localPlayer] if button == "arrow_u" or button == "arrow_d" then if state then rotationAxis="y" else rotationAxis="z" end elseif button == "arrow_r" or button == "arrow_l" then if state then rotationAxis="x" else rotationAxis="z" end end if not state then return end if button == "mouse_wheel_up" or button == "pgup" then if rotationAxis == "z" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y,z+5) elseif rotationAxis == "y" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y+5,z) elseif rotationAxis == "x" then local x,y,z = getElementRotation(object) setElementRotation(object,x+5,y,z) end elseif button == "mouse_wheel_down" or button == "pgdn" then if rotationAxis == "z" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y,z-5) elseif rotationAxis == "y" then local x,y,z = getElementRotation(object) setElementRotation(object,x,y-5,z) elseif rotationAxis == "x" then local x,y,z = getElementRotation(object) setElementRotation(object,x-5,y,z) end end end isGui = false addEventHandler( "onClientMouseEnter", root, function () isGui = true end) addEventHandler( "onClientMouseLeave", root, function () isGui = false end) function checkClick(bt, state) if bt == "left" and state == "down" and tempOb[localPlayer] and not isGui 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("addon.basecreator:newObject", localPlayer, model, x, y, z, rx, ry, rz, health ) active = false removeEventHandler("onClientClick", root, checkClick) removeEventHandler("onClientKey",root,setRotationOfObject) removeEventHandler("onClientClick", root, handleObDelete) takeItemsFromPlayer(model) end end local gridlistnumber = 0 function handleObSpawn(_, state, x, y) if state == "up" and not tempOb[localPlayer] then local theObjectName = guiGridListGetItemText ( baseCPanel.gridlist[gridlistnumber], guiGridListGetSelectedItem ( baseCPanel.gridlist[gridlistnumber] ), 1 ) if theObjectName then for i, item in ipairs(objectTable) do if item[1] == theObjectName then if getElementData(localPlayer,item[5]) and getElementData(localPlayer,item[5]) >= item[9] then if getElementData(localPlayer,item[6]) and getElementData(localPlayer,item[6]) >= item[10] then if getElementData(localPlayer,item[7]) and getElementData(localPlayer,item[7]) >= item[11] then if getElementData(localPlayer,item[8]) and getElementData(localPlayer,item[8]) >= item[12] then local id = item[2] local pX,pY,pZ = getElementPosition(localPlayer) tempOb[localPlayer] = createObject(id, pX+2, pY+2, pZ, 0, 0, 0) health = item[3] if tempOb[localPlayer] then addEventHandler("onClientRender", root, updatePos) addEventHandler("onClientClick", root, checkClick) addEventHandler("onClientKey",root,setRotationOfObject) addEventHandler("onClientClick", root, handleObDelete) active = true setElementCollisionsEnabled(tempOb[localPlayer], false) setElementAlpha(tempOb[localPlayer],150) end else outputChatBox("You need "..item[8].." to build this!",255,0,0) return end else outputChatBox("You need "..item[7].." to build this!",255,0,0) return end else outputChatBox("You need "..item[6].." to build this!",255,0,0) return end else outputChatBox("You need "..item[5].." to build this!",255,0,0) return end end
  4. elementWeaponRaplace = {} function weaponReplace ( previousWeaponID, currentWeaponID ) --local source = getRootElement() local weapon1 = getElementData(source,"currentweapon_1") if not weapon1 then return end local ammoData1,weapID1 = getWeaponAmmoType(weapon1) local x,y,z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) if currentWeaponID == weapID1 then if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end if weapon1 == "DMR" then elementWeaponRaplace[source] = createObject(1671,x,y,z) elseif weapon1 == "SVD Camo" then elementWeaponRaplace[source] = createObject(1755,x,y,z) end if elementBackpack[source] then attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) else attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) end elseif previousWeaponID == weapID1 then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponReplace ) function removeBackWeaponOnDrop() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end function removeAttachedOnDeath() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end function backpackRemoveQuit() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end local weapon = getElementData(source,"currentweapon_1") if weapon then local ammoData,weapID = getWeaponAmmoType (weapon) giveWeapon(source,weapID,getElementData(source,ammoData), false ) end function weaponSwitchBack ( previousWeaponID, currentWeaponID ) local weapon1 = getElementData(source,"currentweapon_1") if not weapon1 then return end local ammoData1,weapID1 = getWeaponAmmoType(weapon1) local x,y,z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end if weapon1 == "DMR" then elementWeaponBack[source] = createObject(1671,x,y,z) setObjectScale(elementWeaponBack[source],0.875) elseif weapon1 == "SVD" then elementWeaponBack[source] = createObject(1755,x,y,z) setObjectScale(elementWeaponBack[source],0.875) else elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1),x,y,z) setObjectScale(elementWeaponBack[source],0.875) end if elementBackpack[source] then attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.31,-0.1,0,270,-90) else attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.11,-0.1,0,270,10) end elseif currentWeaponID == weapID1 then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end end ERROR: Loading script failed: dayz/final.lua:105:'end' expected (to close 'function' at line 43) near ''
  5. Can you help me?? elementWeaponRaplace = {} function weaponReplace ( previousWeaponID, currentWeaponID ) --local source = getRootElement() local weapon1 = getElementData(source,"currentweapon_1") if not weapon1 then return end local ammoData1,weapID1 = getWeaponAmmoType(weapon1) local x,y,z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) if currentWeaponID == weapID1 then if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end if weapon1 == "DMR" then elementWeaponRaplace[source] = createObject(1671,x,y,z) elseif weapon1 == "SVD Camo" then elementWeaponRaplace[source] = createObject(1755,x,y,z) end if elementBackpack[source] then attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) else attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) end elseif previousWeaponID == weapID1 then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponReplace ) function removeBackWeaponOnDrop() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end function removeAttachedOnDeath() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end function backpackRemoveQuit() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end local weapon = getElementData(source,"currentweapon_1") if weapon then local ammoData,weapID = getWeaponAmmoType (weapon) giveWeapon(source,weapID,getElementData(source,ammoData), false ) end function weaponSwitchBack ( previousWeaponID, currentWeaponID ) local weapon1 = getElementData(source,"currentweapon_1") if not weapon1 then return end local ammoData1,weapID1 = getWeaponAmmoType(weapon1) local x,y,z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end if weapon1 == "DMR" then elementWeaponBack[source] = createObject(1671,x,y,z) setObjectScale(elementWeaponBack[source],0.875) elseif weapon1 == "SVD" then elementWeaponBack[source] = createObject(1755,x,y,z) setObjectScale(elementWeaponBack[source],0.875) else elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1),x,y,z) setObjectScale(elementWeaponBack[source],0.875) end if elementBackpack[source] then attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.31,-0.1,0,270,-90) else attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.11,-0.1,0,270,10) end elseif currentWeaponID == weapID1 then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end ERROR: Loading script failed: dayz/final.lua:106:'end' expected (to close 'function' at line 53) near ''
  6. I have added some new weapons and SVD DMR. We solved all their bugs, but when I load a weapon skin (CZ, DMR, SVD) put the same skin on all three weapons. What is the problem?
  7. Thanks a lot, no error, but why do I load the weapon skins?
  8. THX! And here? weaponSkinTable = { {"dmr",1,"DMR"}, {"svdcamo",1,"SVD Camo"}, } weaponTXD = {} weaponDFF = {} function loadTheSkins() for i, skin in ipairs(weaponSkinTable) do weaponTXD[i] = engineLoadTXD(":DayZ/models/weapons/txd/"..skin[1]..".txd") weaponDFF[i] = engineLoadDFF(":DayZ/models/weapons/dff/"..skin[1]..".dff", 0) end end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loadTheSkins) ERROR: Loading script failed: [DayZ-Mod]/dayz/loadskin.lua:15: '' expected near 'end'
  9. Thank you for Loadskin. but I still give me error replacemodel, i also added an end as you said local loaded = false function onClientPlayerSkinChange(prevSlot,newSlot) local getSlot = getPedWeaponSlot(localPlayer) if newSlot == 0 then loaded = false elseif newSlot == 3 then if getElementData(localPlayer,"currentweapon_1") == "DMR" then if not loaded then engineImportTXD(weaponTXD[1], 358) engineReplaceModel(weaponDFF[1],358) loaded = true else return end elseif getElementData(localPlayer,"currentweapon_1") == "SVD Camo" then if not loaded then engineImportTXD(weaponTXD[2], 358) engineReplaceModel(weaponDFF[2],358) loaded = true else return end else engineRestoreModel(358) loaded = false end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) ERROR: Loading script falied: [DayZ-Mod]/dayz/replacemodel.lua:28: 'end' expected (to close 'if' at line 5) near ''
  10. Load skin: weaponTXD = {} weaponDFF = {} function loadTheSkins() for i, skin in ipairs(weaponSkinTable) do weaponTXD[i] = engineLoadTXD(":DayZ/models/weapons/txd/"..skin[1]..".txd") weaponDFF[i] = engineLoadDFF(":DayZ/models/weapons/dff/"..skin[1]..".dff", 0) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loadTheSkins) ERROR: [DayZ-Mod]/dayz/loadskin.lua:5: bad argument #1 to 'ipairs' (table expected, got nil) Replace model: local loaded = false function onClientPlayerSkinChange(prevSlot,newSlot) local getSlot = getPedWeaponSlot(localPlayer) if newSlot == 0 then loaded = false elseif newSlot == 3 then if getElementData(localPlayer,"currentweapon_1") == "DMR" then if not loaded then engineImportTXD(weaponTXD[1], 358) engineReplaceModel(weaponDFF[1],358) loaded = true else return end elseif getElementData(localPlayer,"currentweapon_1") == "SVD Camo" then if not loaded then engineImportTXD(weaponTXD[2], 358) engineReplaceModel(weaponDFF[2],358) loaded = true else return end else engineRestoreModel(358) loaded = false addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) ERROR: Loading script falied: [DayZ-Mod]/dayz/replacemodel.lua:27: 'end' expected (to close 'if' at line near ''
  11. Rename script gatescript and add in META :
  12. clanGate = createObject(10828,1588.4,2335.5,18, 0,0,90) function openGate(thePlayer) local playerClan = getElementData(thePlayer, "...GROUP OR GANG....") or "No Clan" if playerClan == "....NAMECLAN...." then moveObject (clanGate, 2500, 1588.4, 2335.5, 5) end end addCommandHandler("....PASSWORDOPEN....", openGate) function closeGate(thePlayer) local playerClan = getElementData(thePlayer, "....GROUP OR GANG....") or "No Clan" if playerClan == "......NAMECLAN....." then moveObject(clanGate, 2500,1588.4,2335.5,18) end end addCommandHandler("....PASSWORDCLOSE....", closeGate)
  13. On the same gun put more skin , put skin if the DMR put on cz550 and SVD , if have to put skin and SVD will pit on cz550 and DMR
  14. Am si eu o problema, am adaugat niste arme noi la server-ul meu de DayZ (DMR si SVD Camo) . Si am niste probleme: Am rezolvad bug-ul cu munitia infinita la armele noi dar a aparut altceva, cand trag cu DMR si am si maguri de CZ550 la mine imi ia si din mag-urile de la DMR din pripriile gloante si din gloantele de la CZ 550 si la SVD Camo la fel, Ce ar trebui sa fac?? Si daca pun skin pe DMR / SVD Camo / CZ550 se pun toate skinurile pe aceeasi arma, cum ar fi sa am mai multe arme in mana, cum fac sa scap de acest bug? Va rog ajutor!