Jump to content

adi8908456

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

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

adi8908456's Achievements

Square

Square (6/54)

0

Reputation

  1. Hi! I have problem because I cant made my addon for dayz crafting to do it like this: make somewhere marker if player hit it crafting panel will open. Now its binded on key (F4) when i want to edit it all get buged so if you can help me. under my addon sry for eng GUIEditor = { tab = {}, tabpanel = {}, window = {}, combobox = {}, memo = {} } local items = { ["Bronie"] = { "Lekka siekiera", }, ["Others"] = { "tent", } } forwardscarfting = { {"Lekka siekiera",1,"Metal",1,"Drut",1,"---",0,"---",0}, {"tent",1,"Metal",2,"Drut",1,"---",0,"---",0}, } function getcraftingforwardsitems (text) for i,item in ipairs(forwardscarfting) do if item[1] == text then return item[2],item[3], item[4], item[5], item[6], item[7], item[8], item[9], item[10] end end end local backitems = { ["Broń"] = { "test", } } backwardscarfting = { {"test",1,"Aluminium",1,"---",0,"---",0,"---",0}, } function getcraftingbackwardsitems (text) for i,item in ipairs(backwardscarfting) do if item[1] == text then return item[2],item[3], item[4], item[5], item[6], item[7], item[8], item[9], item[10] end end end function opencrafting (key) setElementData(getLocalPlayer(),"---",100000) if getElementData(getLocalPlayer(),"craftingpannelstate") == 1 then setElementData(getLocalPlayer(),"craftingpannelstate",0) setElementData(getLocalPlayer(),"craftingpannelstate",0) guiSetVisible( plate,false) guiSetVisible( GUIEditor.window[1],false) showCursor(false) else setElementData(getLocalPlayer(),"craftingpannelstate",1) showCursor(true) GUIEditor.window[1] = guiCreateWindow(747, 381, 500, 299, "", false) -- GUIEditor.window[1] = guiCreateWindow(0.15, 0.28, 500, 299, "", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 19, 617, 270, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Instructions", GUIEditor.tabpanel[1]) GUIEditor.memo[1] = guiCreateMemo(15, 16, 445, 211, "Panel craftingu. W tym panelu możesz wytwarzać nowe przedmioty. \n1: nacisnij \"Wytwarzanie\" lub \"Pozyskiwanie\" by wytworzyć nowy przedmiot lub go rozebrać\n2: Wybierz kategorie ()\n3: Wybierz item który chcesz wytworzyć i sprawdź czy masz odpowiednie przedmioty do tego\n4: Jeżeli wszystko jest na zielono klikcnij wytwórz\n5: Kdy pasek sie załaduje będziesz mógł zobaczyć nowy przedmiot w ekwipunku. ", false, GUIEditor.tab[1]) guiMemoSetReadOnly(GUIEditor.memo[1], true) GUIEditor.tab[2] = guiCreateTab("Wytwarzanie", GUIEditor.tabpanel[1]) GUIEditor.combobox[1] = guiCreateComboBox(25, 44, 170, 120, "Kategoria", false, GUIEditor.tab[2]) GUIEditor.combobox[2] = guiCreateComboBox(225, 44, 170, 120, "Przedmiot", false, GUIEditor.tab[2]) local progressBar = guiCreateProgressBar( 25, 200, 430, 20, false, GUIEditor.tab[2] ) guiProgressBarSetProgress(progressBar,0 ) craftbutton = guiCreateButton(25, 160, 430, 30, "Wytwórz", false,GUIEditor.tab[2]) close = guiCreateButton(420, 19, 58, 20, "Zamknij", false, GUIEditor.tab[2]) local itemname = guiCreateLabel( 25, 80, 800,15, "Nazwa:", false,GUIEditor.tab[2] ) local Need1 = guiCreateLabel(25, 95, 800, 15,"Potrzeba:", false,GUIEditor.tab[2] ) local Need2 = guiCreateLabel(25, 110, 800, 15,"Potrzeba:", false,GUIEditor.tab[2] ) local Need3 = guiCreateLabel(25, 125, 800, 15,"Potrzeba:", false,GUIEditor.tab[2] ) local Need4 = guiCreateLabel(25, 140, 800, 15,"Potrzeba:", false,GUIEditor.tab[2] ) local infotext = guiCreateLabel (225, 95, 800, 15,"Postępuj z instrukcją", false,GUIEditor.tab[2] ) for key, value in pairs (items) do if type(value) == "table" then guiComboBoxAddItem(GUIEditor.combobox[1], key) end end addEventHandler("onClientGUIComboBoxAccepted", GUIEditor.combobox[1], function() local text = guiComboBoxGetItemText(GUIEditor.combobox[1], guiComboBoxGetSelected(GUIEditor.combobox[1])) guiComboBoxClear(GUIEditor.combobox[2]) for i, st in ipairs(items[text]) do guiComboBoxAddItem(GUIEditor.combobox[2], st) end end ) addEventHandler("onClientGUIComboBoxAccepted", GUIEditor.combobox[2], function() local num = guiComboBoxGetSelected ( GUIEditor.combobox[2] ) local item = tostring ( guiComboBoxGetItemText ( GUIEditor.combobox[2] , num ) ) local win,need1,need1quat,need2,need2quat,need3,need3quat,need4,need4quat = getcraftingforwardsitems(item) guiSetText ( itemname, "Nazwa: "..item.." wytworzysz: "..win ) guiSetText ( Need1,"Potrzeba: "..need1.."~>"..need1quat) if getElementData(getLocalPlayer(),need1) > need1quat-1 then guiLabelSetColor ( Need1,0,255,0 ) else guiLabelSetColor ( Need1,255,0,0 ) end guiSetText ( Need2,"Potrzeba: "..need2.."~>"..need2quat ) if getElementData(getLocalPlayer(),need2) > need2quat-1 then guiLabelSetColor ( Need2,0,255,0 ) else guiLabelSetColor ( Need2,255,0,0 ) end guiSetText ( Need3,"Potrzeba: "..need3.."~>"..need3quat ) if getElementData(getLocalPlayer(),need3) > need3quat-1 then guiLabelSetColor ( Need3,0,255,0 ) else guiLabelSetColor ( Need3,255,0,0 ) end guiSetText ( Need4,"Potrzeba: "..need4.."~>"..need4quat ) if getElementData(getLocalPlayer(),need4) > need4quat-1 then guiLabelSetColor ( Need4,0,255,0 ) else guiLabelSetColor ( Need4,255,0,0 ) end addEventHandler ( "onClientGUIClick", craftbutton, function() guiSetText ( infotext,"ERROR! Zgłoś to administracji" ) guiLabelSetColor ( infotext,255,1,255 ) if getElementData(getLocalPlayer(),"isinprog") then guiSetText ( infotext,"Please wait" ) guiLabelSetColor ( infotext,255,255,5 ) else if win then if getElementData(getLocalPlayer(),need1) > need1quat-1 and getElementData(getLocalPlayer(),need2) > need2quat-1 and getElementData(getLocalPlayer(),need3) > need3quat-1 and getElementData(getLocalPlayer(),need4) > need4quat-1 then guiSetText ( infotext,"Buduje..." ) guiSetEnabled ( craftbutton, false ) guiLabelSetColor ( infotext,0,150,0 ) function startpogressbar() guiProgressBarSetProgress(progressBar,guiProgressBarGetProgress (progressBar)+5 )setElementData(getLocalPlayer(),"isinprog",true) end setTimer(startpogressbar,500,20) function endpogressbar() setElementData(getLocalPlayer(),"isinprog",false) guiSetText ( infotext,"Zakończone! Przedmiot dodany do ekwipunku." ) guiLabelSetColor ( infotext,0,150,0 ) guiProgressBarSetProgress(progressBar,0 ) setElementData(getLocalPlayer(),need1,getElementData(getLocalPlayer(),need1)-need1quat) setElementData(getLocalPlayer(),need2,getElementData(getLocalPlayer(),need2)-need2quat) setElementData(getLocalPlayer(),need3,getElementData(getLocalPlayer(),need3)-need3quat) setElementData(getLocalPlayer(),need4,getElementData(getLocalPlayer(),need4)-need4quat) setElementData(getLocalPlayer(),item,getElementData(getLocalPlayer(),item)+win) guiSetEnabled ( craftbutton, true ) refreshInventory() guiSetText ( itemname, "przedmiot: "..item.." wytworzysz: "..win ) guiSetText ( Need1,"Potrzeba: "..need1.."~>"..need1quat) if getElementData(getLocalPlayer(),need1) > need1quat-1 then guiLabelSetColor ( Need1,0,255,0 ) else guiLabelSetColor ( Need1,255,0,0 ) end guiSetText ( Need2,"Potrzeba: "..need2.."~>"..need2quat ) if getElementData(getLocalPlayer(),need2) > need2quat-1 then guiLabelSetColor ( Need2,0,255,0 ) else guiLabelSetColor ( Need2,255,0,0 ) end guiSetText ( Need3,"Potrzeba: "..need3.."~>"..need3quat ) if getElementData(getLocalPlayer(),need3) > need3quat-1 then guiLabelSetColor ( Need3,0,255,0 ) else guiLabelSetColor ( Need3,255,0,0 ) end guiSetText ( Need4,"Potrzeba: "..need4.."~>"..need4quat ) if getElementData(getLocalPlayer(),need4) > need4quat-1 then guiLabelSetColor ( Need4,0,255,0 ) else guiLabelSetColor ( Need4,255,0,0 ) end end setTimer(endpogressbar,11000,1) else guiSetText ( infotext,"Nie masz wymaganych przedmiotów" ) guiLabelSetColor ( infotext,150,0,0 ) end else guiSetText ( infotext,"Proszę, wybierz przedmiot" ) guiLabelSetColor ( infotext,150,0,0 ) end end end, false ) end ) ------------------------------------------------------------------------------- GUIEditor.tab[3] = guiCreateTab("Pozyskiwanie", GUIEditor.tabpanel[1]) GUIEditor.combobox[3] = guiCreateComboBox(25, 44, 170, 120, "Kategoria", false, GUIEditor.tab[3]) GUIEditor.combobox[4] = guiCreateComboBox(225, 44, 170, 120, "Przedmiot", false, GUIEditor.tab[3]) local progressBar = guiCreateProgressBar( 25, 200, 430, 20, false, GUIEditor.tab[3] ) guiProgressBarSetProgress(progressBar,0 ) close2 = guiCreateButton(420, 19, 58, 20, "Zamknij", false, GUIEditor.tab[3]) bcraftbutton = guiCreateButton(25, 160, 430, 30, "Wytwórz", false,GUIEditor.tab[3]) local itemname = guiCreateLabel( 25, 80, 800,15, "przedmiot:", false,GUIEditor.tab[3] ) local Win1 = guiCreateLabel(25, 95, 800, 15,"Dostaniesz:", false,GUIEditor.tab[3] ) local Win2 = guiCreateLabel(25, 110, 800, 15,"Dostaniesz:", false,GUIEditor.tab[3] ) local Win3 = guiCreateLabel(25, 125, 800, 15,"Dostaniesz:", false,GUIEditor.tab[3] ) local Win4 = guiCreateLabel(25, 140, 800, 15,"Dostaniesz:", false,GUIEditor.tab[3] ) local infotext2 = guiCreateLabel (225, 95, 800, 15,"Proszę postępuj zgodznie z instrukcją", false,GUIEditor.tab[3] ) for key, value in pairs (backitems) do if type(value) == "table" then guiComboBoxAddItem(GUIEditor.combobox[3], key) end end addEventHandler("onClientGUIComboBoxAccepted", GUIEditor.combobox[3], function() local text = guiComboBoxGetItemText(GUIEditor.combobox[3], guiComboBoxGetSelected(GUIEditor.combobox[3])) guiComboBoxClear(GUIEditor.combobox[4]) for i, st in ipairs(backitems[text]) do guiComboBoxAddItem(GUIEditor.combobox[4], st) end end ) addEventHandler("onClientGUIComboBoxAccepted", GUIEditor.combobox[4], function() local num = guiComboBoxGetSelected ( GUIEditor.combobox[4]) local item = tostring ( guiComboBoxGetItemText ( GUIEditor.combobox[4] , num ) )
  2. I make better way to do it but have problem. What I add inventory.lua {"Log",1,"Cut"}, elseif itemInfo == "cut" then triggerServerEvent("onPlayercut", getLocalPlayer(), itemName) Survivorsystem.lua function onPlayercut(itemName) local playersource = source setPedAnimation(playersource, "BOMBER", "BOM_Plant", -1, false, false, false, false) setTimer(function() if itemName == "Log" then setElementData(source, "Wood", getElementData(source, "Wood") + 2) setElementData(playersource, itemName, getElementData(playersource, itemName) - 1) end end, 1500, 1) triggerClientEvent(playersource, "refreshInventoryManual", playersource) end addEvent("onPlayercut", true) addEventHandler("onPlayercut", getRootElement(), onPlayercut) Animation works but when its done waring and error come out and Log is still in inventory and i dont get 2 woods WARNING : line 780 bad argument @ 'getelementdata' [epected element at argument 1,got nil] ERROR: line 780 attempt to perform arithmetic on a boolean value
  3. Hi! I need another help with cuting down trees in DayZ. I have an script for cuting trees and i want to add setElementData(playersource, "Drewno", getElementData(playersource, "Drewno") + 1) (drewno is wood in eng) I do something like this But when i chop donw tree i dont have any wood in inventory if scieteDrzewo then setElementData(playersource, "Drewno", getElementData(playersource, "Drewno") + 1) end --setTimer(drzewaSpool, 120000,0) setTimer(drzewaSpool, 1000,0) addCommandHandler("drzewaspool", drzewaSpool) -- triggerServerEvent("scieteDrzewo", scinane_drzewo) addEvent("scieteDrzewo", true) addEventHandler("scieteDrzewo", resourceRoot, function() local x,y,z=getElementPosition(source) destroyElement(source) local obiekt=createObject(1463,x,y,z+0.-- s8) --> setElementData(obiekt, "tartak:wood:owner", client) triggerClientEvent("setObjectBreakable", obiekt, false) setPedAnimation(client) setTimer(function(obiekt) if obiekt and (getElementType(obiekt)=="object") then setElementData(obiekt, "tartak:wood:owner", false) end end, 60000, 1, obiekt) end) Only have errors with animation client (adi8908456) triggered serverside event setpedanimation, but event is not added serverside My all script local strefa=createColCuboid(-586,-206, 50, 160, 198, 40) setElementID(strefa,"tartak:cs") addEventHandler("onColShapeHit", strefa, function(el,md) if not md then return end if getElementType(el)~="player" then return end end) addEventHandler("onColShapeLeave", strefa, function(el,md) if not md then return end if getElementType(el)~="player" then return end takeWeapon(el,9) end) local maleDrzewa={ 618, 617, 700} -- te tez sie nadaja 776, 732, 730, 729 local duzeDrzewa={ 616, 615, 734, 733, 726} local scieteDrzewa={ 848, 847, 834, 832, 831 } local punkty={ -- pozycje z /gp, zostana pozniej obnizone o 1.3 przez kod automatycznie {-461.52,-148.38,73.47}, {-457.87,-154.04,74.61}, {-455.41,-163.37,76.78}, {-448.47,-159.67,75.40}, {-447.23,-139.58,70.04}, {-452.06,-129.05,66.13}, {-444.39,-122.48,64.11}, {-451.17,-107.18,61.60}, {-447.29,-99.55,60.25}, {-455.83,-92.08,59.58}, {-458.88,-83.95,59.76}, {-452.16,-81.03,59.51}, {-448.80,-74.99,59.41}, {-440.93,-79.68,59.05}, {-439.28,-91.01,58.91}, {-439.66,-104.82,60.75}, {-448.12,-118.93,63.36}, {-463.11,-50.33,59.96}, {-458.94,-46.21,59.94}, {-464.86,-43.94,59.96}, {-473.19,-51.01,60.12}, {-479.17,-41.73,60.00}, {-490.81,-46.27,60.29}, {-495.38,-49.95,60.42}, {-519.18,-40.83,61.54}, {-524.98,-47.41,62.14}, {-532.10,-43.61,62.62}, {-538.22,-46.68,63.08}, {-543.03,-44.82,63.38}, {-551.88,-38.86,63.93}, {-528.71,-39.62,62.27}, {-519.95,-50.17,61.80}, {-457.65,-138.68,70.13}, {-468.58,-141.06,71.56}, {-474.94,-149.34,74.34}, {-477.03,-139.00,71.09}, {-485.12,-134.01,69.43}, {-488.93,-141.82,72.75}, {-494.08,-138.39,71.59}, {-496.39,-132.94,69.49}, {-493.71,-124.51,66.74}, {-497.99,-117.62,65.06}, {-494.35,-113.84,64.47}, {-482.84,-112.51,63.77}, {-524.48,-114.92,65.32}, {-539.14,-116.10,66.27}, {-546.40,-107.43,63.89}, {-547.81,-98.72,63.48}, {-554.42,-75.63,63.63}, {-563.47,-74.26,64.17}, {-578.66,-38.70,65.03}, {-571.41,-41.95,64.71}, {-563.26,-38.35,64.40}, {-553.67,-43.80,63.96}, {-546.08,-39.96,63.62}, {-526.75,-26.69,60.45}, {-533.78,-19.86,61.31}, {-544.67,-23.69,63.14}, {-551.14,-16.59,63.12}, {-563.09,-22.91,63.64}, {-580.88,-15.88,63.61}, {-590.11,-35.18,64.25}, {-590.01,-19.22,63.48}, {-521.32,-15.93,59.24}, {-493.14,-17.21,56.79}, {-528.17,-129.33,69.44}, {-528.17,-129.33,69.44}, {-534.15,-137.96,73.15}, {-543.51,-131.48,70.93}, {-555.05,-132.30,71.76}, {-566.87,-150.80,77.32}, } local function czyMaleDrzewo(obiekt) local model=getElementModel(obiekt) for i,v in ipairs(maleDrzewa) do if v==model then return true end end return false end local function czyScieteDrzewo(obiekt) local model=getElementModel(obiekt) for i,v in ipairs(scieteDrzewa) do if v==model then return true end end return false end local function moznaSadzic(x,y,z) local cs=createColSphere(x,y,z,2) local el=getElementsWithinColShape(cs) destroyElement(cs) if #el>0 then return false end return true end local function drzewaSpool() -- funkcja ktora sadzi drzewa i powoduje ich wzrost for i,v in ipairs(punkty) do if math.random(1,4)==1 then if not v.obiekt or not isElement(v.obiekt) or getElementType(v.obiekt)~="object" then -- sadzimy male drzewko if moznaSadzic(v[1],v[2],v[3]-0.5) then local oid=maleDrzewa[math.random(1,#maleDrzewa)] v.obiekt=createObject(oid, v[1],v[2],v[3]-1.3) setObjectScale(v.obiekt,0.4) end elseif czyMaleDrzewo(v.obiekt) then local skala=getObjectScale(v.obiekt) if skala<0.99 then setObjectScale(v.obiekt,skala+0.2) else -- zmieniany na duze drzewo local oid=duzeDrzewa[math.random(1,#duzeDrzewa)] setElementModel(v.obiekt,oid) -- setElementData(v.obiekt,"customAction",{label="Zetnij",resource="lss-tartak",funkcja="menu_zetnij",args={drzewo=v.obiekt}}) setElementData(v.obiekt,"tartak:drzewo", true) end elseif czyScieteDrzewo(v.obiekt) then -- usuwamy sciete drzewo destroyElement(v.obiekt) v.obiekt=nil end end end end if scieteDrzewo then setElementData(playersource, "Drewno", getElementData(playersource, "Drewno") + 1) end --setTimer(drzewaSpool, 120000,0) setTimer(drzewaSpool, 1000,0) addCommandHandler("drzewaspool", drzewaSpool) -- triggerServerEvent("scieteDrzewo", scinane_drzewo) addEvent("scieteDrzewo", true) addEventHandler("scieteDrzewo", resourceRoot, function() local x,y,z=getElementPosition(source) destroyElement(source) local obiekt=createObject(1463,x,y,z+0.-- s8) --> setElementData(obiekt, "tartak:wood:owner", client) triggerClientEvent("setObjectBreakable", obiekt, false) setPedAnimation(client) setTimer(function(obiekt) if obiekt and (getElementType(obiekt)=="object") then setElementData(obiekt, "tartak:wood:owner", false) end end, 60000, 1, obiekt) end) local scinane_drzewo=nil local scinanie_timer=nil function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end local function zetnijDrzewo() if not scinane_drzewo then return end local c1,c2=getPedAnimation(localPlayer) -- if not c1 or c1~="chainsaw" or c2~="WEAPON_csaw" then return end triggerServerEvent("scieteDrzewo", scinane_drzewo) scinane_drzewo=nil -- if math.random(1,==1 then triggerServerEvent("onLaweczkaProgress", localPlayer) end -- if math.random(1,10)==1 then triggerServerEvent("onTreadProgress", localPlayer) end end function menu_zetnij(drzewo) -- outputChatBox("(( Tartak jest w trakcie przygotowywania. ))") -- if not args.drzewo or not isElement(args.drzewo) then return end local x,y=getElementPosition(localPlayer) local x2,y2=getElementPosition(drzewo) if getDistanceBetweenPoints2D(x,y,x2,y2)>5 then outputChatBox("(( Musisz podejść bliżej ))") return end if getPedWeapon(localPlayer)~=9 then outputChatBox("(( Musisz mieć w rękach piłę spalinową, aby ściąc drzewo. ))") return end triggerServerEvent("setPedAnimation", localPlayer, localPlayer) toggleControl("fire", false) setTimer(triggerServerEvent, 700, 1, "setPedAnimation", localPlayer, "CHAINSAW", "WEAPON_csaw", true) local rot = findRotation(x,y,x2,y2) setElementRotation(localPlayer, 0, 0, rot) scinane_drzewo=drzewo setElementFrozen(localPlayer, true) if isTimer(scinanie_timer) then killTimer(scinanie_timer) end scinanie_timer=setTimer(function(plr) zetnijDrzewo() setElementFrozen(plr, false) if not getElementData(plr, "kary:blokada_bicia") then toggleControl("fire", true) end end, math.random(7000,14000), 1, localPlayer) end -- triggerClientEvent("setObjectBreakable", source, false) addEvent("setObjectBreakable", true) addEventHandler("setObjectBreakable", resourceRoot, function(state) setObjectBreakable(source, state) end) -- obsluga forklifta -- w przyszlosci do przeniesienia do innego zasobu local function czyForkliftWiezieObiekty(v) local wiezione=getAttachedElements(v) for i,v in ipairs(wiezione) do if getElementType(v)=="object" then return true end end return false end local function checkForklift() local v=getPedOccupiedVehicle(localPlayer) if not v then return end if getElementModel(v)~=530 then return end local ap=getVehicleAdjustableProperty(v) if ap>0 then return end -- sprawdzamy czy juz cos wieziemy if czyForkliftWiezieObiekty(v) then triggerServerEvent("forklift_opusc", v) else -- podnosimy obiekt triggerServerEvent("forklift_podnies", v) end end bindKey("special_control_up", "up", checkForklift) bindKey("special_control_down", "up", checkForklift) -- scinanie drzewa lpm local function znajdzDrzewo() local x,y,z=getElementPosition(localPlayer) local drzewa=getElementsByType("object", resourceRoot) for i,v in ipairs(drzewa) do local x2,y2,z2=getElementPosition(v) if getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<5 then if getElementData(v,"tartak:drzewo") then return v end end end return nil end bindKey("fire", "down", function() if getPedWeaponSlot(localPlayer)~=1 or getPedWeapon(localPlayer)~=9 then return end local cs=getElementByID("tartak:cs") if not cs then return end if not isElementWithinColShape(localPlayer,cs) then return end local drzewo=znajdzDrzewo() if not drzewo then return end menu_zetnij(drzewo) end)
  4. i notice that when im shooting any gun it takes 2 ammo and debug script pop out warning : Bad argument @ 'destroyElement' [expected element at argument 1,got boolean]
  5. Selling someone work? http://mtaz.wikiforum.net/t7136-painel-de-login
  6. Hi! i have another problem. I added new weapon to dayz (m16a2) everything works but when i want to equip weapon it show a new weapon (m16) and old m4. Like 2 weapons in one, when i want to shoot for one shoot take two ammo. Have warning in debugscript survivorsystem.lua545: Bad argument @ 'destroyElement' [expected element at argument 1,got boolean] LINE 36 is 545 in script Script: 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 == "M16A2" then elementWeaponBack[source] = createObject(2726,x,y,z) setObjectScale(elementWeaponBack[source],0.875) elseif weapon1 == "NOME DA SUA ARMA" then elementWeaponBack[source] = createObject(2725,x,y,z) setObjectScale(elementWeaponBack[source],0.875) elseif weapon1 == "NOME DA SUA ARMA" then elementWeaponBack[source] = createObject(2644,x,y,z) setObjectScale(elementWeaponBack[source],0.875) elseif weapon1 == "NOME DA SUA ARMA" then elementWeaponBack[source] = createObject(2708,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 screenshoot : http://i.imgur.com/niYGhBY.png
  7. Hi! I'm editing dayz gamemode to polish and i have an error "error: DayZ/inventoryOLD.lua776:attempt to compare number with nil" I cant put engine,tire and tank parts to tent I translate engine to Silnik tire to Opona and tank parts to Częsci paliwowe (polish language) Pls help script: LINE 11 is 776 in script function onPlayerMoveItemOutOfInventory () if playerMovedInInventory then startRollMessage2("Inventory", "Abusing exploits will result in a ban!", 255, 22, 0 ) return end -- [iD:0000005 - Several grammar + spelling mistakes and typos] //L local itemName = guiGridListGetItemText ( gridlistItems["inventory"], guiGridListGetSelectedItem ( gridlistItems["inventory"] ), 1 ) if getElementData(getLocalPlayer(),itemName) and getElementData(getLocalPlayer(),itemName) >= 1 then if isPlayerInLoot() then local isVehicle = getElementData(isPlayerInLoot(),"vehicle") local isTent = getElementData(isPlayerInLoot(),"Namiot") if isVehicle and not isTent then local veh = getElementData(isPlayerInLoot(),"parent") local Opona,engine,parts = getVehicleAddonInfos (getElementModel(veh)) if itemName == "Opona" and (getElementData(isPlayerInLoot(),"Opona_inVehicle") or 0) < Opona or itemName == "Silnik" and (getElementData(isPlayerInLoot(),"Silnik_inVehicle") or 0) < engine or itemName == "Częsci paliwowe" and (getElementData(isPlayerInLoot(),"Częsci paliwowe_inVehicle") or 0) < parts then if itemName == "Częsci paliwowe" then itemName = "Parts" end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName.."_inVehicle",isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) <= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory", "Ekwipunek jest pełen!", 255, 22, 0 ) return end
  8. I fixed this two warnings but now have one error ERROR: line 465 attempt to index a boolean value Line 465 setAccountData(account,"spawn_x",getElementData(col,"spawn")[2]) some lines of login.lua counter = counter +1 account = getAccount("vehicle_number_"..counter,"ds4f9$") or false if not account then account = addAccount("vehicle_number_"..counter,"ds4f9$") end setAccountData(account,"spawn_x",getElementData(col,"spawn")[2]) setAccountData(account,"spawn_y",getElementData(col,"spawn")[3]) setAccountData(account,"spawn_z",getElementData(col,"spawn")[4]) for i, data in ipairs(vehicleDataTable) do setAccountData(account,data[1],getElementData(col,data[1])) end
  9. in my old gamemode it works. Maybe becouse i hange name of items like engine, tire... my login.lua local spawnPositions = { {-278.6669921875,-2882.1572265625,32.104232788086}, {-958.5595703125,-2887.9912109375,64.82421875}, {-1816.9375,-2748.18359375,1.7327127456665}, {-2816.166015625,-2439.0546875,2.4004096984863}, {-2941.5673828125,-1206.2373046875,2.7848854064941}, {-2911.51171875,-895.22265625,2.4013109207153}, {-2185.6669921875,2957.380859375,11.474840164185}, {272.2265625,2928.505859375,1.3713493347168}, {2803.943359375,595.9365234375,7.7612648010254}, {2883.7509765625,-178.4658203125,3.2714653015137}, {-233.46484375,-1735.8173828125,1.5520644187927}, {-1056.8720703125,2939.068359375,42.311294555664}, } local playerDataTable = { {"alivetime"}, {"skin"}, {"MAX_Slots"}, {"bandit"}, {"blood"}, {"food"}, {"thirst"}, {"temperature"}, {"currentweapon_1"}, {"currentweapon_2"}, {"currentweapon_3"}, {"bleeding"}, {"brokenbone"}, {"pain"}, {"cold"}, {"infection"}, {"humanity"}, {"zombieskilled"}, {"headshots"}, {"murders"}, {"banditskilled"}, {"Drewno"}, {"Bandaż"}, {"Butelka z wodą"}, {"Puszka makaronu"}, {"Puszka fasoli"}, {"Burger"}, {"Pudełko zapałek"}, {"M1911 Mag"}, {"M9 SD Mag"}, {"Desert Eagle Mag"}, {"M1911"}, {"M9 SD"}, {"Winchester 1866"}, {"PDW"}, {"Nóż"}, {"Lekka siekiera"}, {"Pizza"}, {"Morfina"}, {"Puszka oranżady"}, {"Pusty kanister"}, {"Pełny kanister"}, {"Flara"}, {"Karton mleka"}, {"PDW Mag"}, {"P90 Mag"}, {"Butla CO2"}, {"Collor Mag"}, {"AK-74 Mag"}, {"FN SCAR Mag"}, {"Tear Gas"}, {"Granat"}, {"Gaśnica"}, {"Spraycan"}, {"Molotov Cocktails"}, {"Desert Eagle"}, {"Sawn-Off Shotgun"}, {"SPAZ-12 Combat Shotgun"}, {"P90"}, {"Zegarek"}, {"Pieniądze"}, {"Apteczka"}, {"Tabletki rozgrzewające"}, {"M1 Grand"}, {"PDW"}, {"TEC-9"}, {"AK-74"}, --{"M136 Rocket Launcher"}, {"Torebka z krwią"}, {"GPS"}, {"Mapa San Andreas"}, {"Skrzynka z narzędziami"}, {"Ogrodzenie z drutu"}, {"Opona"}, {"Silnik"}, {"Częsci paliwowe"}, --{"M136 Rocket"}, {"CZ 550 Mag"}, {"M1 Grand Mag"}, {"FN SCAR"}, {"CZ 550"}, --{"Heat-Seeking RPG"}, {"Satchel"}, {"Gogle na podczerwień"}, {"Noktowizor"}, {"Namiot"}, {"Surowe mięso"}, {"Upieczone mięso"}, {"wojskowe ubrania"}, {"Ubranie snajpera"}, {"Ubranie cywilne"}, {"Stare ubrania"}, {"Kobiecy mundur policyjny"}, {"Mundur policyjny"}, {"Ubranie strażaka"}, {"Ubranie podróżnika"}, {"Kobiece ubranie podróżnika"}, {"Kobiece stare ubrania"}, {"Kobiece cywilne ubrania"}, {"Kobiece wojskowe ubrania"}, {"tabletki przeciwbólowe"}, {"Lornetka"}, {"Pusta butelka"}, {"Pusta puszka"}, {"Resztki jedzenia"}, {"1866 Slug"}, {"2Rnd. Slug"}, {"SPAZ-12 Pellet"}, {"Krótkofalówka"}, {"Baseball Bat"}, {"Topór strażacki"}, {"Molotov Cocktails"}, {"Satchel Charges"}, {"Chainsaw"}, {"Nightstick"}, {"Golf Club"}, {"Vibrator"}, {"Short tan Dildo"}, {"Pool Cue"}, {"Flowers"}, {"Long Purple Dildo"}, {"Krótkofalówka"}, {"Spadochron"}, } function playerLogin(username, pass, player) local playerID = getAccountData(getPlayerAccount(player),"playerID") account = getPlayerAccount(player) local x,y,z = getAccountData(account,"last_x"),getAccountData(account,"last_y"),getAccountData(account,"last_z") local skin = getAccountData(account,"skin") createZombieTable (player) if getAccountData(account,"isDead") then spawnDayZPlayer(player) return end spawnPlayer (player, x,y,z+0.5, math.random(0,360), skin, 0, 0) setElementFrozen(player, true) fadeCamera (player, true) setCameraTarget (player, player) setTimer( function(player) if isElement(player) then setElementFrozen(player, false) end end,500,1,player) playerCol = createColSphere(x,y,z,1.5) setElementData(player,"playerCol",playerCol) attachElements ( playerCol, player, 0, 0, 0 ) setElementData(playerCol,"parent",player) setElementData(playerCol,"player",true) for i,data in ipairs(playerDataTable) do local elementData = getAccountData(account,data[1]) if not elementData then if data[1] == "brokenbone" or data[1] == "pain" or data[1] == "cold" or data[1] == "infection" or data[1] == "currentweapon_1" or data[1] == "currentweapon_2" or data[1] == "currentweapon_3" or data[1] == "bandit" then elementData = elementData else elementData = 0 end end setElementData(player,data[1],elementData) end setElementData(player,"logedin",true) --Weapons --Old Weapons local weapon = getElementData(player,"currentweapon_1") if weapon then local ammoData,weapID = getWeaponAmmoType (weapon) giveWeapon(player,weapID,getElementData(player,ammoData), true ) end local weapon = getElementData(player,"currentweapon_2") if weapon then local ammoData,weapID = getWeaponAmmoType (weapon) giveWeapon(player,weapID,getElementData(player,ammoData), false ) end local weapon = getElementData(player,"currentweapon_3") if weapon then local ammoData,weapID = getWeaponAmmoType (weapon) giveWeapon(player,weapID,getElementData(player,ammoData), false ) end setElementModel(player, getElementData(player,"skin")) setElementData(player,"admin",getAccountData(account,"admin") or false) setElementData(player,"supporter",getAccountData(account,"supporter") or false) triggerClientEvent(player, "onClientPlayerDayZLogin", player) end addEvent("onPlayerDayZLogin", true) addEventHandler("onPlayerDayZLogin", getRootElement(), playerLogin) function playerRegister(username, pass, player) local number = math.random(table.size(spawnPositions)) local x,y,z = spawnPositions[number][1],spawnPositions[number][2],spawnPositions[number][3] spawnPlayer (player, x,y,z, math.random(0,360), 73, 0, 0) fadeCamera (player, true) setCameraTarget (player, player) playerCol = createColSphere(x,y,z,1.5) attachElements ( playerCol, player, 0, 0, 0 ) setElementData(playerCol,"parent",player) setElementData(playerCol,"player",true) ---------------------------------- --Player Items on Start for i,data in ipairs(playerDataTable) do if data[1] =="Bandaż" then setElementData(player,data[1],2) elseif data[1] =="tabletki przeciwbólowe" then setElementData(player,data[1],1) elseif data[1] =="MAX_Slots" then setElementData(player,data[1],8) elseif data[1] =="skin" then setElementData(player,data[1],73) elseif data[1] =="blood" then setElementData(player,data[1],12000) elseif data[1] =="temperature" then setElementData(player,data[1],37) elseif data[1] =="brokenbone" then setElementData(player,data[1],false) elseif data[1] =="pain" then setElementData(player,data[1],false) elseif data[1] =="cold" then setElementData(player,data[1],false) elseif data[1] =="infection" then setElementData(player,data[1],false) elseif data[1] =="food" then setElementData(player,data[1],100) elseif data[1] =="thirst" then setElementData(player,data[1],100) elseif data[1] =="currentweapon_1" then setElementData(player,data[1],false) elseif data[1] =="currentweapon_2" then setElementData(player,data[1],false) elseif data[1] =="currentweapon_3" then setElementData(player,data[1],false) elseif data[1] =="bandit" then
  10. I looked at all over Dayz and doesn't find 'vehicleManager'
  11. Hi! I need help, got 2 warnings in debugscript dayz/login.lua line 488 Bad argument @ 'setaccountdata' [expected account at argument 1,got boolean] dayz/login.lua line 487 Bad argument @ 'setaccountdata' [expected account at argument 1,got boolean] When i use command to make backup this information came up "backup will come in 1 min before small lag" then come much warnings (@up) and nothing script: line 17 and 18 are line 488 and 487 in script local vehicle = getElementData(col,"parent") local model = getElementModel(vehicle) local x,y,z = getElementPosition(vehicle) local rx,ry,rz = getElementRotation(vehicle) local health = getElementHealth(vehicle) setAccountData(account,"last_x",x) setAccountData(account,"last_y",y) setAccountData(account,"last_z",z) setAccountData(account,"last_rx",rx) setAccountData(account,"last_ry",ry) setAccountData(account,"last_rz",rz) setAccountData(account,"health",health) setAccountData(account,"model",model) setAccountData(account,"isExploded",getElementData(vehicle,"isExploded") or false) end end setAccountData(vehicleManager,"vehicleamount",counter) setAccountData(vehicleManager,"tentamount",counterTent) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), saveallvehicles) function doBackup () outputChatBox ("#ff0000WARNING! #8391D6 - SERVER BACKUP, SAVING TENTS AND VEHICLES, BEWARE OF SMALL LAG!",getRootElement(),27, 89, 224,true) saveallvehicles() outputChatBox ("#526F35DONE! #8391D6 - BACKUP HAS BEEN COMPLETED",getRootElement(),27, 89, 224,true) end function checkDoBackup () if gameplayVariables["backupenabled"] then setTimer(doBackup,3600000,0) end end
  12. Witam! Chce połączyć tak jakby 2 skrypty, o co mi chodzi mianowicie o to że chce by gracze mogli wpisywać /zamknij ( komenda na zamknięcie pojazdu) tylko w tz. Green zone. Czyli gracz jeżeli by wjechał do takiego green zone mógłby wpisać /zamknij /otworz jeżeli by wyjechał to pojazd automatycznie by sie otwierał i nie było by możliwości ponownego wpisania /zamknij /otworz Czy wie ktoś jak skutecznie edytować (połączyć) ten skrypt https://community.multitheftauto.com/ind ... ls&id=1287 np z https://community.multitheftauto.com/ind ... ls&id=2069 (bądź innym tego typu) Za wszelką pomoc dziękuje.
  13. Witam! Mam pewien problem ponieważ ostatnio dodawałem moonbeam na dayz i wszystko pięknie dodałem to co w tym linku: https://forum.multitheftauto.com/viewtopic.php?f=91&t=65555 do vehiclespawn, dodałem do VSC spawn dla niego czyli np /spawbmoonbeam i teraz mam problem poniewaz nie ma on na gorze ekranu "Fuel x/x" i gdy brakuje np silnika to nie można go wsadzić(jedynie itemy takie jak bandaż itp itd), juz kiedyś widziałem taki problem i ktos pisał ze zle sie to zrobiło. Moze wie ktoś jak go poprawnie wgrac? moje kody: Vehicle spawns gora skryptu moonSpawns = gameplayVariables.moonspawns vehicleAddonsInfo { 418, 4, 1, 1 }, Sam pojazd for i, veh in ipairs(moonSpawns) do local x, y, z = veh[1], veh[2], veh[3] veh = createVehicle(vehID, x, y, z) vehCol = createColSphere(x, y, z, 2.5) attachElements(vehCol, veh, 0, 0, 0) setElementData(vehCol, "parent", veh) setElementData(veh, "parent", vehCol) setElementData(vehCol, "vehicle", true) setElementData(vehCol, "MAX_Slots", 40) local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) setElementData(vehCol, "Tire_inVehicle", math.random(0, tires)) setElementData(vehCol, "Engine_inVehicle", math.random(0, engine)) setElementData(vehCol, "Parts_inVehicle", math.random(0, parts)) setElementData(vehCol, "spawn", { 418, x, y, z }) setElementData(vehCol, "fuel", 10) for i, items in ipairs(lootItems.helicrashsides) do local randomNumber = math.random(1, 10) if randomNumber == 5 then setElementData(vehCol, items[1], 1) end end end vehicleFuelInfo {418, 0.25}, VSC function SpawnDayZmoon(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then do local x, y, z = getElementPosition(thePlayer) veh = createVehicle(418, x + 5, y, z) vehCol = createColSphere(x + 5, y, z, 2.5) attachElements(vehCol, veh, 0, 0, 0) setElementData(vehCol, "parent", veh) setElementData(veh, "parent", vehCol) setElementData(vehCol, "vehicle", true) setElementData(vehCol, "MAX_Slots", 40) local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) setElementData(vehCol, "Tire_inVehicle", 4) setElementData(vehCol, "Engine_inVehicle", 1) setElementData(vehCol, "Parts_inVehicle", 1) setElementData(vehCol, "spawn", { 418, x, y, z }) setElementData(vehCol, "fuel", 80) setTimer(outputChatBox, 50, 1, "#6002B1[VSC]#FFFFFF-Ragina has been spawned!", thePlayer, 171, 205, 239, true) end else outputChatBox("#6002B1[VSC]#FF0000-You are not a admin!", thePlayer, 171, 205, 239, true) end end addCommandHandler("/reginaown", SpawnDayZRegina) vehicleAddonsInfo = { { 418, 4, 1, 1 } } function getVehicleAddonInfos(id) for i, veh in ipairs(vehicleAddonsInfo) do if veh[1] == id then return veh[2], veh[3], veh[4] end end end vehicleFuelInfo = { {418, 0.25} } function getVehicleAddonInfos(id) for i, veh in ipairs(vehicleAddonsInfo) do if veh[1] == id then return veh[2], veh[3], veh[4] end end end vehicleFuelTable = { {418, 80} } function getVehicleMaxFuel(loot) local modelID = getElementModel(getElementData(loot, "parent")) for i, vehicle in ipairs(vehicleFuelTable) do if modelID == vehicle[1] then return vehicle[2] end end return false end function onPlayerEnterDayzVehicle(veh, seat) local col = getElementData(dayZVeh, "parent") local id = getElementModel(dayZVeh) if not seat == 1 then return end local tires, engine, parts = getVehicleAddonInfos(id) setVehicleEngineState(dayZVeh, false) setElementData(dayZVeh, "maxfuel", getVehicleMaxFuel(col)) setElementData(dayZVeh, "needtires", tires) setElementData(dayZVeh, "needengines", engine) setElementData(dayZVeh, "needparts", parts) if getElementData(col, "Tire_inVehicle") or 0 < tonumber(tires) then setVehicleEngineState(dayZVeh, false) return end if getElementData(col, "Engine_inVehicle") or 0 < tonumber(engine) then setVehicleEngineState(dayZVeh, false) return end if not getElementData(col, "Parts_inVehicle") then setElementData(col, "Parts_inVehicle", math.random(0, parts)) end if getElementData(col, "fuel") or 1 >= 0 and not getElementModel(dayZVehBob) == 509 then triggerClientEvent(source, "displayClientInfo", source, "Vehicle", "No tank left in this vehicle!", 22, 255, 0) setVehicleEngineState(dayZVehBob, false) return end end
  14. Doesn't work, i have ss look http://zapodaj.net/4fc4d61317269.png.html http://zapodaj.net/0247362f3a335.png.html on my moonbeam there is only Engine tires and tank parts but no fuel, in my bobcat are. I was looking in dayz files for semething like "bobcat dx draw fuel" Or I do this wrong ;/ thanks,waiting for help
×
×
  • Create New...