MrDante

Members
  • Content Count

    176
  • Joined

  • Last visited

Community Reputation

2 Neutral

2 Followers

About MrDante

  • Rank
    Mark
  • Birthday 05/08/2002

Details

  • Gang
    Elite Gaming
  • Interests
    I do technology, revolutionary!

Recent Profile Visitors

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

  1. No que exatamente você precisa de ajuda? Está acontecendo algum erro? Percebi alguns no código, a variável skinPulicia seria o Pickup criado? Se sim, reverte a linha do 'addEventHandler', a onde está skinPulicia você altera pra farda, e farda você altera pra skinPulicia. No addCommandHandler, retire o skinPulicia do final, para verificar se o jogador está em cima da Pickup, você precisa criar um Marker/ColShape na mesma posição, exemplo -------------------- COM MARKER --------------------- local markerFarda = createMarker(pos1, pos2, pos3, "cylinder", 1, 0, 0, 0, 0) local skinPulicia = createPickup(...) function pickupHit (theElem) outputChatBox("Utilize /trabalhar para pegar a farda", theElem, 255,0,0) end addEventHandler("onPickupHit", skinPulicia, pickupHit) function comandoFarda (theElem) if isElementWithinMarker(theElem, markerFarda) then setElementModel(theElem, 285) -- Utilize setElementModel ao invés de setPedSkin, pois em versões futuras do MTA essa função pode não estar funcionando. end end addCommandHandler("trabalhar", comandoFarda) --------------------- COM COLSHAPE (EXEMPLO UTILIZANDO COL CIRCLE) --------------------- local colFarda = createColCircle(pos1, pos2, pos3, 2.0) local skinPulicia = createPickup(...) function pickupHit (theElem) outputChatBox("Utilize /trabalhar para pegar a farda", theElem, 255,0,0) end addEventHandler("onPickupHit", skinPulicia, pickupHit) function comandoFarda (theElem) if isElementWithinColShape(theElem, colFarda) then setElementModel(theElem, 285) -- Utilize setElementModel ao invés de setPedSkin, pois em versões futuras do MTA essa função pode não estar funcionando. end end addCommandHandler("trabalhar", comandoFarda)
  2. Why function "deleteTabela" is using? Ever Delete Data when call function saveDatabase. You want update the Data?
  3. Hi guys, I have a problem with the database, don't update and don't display errors in theDebugScript, the problem is when the eventName "onResourceStop" will UPDATE the Database, but i don't UPDATE. I trying use dbFREE, dbQuery and dbExec, it still doesn't work NOTE: OOP use B = { Database = {}, InventoryData = {} } function onSystemConnect () B.Database.create = Connection("sqlite", "files/database/inventory.db"); if (eventName == "onResourceStart") then if (B.Database.create) then local query = B.Database.create:query("CREATE TABLE IF NOT EXISTS inventoryData ('ID' int NOT NULL, 'SLOT' tinyint NOT NULL, 'NAME' varchar(30), 'TYPE' varchar(10), 'IDType' tinyint, 'AMOUNT' tinyint);"); local poll = query:poll(-1); if (poll) then local selectTable = B.Database.create:query("SELECT * FROM inventoryData"); local pollTable = selectTable:poll(-1); if (pollTable) then if (#pollTable == 0) then for k, v in ipairs (Element.getAllByType("player")) do B.InventoryData[v] = {} for i = 1, 18 do local setTable = B.Database.create:query("INSERT INTO inventoryData ('ID', 'SLOT', 'NAME', 'TYPE', 'IDType', 'AMOUNT') VALUES (?, ?, ?, ?, ?, ?)", v:getData("TN:IDSYSTEM"), i, 'empyt', 'empyt', 0, 0); local resultTable = setTable:poll(-1); if (resultTable) then table.insert(B.InventoryData[v], {["ID"] = v:getData("TN:IDSYSTEM"), ["NAME"] = "empyt", ["TYPE"] = "empyt", ["IDType"] = 0, ["AMOUNT"] = 0}); end end end return; end for k, v in ipairs(Element.getAllByType("player")) do B.InventoryData[v] = {} for i = 1, #pollTable do if (v:getData("TN:IDSYSTEM") == pollTable[i]["ID"]) then table.insert(B.InventoryData[v], {["ID"] = v:getData("TN:IDSYSTEM"), ["NAME"] = pollTable[i]["NAME"], ["TYPE"] = pollTable[i]["TYPE"], ["IDType"] = pollTable[i]["IDType"], ["AMOUNT"] = pollTable[i]["AMOUNT"]}); print(pollTable[1]["NAME"]) end end end end end end elseif (eventName == "onResourceStop") then if (B.Database.create) then for k, v in ipairs (Element.getAllByType("player")) do local data = B.InventoryData[v]; if (data) then for i = 1, #data do B.Database.create:exec("UPDATE inventoryData SET 'NAME' = ?, 'TYPE' = ?, 'IDType' = ?, 'AMOUNT' = ? WHERE 'ID' = ? AND 'SLOT' = ?", data[i]["NAME"], data[i]["TYPE"], data[i]["IDType"], data[i]["AMOUNT"], data[i]["ID"], i); end end end end end end addEventHandler("onResourceStart", resourceRoot, onSystemConnect) addEventHandler("onResourceStop", resourceRoot, onSystemConnect)
  4. MrDante

    [HELP] Clothes

    function setPedClothes(thePed, clothingSlot, clothingID) if not isElement(thePed) or type(clothingSlot) ~= "number" then error("Invalid arguments to setPedClothes()!", 2) end if not clothingID then return removePedClothes(thePed, clothingSlot) end local hasClothes = getPedClothes(thePed, clothingSlot) if hasClothes then removePedClothes(thePed, clothingSlot) end local texture, model = getClothesByTypeIndex(clothingSlot, clothingID) return addPedClothes(thePed, texture, model, clothingSlot) end function roupat () if (getPlayerMoney(source) >= 10) then takePlayerMoney(source, 10) setPedClothes(source, 0, 11) end end addEvent("roupa1", true) addEventHandler("roupa1", root, roupat)
  5. STOLEN: https://community.multitheftauto.com/index.php?p=resources&s=details&id=14391 ORIGINAL: https://community.multitheftauto.com/index.php?p=resources&s=details&id=14232
  6. MrDante

    Hud help

    function drawHud() local screenW,screenH = guiGetScreenSize() local time = getRealTime() local hour = time.hour local minute = time.minute local health = getElementHealth(localPlayer) local armor = getPedArmor(localPlayer) local oxygen = getPedOxygenLevel(localPlayer) local weapon = getPedWeapon(localPlayer) local weaponname = getWeaponNameFromID(weapon) local currentammo = getPedAmmoInClip(localPlayer) local maxammo = getPedTotalAmmo(localPlayer)-(currentammo) local vehicle = getPedOccupiedVehicle(localPlayer) setPlayerHudComponentVisible("clock",false) setPlayerHudComponentVisible("armour",false) setPlayerHudComponentVisible("breath",false) setPlayerHudComponentVisible("health",false) setPlayerHudComponentVisible("money",false) setPlayerHudComponentVisible("wanted",false) setPlayerHudComponentVisible("weapon",false) setPlayerHudComponentVisible("ammo",false) dxDrawRectangle(screenW * 0.8631 - 3, screenH * 0.0644 - 3, screenW * 0.1175 + 6, screenH * 0.0256 + 6, tocolor(0, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.0644, screenW * 0.1175, screenH * 0.0256, tocolor(222, 0, 0, 100), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.0644, screenW * 0.1175/(math.floor(health) > 100 and 200 or 100)*health, screenH * 0.0256, tocolor(222, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631 - 3, screenH * 0.1011 - 3, screenW * 0.1175 + 6, screenH * 0.0256 + 6, tocolor(0, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1011, screenW * 0.1175, screenH * 0.0256, tocolor(122, 122, 122, 100), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1011, screenW * 0.1175/100*armor, screenH * 0.0256, tocolor(122, 122, 122, 255), false) dxDrawText(hour..":"..minute.."", screenW * 0.8631 + 2, screenH * 0.0278 + 2, screenW * 0.9806, screenH * 0.0533, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(hour..":"..minute.."", screenW * 0.8631, screenH * 0.0278, screenW * 0.9806, screenH * 0.0533, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(health).."%", screenW * 0.8631 + 2, screenH * 0.0644 + 2, screenW * 0.9806, screenH * 0.0900, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(health).."%", screenW * 0.8631, screenH * 0.0644, screenW * 0.9806, screenH * 0.0900, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(armor).."%", screenW * 0.8631 + 2, screenH * 0.1011 + 2, screenW * 0.9806, screenH * 0.1267, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(armor).."%", screenW * 0.8631, screenH * 0.1011, screenW * 0.9806, screenH * 0.1267, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) if (oxygen < 1000 or isElementInWater(localPlayer)) or (isElementInWater(vehicle)) then dxDrawRectangle(screenW * 0.8631 - 3, screenH * 0.1378 - 3, screenW * 0.1175 + 6, screenH * 0.0256 + 6, tocolor(0, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1378, screenW * 0.1175, screenH * 0.0256, tocolor(222, 222, 0, 100), false) dxDrawRectangle(screenW * 0.8631, screenH * 0.1378, screenW * 0.1175/1000*oxygen, screenH * 0.0256, tocolor(222, 222, 0, 255), false) dxDrawText(math.floor(oxygen).."%", screenW * 0.8631 + 2, screenH * 0.1378 + 2, screenW * 0.9806, screenH * 0.1633, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(math.floor(oxygen).."%", screenW * 0.8631, screenH * 0.1378, screenW * 0.9806, screenH * 0.1633, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631 + 2, screenH * 0.1744 + 2, screenW * 0.9806, screenH * 0.2000, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631, screenH * 0.1744, screenW * 0.9806, screenH * 0.2000, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) else dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631 + 2, screenH * 0.1744 + 2, screenW * 0.9806, screenH * 0.1300, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(weaponname.." | "..currentammo.."/"..maxammo, screenW * 0.8631, screenH * 0.1744, screenW * 0.9806, screenH * 0.1300, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) end end addEventHandler("onClientRender",root,drawHud) function deleteHud() setPlayerHudComponentVisible("clock",true) setPlayerHudComponentVisible("armour",true) setPlayerHudComponentVisible("breath",true) setPlayerHudComponentVisible("health",true) setPlayerHudComponentVisible("money",true) setPlayerHudComponentVisible("wanted",true) setPlayerHudComponentVisible("weapon",true) setPlayerHudComponentVisible("ammo",true) end addEventHandler("onClientResourceStop",root,deleteHud)
  7. It exists and works, because before using the download = "false" attribute in meta, the script was working.
  8. I'm Brazilian, Sorry my bad english Hi Guys, I need help! I made a modloader, it is totally correct, however I did the following, on the server side, send a table to the client, with the correct files, and also is in the meta, however, for testing, when typing /loadMod, the client side can not verify that the file exists, that it exists and is in the meta. I had made it work, but before using the attribute in the meta download="false", now using, can not verify ... Can anyone help? Client-side: Boxs = { download = {}, size = 0 } addEvent(getThisResource().name..": onClientSystem", true); addEventHandler(getThisResource().name..": onClientSystem", root, function (args) if (args[1] == "files-load") then for k, v in ipairs (args[3]) do local txd = v[4].."/"..args[2].."/"..v[3].."/"..v[2]..".txd"; local dff = v[4].."/"..args[2].."/"..v[3].."/"..v[2]..".dff"; local col = v[4].."/"..args[2].."/"..v[3].."/"..v[2]..".col"; if (fileExists(txd)) then local txdFile = fileOpen(txd); Boxs.size = Boxs.size + txdFile:getSize(); downloadFile(v[4].."/"..args[2].."/"..v[3].."/"..v[2]..".txd"); txdFile:close(); end if (fileExists(dff)) then local dffFile = fileOpen(dff); Boxs.size = Boxs.size + dffFile:getSize(); downloadFile(v[4].."/"..args[2].."/"..v[3].."/"..v[2]..".dff"); fileClose(dffFile); end if (fileExists(col)) then local colFile = fileOpen(col); Boxs.size = Boxs.size + colFile:getSize(); downloadFile(v[4].."/"..args[2].."/"..v[3].."/"..v[2]..".col"); fileClose(colFile); end Boxs.download[v[4].."/"..args[2].."/"..v[3].."/"..v[2]] = {v[2], args[2], v[3], Boxs.size, v[1]}; end end end ) addEventHandler("onClientFileDownloadComplete", root, function (filename, success) if (success) then setTimer(function () if (filename:find(".txd")) then local file = filename:gsub(".txd", "") loadMod(Boxs.download[file][1]..".txd", Boxs.download[file][2], Boxs.download[file][3], Boxs.download[file][5]); elseif (filename:find(".dff")) then local file = filename:gsub(".dff", "") loadMod(Boxs.download[file][1]..".dff", Boxs.download[file][2], Boxs.download[file][3], Boxs.download[file][5]); elseif (filename:find(".col")) then local file = filename:gsub(".col", "") loadMod(Boxs.download[file][1]..".col", Boxs.download[file][2], Boxs.download[file][3], Boxs.download[file][5]); end end, 500, 1) end end ) function loadMod (file, city, type, id) local engineFile = "Arquivos/"..city.."/"..type.."/"..file; if (fileExists(engineFile)) then if (file:find(".dff")) then local dff = engineLoadDFF(dff, engineFile, id); engineReplaceModel(dff, id); elseif (file:find(".txd")) then local txd = engineLoadTXD(engineFile); engineImportTXD(txd, id); elseif (file:find(".col")) then local col = engineLoadCOL(engineFile); engineImportCOL(col, id); end --[[[ for k, v in ipairs (Boxs.download) do if (k == engineFile and v) then Boxs.download[k] = false; end end --]] end end addCommandHandler("loadMod", function () --if (event) then triggerServerEvent(getThisResource().name..": onServerSystem", localPlayer, {"files-load", "CR", "CR"}); --end end ); Server-side: Boxs = { Models = { CR = { {415, "415", "Veiculos", "Arquivos"} } } } addEvent(getThisResource().name..": onServerSystem", true); addEventHandler(getThisResource().name..": onServerSystem", root, function (args) if (args[1] == "files-load") then onRequestLoadingFiles(source, args[2]); end end ) function onRequestLoadingFiles (player, city) triggerClientEvent(player, getThisResource().name..": onClientSystem", root, {"files-load", city, Boxs.Models[city]}); end Meta: <meta> <info author="MrDante" name="[All] ModLoader" version="1.0" description="ModLoader Script"></info> <script src="Server-side.lua" type="server"></script> <script src="Client-side.lua" type="client" cache="false" validate="true"></script> <oop>true</oop> <file src="Arquivos/CR/Veiculos/415.dff" download="false"></file> <file src="Arquivos/CR/Veiculos/415.txd" download="false"></file> </meta>
  9. MrDante

    FetchRemote

    Ok, but is the algorithm "v[3]" catching a table ?
  10. Oh, really? Now try to make it work :D
  11. I'm Brazillian, Sorry my bad english Hi Guys, I need help! I am creating a modloader, however I did it with a form where it is giving error when executing the event "onClientFileDownloadComplete", because when I am going to the event, I need to find the data inside a table, but the error in The nil value debug, For some reason I do not know, if they want, they can test on their servers, and I ask you to help me, I'll be very grateful OBS: OOP Syntax The server-side table is the directory where the txd's / dff's are located Server-Side: [will be re-added later] Client-Side: [will be re-added later]
  12. Muito obrigado!! Você me ajudou demais!! e até uma possível depressão (Irônico) rs.
  13. Olá a todos, estou com um problema que está me deixando super desanimado... eu criei um comando de repetição para varias markers pegados nas posições de uma tabela, até ai tudo bem, mas ai usei onMarkerHit, ele só vai para o ultimo marker repetido... já tentei de várias formas, criei função para cada marker... mas ai o getElementID que eu utilizei foi para outra posição... Server-side Boxs = { Positions = { {1368.09497, -1279.76941, 13.54688 + 0.8, 285.67160, -86.19171, 1001.52289 + 0.8, 294.71225, -80.24703, 1001.51563 - 0.8, 4}, {2333.50806, 61.62383, 26.70579 + 0.8, 285.67160, -86.19171, 1001.52289 + 0.8, 294.71225, -80.24703, 1001.51563 - 0.8, 4}, {-2625.85010, 208.34500, 4.81250 + 0.8, 285.67160, -86.19171, 1001.52289 + 0.8, 294.71225, -80.24703, 1001.51563 - 0.8, 4}, {2158.97290, 943.12683, 10.82031 + 0.8, 285.67160, -86.19171, 1001.52289 + 0.8, 294.71225, -80.24703, 1001.51563 - 0.8, 4} }, Create = {} } addEventHandler("onResourceStart", resourceRoot, function () for i = 1, #Boxs.Positions do Boxs.Create.Enter = createMarker(Boxs.Positions[i][1], Boxs.Positions[i][2], Boxs.Positions[i][3], "arrow", 1, 255, 255, 0, 255); Boxs.Create.Exit = createMarker(Boxs.Positions[i][4], Boxs.Positions[i][5], Boxs.Positions[i][6], "arrow", 1, 255, 255, 0, 255); Boxs.Create.Marker = createMarker(Boxs.Positions[i][7], Boxs.Positions[i][8], Boxs.Positions[i][9], "cylinder", 1, 255, 255, 0, 255); createBlipAttachedTo(Boxs.Create.Enter, 6, 2, 0, 255, 0, 0, 0, 7000); setElementInterior(Boxs.Create.Exit, Boxs.Positions[i][10]); setElementInterior(Boxs.Create.Marker, Boxs.Positions[i][10]); setElementID(Boxs.Create.Enter, i); addEventHandler("onMarkerHit", Boxs.Create.Enter, markerHitEnter); end end ) addEventHandler("onMarkerHit", resourceRoot, function (Jog, mathDim) if (getElementType(Jog) == "player") then if (source == Boxs.Create.Enter) then fadeCamera(Jog, false, 1.0); local x, y, z = getElementPosition(Jog); setTimer( function (Jog) fadeCamera(Jog, true, 1.0); setElementInterior(Jog, Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][10], Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][4]+1.5, Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][5]+1.5, Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][6]); end, 2000, 1, Jog) elseif (source == Boxs.Create.Exit) then fadeCamera(Jog, false, 1.0); setTimer( function (Jog) fadeCamera(Jog, true, 1.0); setElementInterior(Jog, 0, Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][1]+1.5, Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][2], Boxs.Positions[tonumber(getElementID(Boxs.Create.Enter))][3]); end, 2000, 1, Jog) elseif (source == Boxs.Create.Marker) then triggerClientEvent(Jog, getResourceName(getThisResource())..": onClientSystem", root, "addRenderScript"); end end end ) Eu não sei mais o que fazer.. fiz vários comandos de repetição verificando source no onMarkerHit, não está adiantando nada...
  14. Salva suas posições antes de ser preso.
  15. function StarKill ( ammo, killer, killerweapon, Vehicle, bodypart ) if ( killer ) and ( killer ~= source ) then x,y,z = getElementPosition(killer) setElementData(killer, "positions", {x, y, z}); local procurado = getPlayerWantedLevel (killer) if procurado == 0 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 2) elseif procurado == 2 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 4) elseif procurado == 4 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 6) elseif procurado == 6 then setPlayerWantedLevel (killer,0) removePedFromVehicle (killer) setElementPosition (killer, 2587.328125, 2067.626953125, 10.8203125) outputChatBox ("[PENITENCIÁRIA] - #ff0000Você foi preso por 60 segundos...",killer,80,80,80,true) outputChatBox ("[PENITENCIÁRIA] - " .. getPlayerName(killer) .. "#ff0000 foi preso por 60 segundos...",source,80,80,80,true) setElementFrozen (killer, true) setTimer (function () backlocation(killer) end, 120000, 1) else givePlayerMoney ( killer, 200 ) end end function backlocation (killer) local x, y, z = unpack(getElementData(killer, "positions")) setElementPosition (killer,x,y,z+1) end end addEventHandler ( "onPlayerWasted", getRootElement(), StarKill )