Lukkas2201

Members
  • Content Count

    65
  • Joined

  • Last visited

Community Reputation

1 Neutral

About Lukkas2201

  • Rank
    Snitch

Recent Profile Visitors

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

  1. alguem sabe se tem como fazer uma animacao de tela? tenho um sistema de o player tomar bebida e ficar bebado, ai pra ficar mais realista queria colocar um settimer pra deixar a tela se mexendo.
  2. Boa noite, fiz um pequeno script simples, onde ao digitar um comando o player faz uma animação e surge um som, porém ao invés do som sair só para o player que digitou o comando, sai para todos do servidor, e não é só pra quem está perto, mas se um cara estiver em LS, e o outro em SF, consegue escutar também, oque pode ter de errado? Server addCommandHandler("coco",function(source) local x,y,z = getElementPosition(source) coco = createObject(14810,x,y-0.1,z-0.8,0,0,rotation) setTimer(destroyElement,900000,1,coco) triggerClientEvent("somcoco",getRootElement()) setPedAnimation( source, "ped", "WEAPON_crouch", -1, false,false,nil,false ) end) addCommandHandler("tomacachaca",function(source) setPedAnimation( source, "VENDING", "VEND_Drink2_P", -1,false,false,nil,false ) triggerClientEvent("somcachaca",getRootElement()) end) Client addEvent("somcoco",true) addEventHandler("somcoco",getRootElement(),function() playSound("Sounds/PUM"..math.random(1,7)..".mp3") end) addEvent("somcachaca",true) addEventHandler("somcachaca",getRootElement(),function() playSound("Sounds/cachaca"..math.random(1,4)..".mp3") end)
  3. Boa noite, uma dúvida, os jogadores consegue entrar no meu servidor antes dele baixar completamente, exemplo, o servidor pesa 300mb, o cara baixou 100mb, se ele relogar ele ja consegue logar e baixar o restante logado, teria como bloquear? para ele poder logar somente depois de baixar tudo?
  4. sim, a quetão não é ver códigos prontos, mas sim saber onde está o erro, eu não consigo saber onde está, eu tento varias modificações, e tenho algumas outras gms aqui onde tento procurar também alguma função parecida, pego alguns codigos, mas não da em nada. --## Copyright (c) 2015 Grosu `PoWeR` Mihaita. --## MTA:DayZ Backup System v1.5. local dbType = "SQLite"; --Here set your db type, "MySQL" or "SQLite" <!> local dbName = ""; --Your database name <!> local dbHost = ""; --Your hostname/IP <!> local dbUser = ""; --Username for database <!> local dbPass = ""; --Password for database <!> local dbPort = 1234; --This is an port exemple CHANGE IT <!> local last_veh_id = 0; --Don't edit here <!> local last_tent_id = 0; --Don't edit here <!> local itemsDataTable = { -- If your server have different items be sure you imported your item table here! {"M4A1"}, {"M4A1 CCO"}, {"M4A1 CCO SD"}, {"Sa-58P"}, {"Sa-58P CCO"}, {"M4A3 CCO"}, {"M16A4 ACOG"}, {"G36C (Camo)"}, {"M16A2"}, {"FN FAL"}, {"AKS-74U"}, {"AKS (Gold)"}, {"MG36"}, {"Bizon PP-19 SD"}, {"AK-107"}, {"AK-107 GL"}, {"AK-74"}, {"G36C"}, {"Gorro Noel"}, {"G36C SD"}, {"AKS-74 Kobra"}, {"AKM"}, {"RPK"}, {"CZ 550"}, {"SVD CAMO"}, {"M40A3"}, {"DMR"}, {"M24"}, {"M107"}, {"AS50"}, {"KSVK"}, {"Cheytac M200"}, {"M249 SAW"}, {"Mk 48 Mod 0"}, {"M240"}, {"PKM"}, {"PKP"}, {"Double-Barreled Shotgun"}, {"M1014"}, {"Remington 870"}, {"Winchester 1866"}, {"Sawn-Off Shotgun"}, {"PDW"}, {"MP5A5"}, {"MP5SD6"}, {"Machete"}, {"Hatchet"}, {"Crowbar"}, {"Shovel"}, {"Makarov PM"}, {"Makarov SD"}, {"G17"}, {"M1911"}, {"M9"}, {"M9 SD"}, {"Revolver"}, {"Balanced Vest"}, {"Press Vest"}, {"Police Vest"}, {"Light Tactical Vest"}, {"Balistic Vest"}, {"UK Assalt Vest DPM Camo"}, {"UK Assalt Vest DPM Black"}, {"Balistic Plus Vest"}, {"Helmet"}, {"Mossy Helmet"}, {"UN Helmet"}, {"Gorro Noel"}, {"Aviator Helmet"}, {"Gas Mask 1"}, {"Gas Mask 2"}, {"Motorbike Helmet 1"}, {"Motorbike Helmet 2"}, {"Motorbike Helmet 3"}, {"Motorbike Helmet 4"}, {"Skate Helmet"}, {"Tanker Helmet"}, {"Welding Helmet 1"}, {"Welding Helmet 2"}, {"Smersh Backpack"}, {"Courier Bag"}, {"Child Briefcase"}, {"Improvised Backpack"}, {"Assault Pack (ACU)"}, {"Alice Pack"}, {"British Assault Pack"}, {"Taloon Backpack"}, {"Omega Backpack"}, {"Alfa Backpack"}, {"Hunting Backpack"}, {"Camping Backpack"}, {"Drybag Backpack"}, {"Mountain Backpack"}, {"Czech Backpack"}, {"Camping Tactical Backpack"}, {"Coyote Backpack"}, {"Coyote Backpack (Desert)"}, {"Coyote Backpack (Mossy)"}, {"Tactical Backpack"}, {"Eskimo Backpack"}, {"Tiger Backpack"}, {"Noel Backpack"}, {"Canned Spaghetti (Fechado)"}, {"Canned Spaghetti (Aberto)"}, {"Canned Baked Beans (Fechado)"}, {"Canned Baked Beans (Aberto)"}, {"Canned Sardines (Fechado)"}, {"Canned Sardines (Aberto)"}, {"Can of Tactical Bacon (Fechado)"}, {"Can of Tactical Bacon (Aberto)"}, {"Water Bottle"}, {"Burger"}, {"Pizza"}, {"Soda Bottle"}, {"Milk"}, {"Cooked Meat"}, {"Raw Meat"}, {"Antibiotics"}, {"Bandage"}, {"Medic Kit"}, {"Heat Pack"}, {"Painkiller"}, {"Blood Bag"}, {"Morphine"}, {"Engine"}, {"Tire"}, {"Tank Parts"}, {"Scrap Metal"}, {"Steel Sheet"}, {"Empty Gas Canister"}, {"Full Gas Canister"}, {"Stinger"}, {"Wood Pile"}, {"Roadflare"}, {"Wire Fence"}, {"Tent"}, {"Empty Water Bottle"}, {"Empty Soda Cans"}, {"Night Vision Goggles"}, {"Infrared Goggles"}, {"Map"}, {"Box of Matches"}, {"Watch"}, {"GPS"}, {"Toolbox"}, {"Radio Device"}, {"Syringe"}, {"Opener"}, {"Hose"}, {"Tire Repair Kit"}, {"Compass"}, ------- {"30Rnd. STANAG"}, {"FN FAL Mag."}, {"G36 Mag"}, {"30Rnd. AK"}, {"CZ 550 Mag."}, {"SVD Mag."}, {"M24 Mag."}, {"DMR Mag."}, {"10Rnd. M107"}, {"5Rnd. KSVK"}, {"5Rnd. Cheytac M200"}, {"100Rnd. M249 SAW"}, {"100Rnd. M240."}, {"PKM Mag."}, {"2Rnd. Slug"}, {"Bizon Mag"}, {"MG36 Mag."}, {"M1014 Slug"}, {"1866 Slug"}, {"PDW Mag"}, {"AKM Mag."}, {"5Rnd 12.7x99mm NATO"}, {"Sa-58 Mag."}, {"MP5 Mag"}, {"Grenade"}, {"Tear Gas"}, {"Binoculars"}, {"Parachute"}, {"Makarov Mag"}, {"G17 Mag"}, {"M1911 Mag"}, {"M9 Mag"}, {".45 ACP"} }; function noteAdmins(theAlert) for _,v in ipairs(getElementsByType("player")) do if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin"))) then outputChatBox("#FF0000[Backup]: #FFFFFF"..tostring(theAlert), v, 255, 255, 255, true); end end end if (dbType == "MySQL") then db = dbConnect("mysql", "dbname="..dbName..";host="..dbHost..";port="..dbPort, dbUser, dbPass, "share=1"); dbExec(db, "CREATE TABLE IF NOT EXISTS vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id)"); dbExec(db, "CREATE TABLE IF NOT EXISTS tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id)"); noteAdmins("Database connected to MySQL!"); elseif (dbType == "SQLite") then db = dbConnect("sqlite", "database.db"); dbExec(db, "CREATE TABLE IF NOT EXISTS vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id)"); dbExec(db, "CREATE TABLE IF NOT EXISTS tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id)"); noteAdmins("Database connected to SQLite!"); else noteAdmins("Error: `dbType` wrong attribute!"); return false; end function backup_vehs() dbExec(db, "DELETE FROM vehicles"); local vehicleCounter = 0; for _,veh in ipairs(getElementsByType("vehicle")) do if (not getElementData(veh, "helicrash") and not getElementData(veh, "deadVehicle")) then local col = getElementData(veh, "parent"); if (col and getElementType(col) == "colshape") then local model = getElementModel(veh); local x, y, z = getElementPosition(veh); local rX, rY, rZ = getElementRotation(veh); local slots = getElementData(col, "MAX_Slots") or 20; local fuel = getElementData(col, "fuel") or 0; local spawnx = setElementData(col,"spawn_x",getElementData(col,"spawn")[2]); -- Linha para pegar o spawn local spawny = setElementData(col,"spawn_y",getElementData(col,"spawn")[3]); -- Linha para pegar o spawn local spawnz = setElementData(col,"spawn_z",getElementData(col,"spawn")[4]); -- Linha para pegar o spawn local moving = getElementData(col, "Tire_inVehicle") or 0; local engines = getElementData(col, "Engine_inVehicle") or 0; local parts = getElementData(col, "Parts_inVehicle") or 0; local siren = getElementData(col, "Sirene_inVehicle") or 0; local receiver = getElementData(col, "receiver") or 0; local armorPointsMax = getElementData(col, "armorPointsMax") or 0; local armorPoints = getElementData(col, "armorPoints") or 0; local items = {}; vehicleCounter = vehicleCounter + 1; for _,v in ipairs(itemsDataTable) do local quantity = getElementData(col, v[1]) or 0; if (quantity > 0) then table.insert(items, {v[1], quantity}); end end dbExec(db, "INSERT INTO vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, engines, receiver, armorPoints, armorPointsMax, moving, parts, items, id) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", model, x, y, z, rX, rY, rZ, slots, fuel, engines, receiver, armorPoints, armorPointsMax, moving, parts, toJSON(items), vehicleCounter) end end end noteAdmins("Veículos Salvos ["..vehicleCounter.."]"); end addEventHandler("onResourceStop",getResourceRootElement(),backup_vehs) setTimer(backup_vehs,3600000,0) function backup_tents() dbExec(db, "DELETE FROM tents"); local tentsCounter = 0; for _,col in ipairs(getElementsByType("colshape")) do if (getElementData(col, "tent")) then local tent = getElementData(col, "parent"); local x, y, z = getElementPosition(tent); local rX, rY, rZ = getElementRotation(tent); local model = getElementModel(tent); local slots = getElementData(col, "MAX_Slots") or 300; local scale = getObjectScale(tent); local items = {}; tentsCounter = tentsCounter + 1; for _,v in ipairs(itemsDataTable) do local quantity = getElementData(col, v[1]) or 0; if (quantity > 0) then table.insert(items, {v[1], quantity}); end end dbExec(db, "INSERT INTO tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id) VALUES(?,?,?,?,?,?,?,?,?,?,?)", model, x, y, z, rX, rY, rZ, slots, scale, toJSON(items), tentsCounter) end end noteAdmins("Tendas Salvas ["..tentsCounter.."]"); end addEventHandler("onResourceStop",getResourceRootElement(),backup_tents) setTimer(backup_tents,3600000,0) function create_veh(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id) local veh = createVehicle(model, x, y, z+1); local vehCol = createColSphere(x, y, z, 4); setElementRotation(veh, rX, rY, rZ); attachElements(vehCol, veh, 0, 0, 0); setElementData(vehCol, "parent", veh); setElementData(veh, "parent", vehCol); setElementData(vehCol, "vehicle", true); setElementData(vehCol, "MAX_Slots", tonumber(slots)); setElementData(vehCol, "Tire_inVehicle", tonumber(moving)); setElementData(vehCol, "Engine_inVehicle", tonumber(engines)); setElementData(vehCol, "Parts_inVehicle", tonumber(parts)); setElementData(vehCol, "fuel", tonumber(fuel)); setElementData(vehCol, "receiver", tonumber(receiver)); setElementData(vehCol, "armorPointsMax", tonumber(armorPointsMax)); setElementData(vehCol, "armorPoints", tonumber(armorPoints)); xxx,yyy,zzz = setElementData(vehCol,"spawn_x"),setElementData(vehCol,"spawn_y"),setElementData(vehCol,"spawn_z"); -- Linha onde vai puxar o spawn na função acima setElementData(vehCol,"spawn",{setElementData(vehCol,"model"),xxx,yyy,zzz}); -- linha que pega o spawn e o model do vehicle for _,v in ipairs(fromJSON(items)) do setElementData(vehCol, v[1], v[2]); end end function create_tent(model, x, y, z, rX, rY, rZ, slots, scale, items, id) local tent = createObject(model, x, y, z); local tentCol = createColSphere(x, y, z, 4); setElementRotation(tent, rX, rY, rZ); setObjectScale(tent, scale); attachElements(tentCol, tent, 0, 0, 0); setElementData(tentCol, "parent", tent); setElementData(tent, "parent", tentCol); setElementData(tentCol, "tent", true); setElementData(tentCol, "vehicle", true); setElementData(tentCol, "MAX_Slots", slots); setElementData(tentCol,"visible",true) for _,v in ipairs(fromJSON(items)) do setElementData(tentCol, v[1], v[2]); end end function load_vehs(q) if (q) then local p = dbPoll(q, 0); if (#p > 0) then for _,d in pairs(p) do last_veh_id = d["id"]; create_veh(d["model"], d["x"], d["y"], d["z"], d["rX"], d["rY"], d["rZ"], d["slots"], d["fuel"],d["receiver"], d["armorPoints"], d["armorPointsMax"], d["engines"], d["moving"], d["parts"], d["items"], d["id"]); end end end noteAdmins("Veiculos Carregados!"); end function load_tents(q) if (q) then local p = dbPoll(q, 0); if (#p > 0) then for _,d in pairs(p) do last_tent_id = d["id"]; create_tent(d["model"], d["x"], d["y"], d["z"], d["rX"], d["rY"], d["rZ"], d["slots"], d["scale"], d["items"], d["id"]); end end end noteAdmins("Tendas Carregadas!"); end function start_resource () dbQuery(load_tents, {}, db, "SELECT * FROM `tents`") dbQuery(load_vehs, {}, db, "SELECT * FROM `vehicles`") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), start_resource) addEventHandler("onPlayerCommand", root, function(cmd) if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin"))) then if (cmd == "loadtent") then --carregar tendas dbQuery(load_tents, {}, db, "SELECT * FROM `tents`"); elseif (cmd == "loadcar") then --carregar veiculos dbQuery(load_vehs, {}, db, "SELECT * FROM `vehicles`"); elseif (cmd == "savecar") then --salvar veiculos backup_vehs(); elseif (cmd == "savetent") then -- salvar tendas backup_tents(); elseif (cmd == "backup") then --start stop backup a cada 30 minutos if (isTimer(vehbkTimer) and isTimer(tentbkTimer)) then killTimer(vehbkTimer); killTimer(tentbkTimer); noteAdmins(getPlayerName(source).."#FFFFFF Backup Automatico Parado!"); else vehbkTimer = setTimer(backup_vehs, 30*60000, 0); tentbkTimer = setTimer(backup_tents, 30*60000, 0); noteAdmins(getPlayerName(source).."#FFFFFF Backup Automatico Iniciado!"); end end end end); Fiz outra alteração, porém não vai também, e da um erro direcionando para a GM, onde da em uma linha que não tem nada a ver com oque estou mexendo, ou seja creio que o erro seja onde editei, porém nao sei aonde estou errando.
  5. Vou dar uma olhada, não sabia. Fico chateado porque tem muita gente que sabe arrumar, poderia me falar onde estou errando e oque eu poderia fazer, eu nao quero codigo pronto, eu quero aprender, porem eu nao sei onde eu to errando, e o pessoal sabe arrumar, mas nao podem vir aqui dar uma ajuda, dar uma iniciativa, falar oque eu tenho que fazer, pessoal é muito egoísta, to tentando resolver isso faz semanas já, porém sem sucesso, fica complicado. Mas agradeço novamente pela ajuda, precisar de algo que eu possa ajudar, estarei a disposição.
  6. Tinha tentado uma parecida, so que a funcao spawndayzvehicle, tentei esta tbm respawndayzvehicle mas nao funcionou, praticamente esta funcao n fez diferenca, pois ai ela só está usando pra respawnar o veiculo, sendo que o backup salvou ele na posicao que está, sendo assim, eu adicionando esta funcao que vc mandou, ele vai spawnar normalmente porém no mesmo lugar que foi salvo o veiculo, ou seja, está funcão não fez diferença :/, ta complicado to quebrando a cabeça aqui Mas valeu mano pela ajuda
  7. Sim, o veiculo é pra spawnar no seu devido local, porem o sistema de backup salva ele, e o local que o sistema de backup salvou, se toena o local de spawn dele, ou seja n quero isso, quero que ele salve os veiculos, mas que continue spawnando no seu local normal
  8. tentei umas modificações porém não obtive sucesso, se alguém puder me dizer oque estou fazendo de errado eu agradeço --## Copyright (c) 2015 Grosu `PoWeR` Mihaita. --## MTA:DayZ Backup System v1.5. local dbType = "SQLite"; --Here set your db type, "MySQL" or "SQLite" <!> local dbName = ""; --Your database name <!> local dbHost = ""; --Your hostname/IP <!> local dbUser = ""; --Username for database <!> local dbPass = ""; --Password for database <!> local dbPort = 1234; --This is an port exemple CHANGE IT <!> local last_veh_id = 0; --Don't edit here <!> local last_tent_id = 0; --Don't edit here <!> local itemsDataTable = { -- If your server have different items be sure you imported your item table here! {"M4A1"}, {"M4A1 CCO"}, {"M4A1 CCO SD"}, {"Sa-58P"}, {"Sa-58P CCO"}, {"M4A3 CCO"}, {"M16A4 ACOG"}, {"G36C (Camo)"}, {"M16A2"}, {"FN FAL"}, {"AKS-74U"}, {"AKS (Gold)"}, {"MG36"}, {"Bizon PP-19 SD"}, {"AK-107"}, {"AK-107 GL"}, {"AK-74"}, {"G36C"}, {"Gorro Noel"}, {"G36C SD"}, {"AKS-74 Kobra"}, {"AKM"}, {"RPK"}, {"CZ 550"}, {"SVD CAMO"}, {"M40A3"}, {"DMR"}, {"M24"}, {"M107"}, {"AS50"}, {"KSVK"}, {"Cheytac M200"}, {"M249 SAW"}, {"Mk 48 Mod 0"}, {"M240"}, {"PKM"}, {"PKP"}, {"Double-Barreled Shotgun"}, {"M1014"}, {"Remington 870"}, {"Winchester 1866"}, {"Sawn-Off Shotgun"}, {"PDW"}, {"MP5A5"}, {"MP5SD6"}, {"Machete"}, {"Hatchet"}, {"Crowbar"}, {"Shovel"}, {"Makarov PM"}, {"Makarov SD"}, {"G17"}, {"M1911"}, {"M9"}, {"M9 SD"}, {"Revolver"}, {"Balanced Vest"}, {"Press Vest"}, {"Police Vest"}, {"Light Tactical Vest"}, {"Balistic Vest"}, {"UK Assalt Vest DPM Camo"}, {"UK Assalt Vest DPM Black"}, {"Balistic Plus Vest"}, {"Helmet"}, {"Mossy Helmet"}, {"UN Helmet"}, {"Gorro Noel"}, {"Aviator Helmet"}, {"Gas Mask 1"}, {"Gas Mask 2"}, {"Motorbike Helmet 1"}, {"Motorbike Helmet 2"}, {"Motorbike Helmet 3"}, {"Motorbike Helmet 4"}, {"Skate Helmet"}, {"Tanker Helmet"}, {"Welding Helmet 1"}, {"Welding Helmet 2"}, {"Smersh Backpack"}, {"Courier Bag"}, {"Child Briefcase"}, {"Improvised Backpack"}, {"Assault Pack (ACU)"}, {"Alice Pack"}, {"British Assault Pack"}, {"Taloon Backpack"}, {"Omega Backpack"}, {"Alfa Backpack"}, {"Hunting Backpack"}, {"Camping Backpack"}, {"Drybag Backpack"}, {"Mountain Backpack"}, {"Czech Backpack"}, {"Camping Tactical Backpack"}, {"Coyote Backpack"}, {"Coyote Backpack (Desert)"}, {"Coyote Backpack (Mossy)"}, {"Tactical Backpack"}, {"Eskimo Backpack"}, {"Tiger Backpack"}, {"Noel Backpack"}, {"Canned Spaghetti (Fechado)"}, {"Canned Spaghetti (Aberto)"}, {"Canned Baked Beans (Fechado)"}, {"Canned Baked Beans (Aberto)"}, {"Canned Sardines (Fechado)"}, {"Canned Sardines (Aberto)"}, {"Can of Tactical Bacon (Fechado)"}, {"Can of Tactical Bacon (Aberto)"}, {"Water Bottle"}, {"Burger"}, {"Pizza"}, {"Soda Bottle"}, {"Milk"}, {"Cooked Meat"}, {"Raw Meat"}, {"Antibiotics"}, {"Bandage"}, {"Medic Kit"}, {"Heat Pack"}, {"Painkiller"}, {"Blood Bag"}, {"Morphine"}, {"Engine"}, {"Tire"}, {"Tank Parts"}, {"Scrap Metal"}, {"Steel Sheet"}, {"Empty Gas Canister"}, {"Full Gas Canister"}, {"Stinger"}, {"Wood Pile"}, {"Roadflare"}, {"Wire Fence"}, {"Tent"}, {"Empty Water Bottle"}, {"Empty Soda Cans"}, {"Night Vision Goggles"}, {"Infrared Goggles"}, {"Map"}, {"Box of Matches"}, {"Watch"}, {"GPS"}, {"Toolbox"}, {"Radio Device"}, {"Syringe"}, {"Opener"}, {"Hose"}, {"Tire Repair Kit"}, {"Compass"}, ------- {"30Rnd. STANAG"}, {"FN FAL Mag."}, {"G36 Mag"}, {"30Rnd. AK"}, {"CZ 550 Mag."}, {"SVD Mag."}, {"M24 Mag."}, {"DMR Mag."}, {"10Rnd. M107"}, {"5Rnd. KSVK"}, {"5Rnd. Cheytac M200"}, {"100Rnd. M249 SAW"}, {"100Rnd. M240."}, {"PKM Mag."}, {"2Rnd. Slug"}, {"Bizon Mag"}, {"MG36 Mag."}, {"M1014 Slug"}, {"1866 Slug"}, {"PDW Mag"}, {"AKM Mag."}, {"5Rnd 12.7x99mm NATO"}, {"Sa-58 Mag."}, {"MP5 Mag"}, {"Grenade"}, {"Tear Gas"}, {"Binoculars"}, {"Parachute"}, {"Makarov Mag"}, {"G17 Mag"}, {"M1911 Mag"}, {"M9 Mag"}, {".45 ACP"} }; function noteAdmins(theAlert) for _,v in ipairs(getElementsByType("player")) do if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin"))) then outputChatBox("#FF0000[Backup]: #FFFFFF"..tostring(theAlert), v, 255, 255, 255, true); end end end if (dbType == "MySQL") then db = dbConnect("mysql", "dbname="..dbName..";host="..dbHost..";port="..dbPort, dbUser, dbPass, "share=1"); dbExec(db, "CREATE TABLE IF NOT EXISTS vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id)"); dbExec(db, "CREATE TABLE IF NOT EXISTS tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id)"); noteAdmins("Database connected to MySQL!"); elseif (dbType == "SQLite") then db = dbConnect("sqlite", "database.db"); dbExec(db, "CREATE TABLE IF NOT EXISTS vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id)"); dbExec(db, "CREATE TABLE IF NOT EXISTS tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id)"); noteAdmins("Database connected to SQLite!"); else noteAdmins("Error: `dbType` wrong attribute!"); return false; end function backup_vehs() dbExec(db, "DELETE FROM vehicles"); local vehicleCounter = 0; for _,veh in ipairs(getElementsByType("vehicle")) do if (not getElementData(veh, "helicrash") and not getElementData(veh, "deadVehicle")) then local col = getElementData(veh, "parent"); if (col and getElementType(col) == "colshape") then local model = getElementModel(veh); local x, y, z = getElementPosition(veh); local SpawnVehXYZ = getElementData(vehCol,"spawn"); -- Linha adicionada local rX, rY, rZ = getElementRotation(veh); local slots = getElementData(col, "MAX_Slots") or 20; local fuel = getElementData(col, "fuel") or 0; local moving = getElementData(col, "Tire_inVehicle") or 0; local engines = getElementData(col, "Engine_inVehicle") or 0; local parts = getElementData(col, "Parts_inVehicle") or 0; local siren = getElementData(col, "Sirene_inVehicle") or 0; local receiver = getElementData(col, "receiver") or 0; local armorPointsMax = getElementData(col, "armorPointsMax") or 0; local armorPoints = getElementData(col, "armorPoints") or 0; local Spawn_X = getElementData(vehCol,"Spawn_X",SpawnVehXYZ[2]); -- Linha adicionada local Spawn_Y = getElementData(vehCol,"Spawn_Y",SpawnVehXYZ[3]); -- Linha adicionada local Spawn_Z = getElementData(vehCol,"Spawn_Z",SpawnVehXYZ[4]); -- Linha adicionada local items = {}; vehicleCounter = vehicleCounter + 1; for _,v in ipairs(itemsDataTable) do local quantity = getElementData(col, v[1]) or 0; if (quantity > 0) then table.insert(items, {v[1], quantity}); end end dbExec(db, "INSERT INTO vehicles(model, x, y, z, rX, rY, rZ, SpawnVehXYZ, slots, fuel, engines, receiver, armorPoints, armorPointsMax, moving, parts, items, id) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", model, x, y, z, rX, rY, rZ, SpawnVehXYZ, slots, fuel, engines, receiver, armorPoints, armorPointsMax, moving, parts, toJSON(items), vehicleCounter) -- Alterado end end end noteAdmins("Veículos Salvos ["..vehicleCounter.."]"); end addEventHandler("onResourceStop",getResourceRootElement(),backup_vehs) setTimer(backup_vehs,3600000,0) function backup_tents() dbExec(db, "DELETE FROM tents"); local tentsCounter = 0; for _,col in ipairs(getElementsByType("colshape")) do if (getElementData(col, "tent")) then local tent = getElementData(col, "parent"); local x, y, z = getElementPosition(tent); local rX, rY, rZ = getElementRotation(tent); local model = getElementModel(tent); local slots = getElementData(col, "MAX_Slots") or 300; local scale = getObjectScale(tent); local items = {}; tentsCounter = tentsCounter + 1; for _,v in ipairs(itemsDataTable) do local quantity = getElementData(col, v[1]) or 0; if (quantity > 0) then table.insert(items, {v[1], quantity}); end end dbExec(db, "INSERT INTO tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id) VALUES(?,?,?,?,?,?,?,?,?,?,?)", model, x, y, z, rX, rY, rZ, slots, scale, toJSON(items), tentsCounter) end end noteAdmins("Tendas Salvas ["..tentsCounter.."]"); end addEventHandler("onResourceStop",getResourceRootElement(),backup_tents) setTimer(backup_tents,3600000,0) function create_veh(model, x, y, z, rX, rY, rZ,SpawnVx,SpawnVy,SpawnVz, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id) -- Linha alterada local veh = createVehicle(model, x, y, z); local vehCol = createColSphere(x, y, z, 4); setElementRotation(veh, rX, rY, rZ); attachElements(vehCol, veh, 0, 0, 0); setElementData(vehCol, "parent", veh); setElementData(veh, "parent", vehCol); setElementData(vehCol, "vehicle", true); setElementData(vehCol, "MAX_Slots", tonumber(slots)); setElementData(vehCol, "Tire_inVehicle", tonumber(moving)); setElementData(vehCol, "Engine_inVehicle", tonumber(engines)); setElementData(vehCol, "Parts_inVehicle", tonumber(parts)); setElementData(vehCol, "spawn", {model, SpawnVx,SpawnVy,SpawnVz}); -- Linha alterada setElementData(vehCol, "SpawnVx",Spawn_X); -- Linha alterada setElementData(vehCol, "SpawnVy",Spawn_Y); -- Linha alterada setElementData(vehCol, "SpawnVz",Spawn_Z); -- Linha alterada setElementData(vehCol, "fuel", tonumber(fuel)); setElementData(vehCol, "receiver", tonumber(receiver)); setElementData(vehCol, "armorPointsMax", tonumber(armorPointsMax)); setElementData(vehCol, "armorPoints", tonumber(armorPoints)); for _,v in ipairs(fromJSON(items)) do setElementData(vehCol, v[1], v[2]); end end function create_tent(model, x, y, z, rX, rY, rZ, slots, scale, items, id) local tent = createObject(model, x, y, z); local tentCol = createColSphere(x, y, z, 4); setElementRotation(tent, rX, rY, rZ); setObjectScale(tent, scale); attachElements(tentCol, tent, 0, 0, 0); setElementData(tentCol, "parent", tent); setElementData(tent, "parent", tentCol); setElementData(tentCol, "tent", true); setElementData(tentCol, "vehicle", true); setElementData(tentCol, "MAX_Slots", slots); setElementData(tentCol,"visible",true) for _,v in ipairs(fromJSON(items)) do setElementData(tentCol, v[1], v[2]); end end function load_vehs(q) if (q) then local p = dbPoll(q, 0); if (#p > 0) then for _,d in pairs(p) do last_veh_id = d["id"]; create_veh(d["model"], d["x"], d["y"], d["z"], d["rX"], d["rY"], d["rZ"], d["slots"], d["fuel"],d["receiver"], d["armorPoints"], d["armorPointsMax"], d["engines"], d["moving"], d["parts"], d["items"], d["id"]); end end end noteAdmins("Veiculos Carregados!"); end function load_tents(q) if (q) then local p = dbPoll(q, 0); if (#p > 0) then for _,d in pairs(p) do last_tent_id = d["id"]; create_tent(d["model"], d["x"], d["y"], d["z"], d["rX"], d["rY"], d["rZ"], d["slots"], d["scale"], d["items"], d["id"]); end end end noteAdmins("Tendas Carregadas!"); end function start_resource () dbQuery(load_tents, {}, db, "SELECT * FROM `tents`") dbQuery(load_vehs, {}, db, "SELECT * FROM `vehicles`") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), start_resource) addEventHandler("onPlayerCommand", root, function(cmd) if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin"))) then if (cmd == "loadtent") then --carregar tendas dbQuery(load_tents, {}, db, "SELECT * FROM `tents`"); elseif (cmd == "loadcar") then --carregar veiculos dbQuery(load_vehs, {}, db, "SELECT * FROM `vehicles`"); elseif (cmd == "savecar") then --salvar veiculos backup_vehs(); elseif (cmd == "savetent") then -- salvar tendas backup_tents(); elseif (cmd == "backup") then --start stop backup a cada 30 minutos if (isTimer(vehbkTimer) and isTimer(tentbkTimer)) then killTimer(vehbkTimer); killTimer(tentbkTimer); noteAdmins(getPlayerName(source).."#FFFFFF Backup Automatico Parado!"); else vehbkTimer = setTimer(backup_vehs, 30*60000, 0); tentbkTimer = setTimer(backup_tents, 30*60000, 0); noteAdmins(getPlayerName(source).."#FFFFFF Backup Automatico Iniciado!"); end end end end);
  9. consegui já irmão, na verdade o bug era na propria gm, onde estava alterado a tabela, por isso não estava batendo, mas mesmo assim agradeço novamente
  10. Boa noite rapaziada, seguinte, estou aqui com um sistema de backup de veículos por database, e o que acontece, o servidor spawna o veículo, e ao explodir, ele volta no local que ele spawnou, até ai ok, porém o sistema de backup faz o seguinte, ele salva onde o veículo está, e caso ocorra um desligamento do servidor, ao reiniciar, se explodir o veículo novamente, ele spawna na onde o sistema de backup salvou ele, ou seja, se ele spawna na area 51, e o sistema de backup salvou ele la em ls, ao invez dele spawnar na area 51 que é seu local correto, ele vai spawnar em LS pois foi la que o sistema salvou ele. eu pensei em usar um setElementData e depois um getElementData para poder obter as coordenadas do local de spawn original, mas n faço a minima ideia por onde comecar, se alguem puder me ajudar, obrigado !! parte do servidor onde tem os dados do spawn dos veículos hospitalPacks = { {-2670.87890625,636.8984375,14.453125}, {-2637.0556640625,635.03125,14.453125}, {-1515.669921875,2519.166015625,56.0703125}, {-1513.888671875,2519.5908203125,56.064819335938}, {-1528.8955078125,2516.724609375,55.986171722412}, {2022.1650390625,-1402.6806640625,17.18045425415}, {2042.7001953125,-1409.4775390625,17.1640625}, {1171.490234375,-1310.560546875,13.986573219299}, {1171.609375,-1306.556640625,13.996350288391}, {1158.5048828125,-1326.333984375,31.503561019897}, {1159.80078125,-1323.9013671875,31.498970031738}, {1238.7119140625,328.2431640625,19.7555103302}, {1229.365234375,311.1435546875,24.7578125}, {-2204.07421875,-2309.58203125,31.375}, {1615.939453125,1818.0537109375,10.8203125}, {1601.9443359375,1816.736328125,10.8203125}, {1590.0166015625,1792.0234375,30.46875}, {1607.3232421875,1776.7412109375,37.3125}, {2107.7626953125,926.16015625,10.8203125}, {2116.12890625,925.7705078125,10.9609375}, {2122.1865234375,925.3193359375,10.8203125}, {275.30685424805,1889.0017089844,17.671506881714}, ----- Tenda Medica 51 ------- {275.29724121094,1894.240234375,17.669857025146}, ----- Tenda Medica 51 ------- {246.54913330078,2114.4567871094,17.671398162842}, ----- Tenda Medica 51 ------- {240.98666381836,2114.3959960938,17.670330047607}, ----- Tenda Medica 51 ------- {1389.0604248047,1772.0107421875,10.868975639343}, ----- Tenda Medica Aero LV ------ {-2667.3984375,612.50695800781,14.570329666138}, ------- Tenda Medica HP SF ------- {-2662.3532714844,612.74169921875,14.572191238403}, ------- Tenda Medica HP SF -------- {1612.0623779297,1848.4633789063,10.870816230774}, -------- Tenda Medica HP LV -------- {1605.9671630859,1848.6759033203,10.878125190735}, -------- Tenda Medica HP LV -------- {-1247.9757080078,22.812610626221,14.171301841736}, ------- Tenda Medica Aero SF ------- {-296.43521118164,1084.3815917969,19.771415710449}, ------- Tenda Medica HP FC ----------- {-300.16088867188,1047.8997802734,20.170841217041}, ------- HP FC -------- {-315.2180480957,1046.5977783203,20.207050323486}, -------- HP FC -------- {-325.88632202148,1048.3531494141,20.199048995972}, ------- HP FC -------- {-332.0661315918,1050.5997314453,20.18150138855}, --------- HP FC -------- {3682.95,1787.1583,35.472111}, -- ILHA LV {3684.6257,1777.33,35.507122}, {3684.6077,1773.4244,35.51075}, {3682.7141,1765.6033,35.498505}, {3479.2446,1762.9865,35.371639}, {3449.7549,1762.7432,35.371094}, -- ILHA LV } patrolPoints = { {-1603.2197265625,-2712.736328125,48.9453125}, {2465.748046875,-2215.55859375,13.546875}, {2473.439453125,-2215.56640625,13.546875}, {2480.0732421875,-2216.140625,13.546875}, {2487.24609375,-2215.5966796875,13.546875}, {2494.1005859375,-2215.5859375,13.546875}, {-1686.6728515625,408.9970703125,7.3984375}, {-1682.34375,412.9384765625,7.3984375}, {-1680.0263671875,402.3642578125,7.3984375}, {-1675.84375,406.4677734375,7.3984375}, {-1670.5615234375,411.8359375,7.3984375}, {-1666.2392578125,416.2509765625,7.3984375}, {-1672.7939453125,422.81640625,7.3984375}, {-1677.20703125,418.46484375,7.3984375}, {-2410.7021484375,969.9091796875,45.4609375}, {-2410.744140625,975.220703125,45.4609375}, {-2410.837890625,980.5302734375,45.4609375}, {-1329.3046875,2668.5126953125,50.46875}, {-1328.7314453125,2673.90625,50.0625}, {-1327.0185546875,2679.3876953125,50.46875}, {-1327.3798828125,2684.62890625,50.0625}, {1940.7099609375,-1778.5244140625,13.390598297119}, {1940.6552734375,-1774.908203125,13.390598297119}, {1940.630859375,-1771.728515625,13.390598297119}, {1940.7080078125,-1767.3837890625,13.390598297119}, {-1477.921875,1868.138671875,32.639846801758}, {-1466.1552734375,1869.0048828125,32.6328125}, {-1464.5224609375,1861.3828125,32.639846801758}, {-1477.4599609375,1860.5205078125,32.6328125}, {-735.9208984375,2744.0087890625,47.2265625}, {-739.0439453125,2744.2421875,47.165451049805}, {377.6953125,2601.1083984375,16.484375}, {624.5263671875,1676.25390625,6.9921875}, {620.2958984375,1681.2431640625,6.9921875}, {616.248046875,1686.4169921875,7.1875}, {612.783203125,1691.1650390625,7.1875}, {609.2060546875,1696.201171875,7.1875}, {605.8505859375,1700.978515625,7.1875}, {602.27734375,1706.3603515625,7.1875}, {2141.037109375,2742.734375,10.960174560547}, {2142.3115234375,2752.6982421875,10.96019744873}, {2147.9521484375,2752.3203125,10.8203125}, {2152.60546875,2751.953125,10.8203125}, {2152.984375,2743.85546875,10.8203125}, {2147.75,2743.7392578125,10.8203125}, {-97.6298828125,-1175.0283203125,2.4990689754486}, {-90.74609375,-1177.853515625,2.2021217346191}, {-84.75390625,-1163.853515625,2.3359375}, {-91.5771484375,-1160.5732421875,2.4453125}, {-1606.525390625,-2717.2138671875,48.9453125}, {-1609.7109375,-2721.544921875,48.9453125}, {-1599.83203125,-2708.302734375,48.9453125}, {-2246.314453125,-2558.8212890625,32.0703125}, {-2241.3125,-2561.3662109375,32.0703125}, {-1132.2880859375,-135.0986328125,14.14396572113}, {-1153.529296875,-156.373046875,14.1484375}, {-1142.826171875,-145.67578125,14.14396572113}, {655.611328125,-557.9912109375,16.501491546631}, {655.6572265625,-572.1728515625,16.501491546631}, {1601.791015625,2203.90625,11.060997009277}, {1596.806640625,2203.4345703125,10.8203125}, {1590.197265625,2203.4853515625,10.8203125}, {1589.4775390625,2195.43359375,10.8203125}, {1596.125,2194.294921875,10.8203125}, {1601.6591796875,2194.3369140625,10.8203125}, {2206.8466796875,2470.47265625,10.8203125}, {2206.94140625,2474.75,10.8203125}, {2206.9267578125,2478.86328125,10.8203125}, {2198.06640625,2480.6953125,10.8203125}, {2197.541015625,2475.791015625,10.995170593262}, {2197.609375,2471.9169921875,10.995170593262}, {2120.8251953125,915.4833984375,10.8203125}, {2115.1181640625,915.44140625,10.8203125}, {2109.076171875,915.4228515625,10.8203125}, {2109.22265625,924.8779296875,10.9609375}, {2114.9404296875,924.8857421875,10.9609375}, {2119.5126953125,925.2861328125,10.9609375}, {2645.7197265625,1112.7802734375,10.8203125}, {2639.984375,1112.56640625,10.8203125}, {2634.828125,1112.3466796875,10.9609375}, {2634.1826171875,1101.9482421875,10.8203125}, {2636.7509765625,1101.6748046875,10.8203125}, {2643.5126953125,1101.81640625,10.8203125}, {2209.576171875,2469.8251953125,10.8203125}, {2208.8310546875,2475.09375,10.8203125}, {1005.078125,-901.7490234375,42.216625213623}, {993.025390625,-902.474609375,42.222496032715}, {-6062.0649414063,50.474006652832,32.802623748779}, } lootItems = { helicrashsides = { {"Compass",1851,1,0,2}, {"Scrap Metal",1577,1,0,3}, {"Stinger",2899,0.3,0,3}, {"Tire Repair Kit",2015,0.5,0,4}, {"Hose",1880,0.5,0,6}, {"Syringe",2000,1,0,6}, {"Night Vision Goggles",368,1,90,10}, {"Box of Matches",328,0.4,90,2}, {"Hunting Knife",335,1,90,4}, {"Chainsaw",341,1,90,4}, {"Hatchet",339,1,90,3}, {"Pizza",1582,1,0,2}, {"Soda Bottle",2647,1,0,2}, {"Empty Gas Canister",1650,1,0,2}, {"Roadflare",324,1,90,2}, {"Grenade",342,1,0,2}, {"Parachute",342,1,0,2}, {"Watch",2710,1,0,4}, {"Crossbow",357,1,90,6}, {"Night Vision Goggles",368,1,90,1.5}, {"Tire",1073,1,0,2}, {"GPS",2976,0.15,0,3}, {"Map",1277,0.8,90,7}, {"Toolbox",2969,0.5,0,1}, {"Engine",929,0.3,0,2}, {"Main Rotor Assembly",929,0.3,0,2}, {"Tent",1279,1,0,3.5}, {"Infrared Goggles",369,1,90,3}, }, hospital = { {"Syringe",2000,1,0}, {"Antibiotics",1919,2.1,0}, {"Medic Kit",2891,0.7,0}, {"Heat Pack",1576,1,0}, {"Bandage",1578,0.5,0}, {"Blood Bag",1580,1,0}, {"Morphine",1579,1,0}, {"Blood Bag",1580,1,0}, {"Medic Kit",2891,0.7,0}, {"Blood Bag",1580,1,0}, {"Painkiller",1580,1,0} } } for i,bpData in pairs(BackpacksTable)do table.insert(lootItems.helicrashsides,{bpData[1],bpData[3],1,0,bpData[4][5]}) end function updateHospitals() for i,box in pairs(hospitalCol)do for _,items in ipairs(lootItems.hospital)do setElementData(hospitalCol[i],items[1],math.random(1,5)) end end setTimer(updateHospitals,3600000,1) end hospitalCol = {} function createHospitalPacks() number1 = 0 for i,box in ipairs(hospitalPacks)do number1 = number1 + 1 local x,y,z = box[1],box[2],box[3] object = createObject(1558,x,y,z) setObjectScale(object,1) hospitalCol[i] = createColSphere(x,y,z,2) setElementData(hospitalCol[i],"parent",object) setElementData(hospitalCol[i],"hospitalbox",true) setElementData(hospitalCol[i],"MAX_Slots",20) for _,items in ipairs(lootItems.hospital)do local randomNumber = math.random(1,10) if randomNumber >= 5 then setElementData(hospitalCol[i],items[1],math.random(1,5)) end end end setTimer(updateHospitals,3600000,1) end createHospitalPacks() patrolCol = {} for num,patrol in ipairs(patrolPoints) do local x,y,z = patrol[1],patrol[2],patrol[3] patrolCol[num] = createColSphere(x,y,z,3) setElementData(patrolCol[num],"patrolstation",true) local rand = math.random(1,15) if rand == 1 then lts = 100 elseif rand == 2 or rand == 3 then lts = 80 elseif rand >= 4 or rand <= 6 then lts = 60 elseif rand >= 7 or rand <= 10 then lts = 40 else lts = 20 end setElementData(patrolCol[num],"patrollts",lts) end function updatepatrol() for i,box in pairs(patrolCol) do local rand = math.random(1,15) if rand == 1 then lts = 100 elseif rand == 2 or rand == 3 then lts = 80 elseif rand >= 4 or rand <= 6 then lts = 60 elseif rand >= 7 or rand <= 10 then lts = 40 else lts = 20 end setElementData(patrolCol[i],"patrollts",lts) end end setTimer(updatepatrol,10800000,0) function spawnDayZVehicles() for _, data in ipairs(vehicleSpawns) do veh = createVehicle(data[1],data[2],data[3],data[4]) vehCol = createColSphere(data[2],data[3],data[4],2.5) attachElements(vehCol,veh,0,0,0) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) 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,"Tire_inVehicle_HP",400) setElementData(vehCol,"Engine_inVehicle_HP",400) setElementData(vehCol,"Parts_inVehicle_HP",400) setElementData(vehCol,"armorPointsMax",1000) setElementData(vehCol,"armorPoints",0) setElementData(vehCol,"vehicle:station",0) setElementData(vehCol,"receiver",0) setVehicleHeadLightColor(veh,math.random(0,255),math.random(0,255),math.random(0,255)) setElementData(vehCol,"fuel",10) setElementData(vehCol,"MAX_Slots",data[5]) setElementData(vehCol,"spawn",{data[1],data[2],data[3],data[4]}) end end function spawnVehiclePack(ps,cmd) if getElementData(ps,"admin") then spawnDayZVehicles() outputChatBox("SVP Sucess!",ps,8, 193, 207,true) end end addCommandHandler("svp",spawnVehiclePack) function notifyAboutExplosion() occupants = getVehicleOccupants(source) or {} for _,peds in pairs(occupants)do removePedFromVehicle(peds) end local col = getElementData(source,"parent") -- if col and getElementData(col,"helicrash") then return end id,x,y,z = getElementData(col,"spawn")[1],getElementData(col,"spawn")[2],getElementData(col,"spawn")[3],getElementData(col,"spawn")[4] setTimer(respawnDayZVehicle,15000,1,id,x,y,z,source,col,getElementData(col,"MAX_Slots")) setElementData(col,"deadVehicle",true) setElementData(source,"isExploded",true) x1,y1,z1 = getElementPosition(source) createExplosion(x1+1,y1+1,z1,4) createExplosion(x1-1,y1-1,z1,4) createExplosion(x1+1,y1-1,z1,4) createExplosion(x1-1,y1+1,z1,4) end addEventHandler("onVehicleExplode",getRootElement(),notifyAboutExplosion) function respawnVehiclesInWater(vehiclesInWater) for i,veh in ipairs(getElementsByType("vehicle"))do if isElementInWater(veh) and getVehicleType(veh) ~= "Boat" then local col = getElementData(veh,"parent") id,x,y,z = getElementData(col,"spawn")[1],getElementData(col,"spawn")[2],getElementData(col,"spawn")[3],getElementData(col,"spawn")[4] --respawnDayZVehicle(id,x,y,z,veh,col) respawnDayZVehicle(id,x,y,z,veh,col,getElementData(col,"MAX_Slots")) end end end setTimer(respawnVehiclesInWater,1800000,0) function respawnDayZVehicle(id,x,y,z,veh,col,max_slots) local armorMax = getElementData(col,"armorPointsMax") destroyElement(veh) destroyElement(col) veh = createVehicle(id,x,y,z+1) vehCol = createColSphere(x,y,z,4) attachElements ( vehCol, veh, 0, 0, 0 ) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"MAX_Slots",max_slots) --Engine + Tires 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,"Tire_inVehicle_HP",400) setElementData(vehCol,"Engine_inVehicle_HP",400) setElementData(vehCol,"Parts_inVehicle_HP",400) setElementData(vehCol,"armorPointsMax",armorMax) setElementData(vehCol,"armorPoints",0) setVehicleHeadLightColor(veh,math.random(0,255),math.random(0,255),math.random(0,255)) setElementData(vehCol,"receiver",0) setElementData(vehCol,"vehicle:station",0) --vehicle_indentifikation setElementData(vehCol,"spawn",{id,x,y,z}) --others setElementData(vehCol,"fuel",10) end function onPlayerEnterDayzVehicle(veh,seat) local col = getElementData(veh,"parent") local id = getElementModel(veh) local tires,engine,parts = getVehicleAddonInfos (id) setElementData(veh,"maxfuel",getVehicleMaxFuel(col)) setElementData(veh,"needtires",tires) setElementData(veh,"needengine",engine) setElementData(veh,"needparts",parts) if ((getElementData(col,"Tire_inVehicle") or 0) < tonumber(tires)) then setVehicleEngineState(veh,false) return end if ((getElementData(col,"Engine_inVehicle") or 0) < tonumber(engine)) then setVehicleEngineState(veh,false) return end if ((getElementData(col,"Parts_inVehicle") or 0) < tonumber(parts)) then setVehicleEngineState(veh,false) return end if (getElementData(col,"fuel") or 0) <= 1 then if not getElementModel(veh) == 510 then setVehicleEngineState(veh,false) return end end bindKey(source,"k","down",setEngineStateByPlayer) triggerClientEvent (source, "displayClientInfo", source,"Vehicle","Pressione a tecla *K* para ligar/desligar o veículo",200,200,22) end addEventHandler("onPlayerVehicleEnter",getRootElement(),onPlayerEnterDayzVehicle) function setEngineState(player,key,keyState) local theVehicle = getPedOccupiedVehicle(player) if theVehicle and getVehicleController(theVehicle) == player then if checkVehicleMovable(theVehicle) then setVehicleEngineState(theVehicle, not getVehicleEngineState(theVehicle)) end end end function checkVehicleMovable(veh) if isElement(veh) then local parent = getElementData(veh,"parent") if parent then if ((getElementData(parent,"Tire_inVehicle") or 0) ~= getElementData(veh,"needtires")) then setVehicleEngineState(veh,false) return false end if ((getElementData(parent,"Engine_inVehicle") or 0) ~= getElementData(veh,"needengine")) then setVehicleEngineState(veh,false) return false end if ((getElementData(parent,"Parts_inVehicle") or 0) ~= getElementData(veh,"needparts")) then setVehicleEngineState (veh,false) return false end return true end end end function onPlayerExitDayzVehicle(veh,seat) if seat == 0 then setVehicleEngineState (veh,false) end unbindKey(source,"k","down",setEngineState) end addEventHandler("onPlayerVehicleExit",getRootElement(),onPlayerExitDayzVehicle) function setVehiclesFuelPerMinute () for i,veh in ipairs(getElementsByType("vehicle")) do if getVehicleEngineState(veh) == true then if getElementData(getElementData(veh,"parent"),"fuel") >= 0 then setElementData(getElementData(veh,"parent"),"fuel",getElementData(getElementData(veh,"parent"),"fuel")-getVehicleFuelRemove(getElementModel(veh),getElementData(veh,"parent"))) else setVehicleEngineState ( veh, false ) end end end end setTimer(setVehiclesFuelPerMinute,20000,0) function isVehicleReadyToStart2 (veh) if getElementData(getElementData(veh,"parent"),"fuel") >= 1 then local tires,engine,parts,metal = getVehicleAddonInfos (getElementModel(veh)) if (getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0) > tonumber(tires) and (getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0) > tonumber(engine) and (getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0) > tonumber(parts) then setVehicleEngineState ( veh, true ) end end setTimer(isVehicleReadyToStart2,1000,1,veh) end repairTimer = {} function repairVehicle (veh) if repairTimer[veh] then triggerClientEvent (source, "displayClientInfo", source,"Vehicle"," is currently being repaired!",255,22,0) return end local health = math.floor(getElementHealth(veh)) repairTimer[veh] = setTimer(fixVehicleDayZ, 25000, 1, veh, source) setElementFrozen (veh,true) setElementData(veh,"repairer",source) setElementData(source,"repairingvehicle",veh) setPedAnimation (source,"SCRATCHING","sclng_r",nil,false,false) triggerClientEvent (source, "displayClientInfo", source,"Vehicle","Você começou a reparar o veículo, aguarde...",255,0,0) end addEvent("repairVehicle",true) addEventHandler("repairVehicle",getRootElement(),repairVehicle) function fixVehicleDayZ(veh,player) setElementHealth(veh,1000) fixVehicle (veh) setPedAnimation(player,false) setElementFrozen (veh,false) setVehicleDamageProof (veh,false) repairTimer[veh] = nil setElementData(veh,"repairer",nil) setElementData(player,"repairingvehicle",nil) triggerClientEvent (player, "displayClientInfo", player,"Vehicle","Você terminou de reparar o veículo.",22,255,0) end function stopFixxingWhileMoving() local veh = getElementData(source,"repairingvehicle") setPedAnimation(source) setElementFrozen (veh,false) setVehicleDamageProof (veh,false) setElementData(veh,"repairer",nil) setElementData(source,"repairingvehicle",nil) setElementData(source,"Repairing",false) triggerClientEvent (source, "displayClientInfo", source,"Vehicle","Você parou de reparar o veículo.",22,255,0) killTimer(repairTimer[veh]) repairTimer[veh] = nil end addEvent("onClientMovesWhileAnimation",true) addEventHandler("onClientMovesWhileAnimation",getRootElement(),stopFixxingWhileMoving) function debugFixxing() for i,veh in ipairs(getElementsByType("vehicle")) do if getElementData(veh,"repairer") == source then setVehicleDamageProof (veh,false) outputDebugString("Vehicle repairer disconnected - destroyed tables") killTimer(repairTimer[veh]) setElementFrozen (veh,false) repairTimer[veh] = nil setElementData(veh,"repairer",nil) end end end addEventHandler("onPlayerQuit",getRootElement(),debugFixxing) function setEngineStateByPlayer (playersource) local veh = getPedOccupiedVehicle (playersource) local seat = getPedOccupiedVehicleSeat ( playersource ) if seat == 0 then if getElementData(getElementData(veh,"parent"),"fuel") <= 0 then return end local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) local col = getElementData ( veh, "parent" ) if col then if ((getElementData(col,"Tire_inVehicle") or 0) < tonumber(tires)) then setVehicleEngineState ( veh, false ) return end if ((getElementData(col,"Engine_inVehicle") or 0) < tonumber(engine)) then setVehicleEngineState ( veh, false ) return end if ((getElementData(col,"Parts_inVehicle") or 0) < tonumber(parts)) then setVehicleEngineState ( veh, false ) return end end setVehicleEngineState (veh, not getVehicleEngineState(veh)) if getVehicleEngineState(veh) == true then triggerClientEvent (playersource, "displayClientInfo", playersource,"Vehicle","Motor Ligado!",22,255,0) else triggerClientEvent (playersource, "displayClientInfo", playersource,"Vehicle","Motor Desligado!",255,22,0) end end end sistema de backup --## Copyright (c) 2015 Grosu `PoWeR` Mihaita. local dbType = "SQLite"; --Here set your db type, "MySQL" or "SQLite" <!> local dbName = ""; --Your database name <!> local dbHost = ""; --Your hostname/IP <!> local dbUser = ""; --Username for database <!> local dbPass = ""; --Password for database <!> local dbPort = 1234; --This is an port exemple CHANGE IT <!> local last_veh_id = 0; --Don't edit here <!> local last_tent_id = 0; --Don't edit here <!> local itemsDataTable = { -- If your server have different items be sure you imported your item table here! {"M4A1"}, {"M4A1 CCO"}, {"M4A1 CCO SD"}, {"Sa-58P"}, {"Sa-58P CCO"}, {"M4A3 CCO"}, {"M16A4 ACOG"}, {"G36C (Camo)"}, {"M16A2"}, {"FN FAL"}, {"AKS-74U"}, {"AKS (Gold)"}, {"MG36"}, {"Bizon PP-19 SD"}, {"AK-107"}, {"AK-107 GL"}, {"AK-74"}, {"G36C"}, {"Gorro Noel"}, {"G36C SD"}, {"AKS-74 Kobra"}, {"AKM"}, {"RPK"}, {"CZ 550"}, {"SVD CAMO"}, {"M40A3"}, {"DMR"}, {"M24"}, {"M107"}, {"AS50"}, {"KSVK"}, {"Cheytac M200"}, {"M249 SAW"}, {"Mk 48 Mod 0"}, {"M240"}, {"PKM"}, {"PKP"}, {"Double-Barreled Shotgun"}, {"M1014"}, {"Remington 870"}, {"Winchester 1866"}, {"Sawn-Off Shotgun"}, {"PDW"}, {"MP5A5"}, {"MP5SD6"}, {"Machete"}, {"Hatchet"}, {"Crowbar"}, {"Shovel"}, {"Makarov PM"}, {"Makarov SD"}, {"G17"}, {"M1911"}, {"M9"}, {"M9 SD"}, {"Revolver"}, {"Balanced Vest"}, {"Press Vest"}, {"Police Vest"}, {"Light Tactical Vest"}, {"Balistic Vest"}, {"UK Assalt Vest DPM Camo"}, {"UK Assalt Vest DPM Black"}, {"Balistic Plus Vest"}, {"Helmet"}, {"Mossy Helmet"}, {"UN Helmet"}, {"Gorro Noel"}, {"Aviator Helmet"}, {"Gas Mask 1"}, {"Gas Mask 2"}, {"Motorbike Helmet 1"}, {"Motorbike Helmet 2"}, {"Motorbike Helmet 3"}, {"Motorbike Helmet 4"}, {"Skate Helmet"}, {"Tanker Helmet"}, {"Welding Helmet 1"}, {"Welding Helmet 2"}, {"Smersh Backpack"}, {"Courier Bag"}, {"Child Briefcase"}, {"Improvised Backpack"}, {"Assault Pack (ACU)"}, {"Alice Pack"}, {"British Assault Pack"}, {"Taloon Backpack"}, {"Omega Backpack"}, {"Alfa Backpack"}, {"Hunting Backpack"}, {"Camping Backpack"}, {"Drybag Backpack"}, {"Mountain Backpack"}, {"Czech Backpack"}, {"Camping Tactical Backpack"}, {"Coyote Backpack"}, {"Coyote Backpack (Desert)"}, {"Coyote Backpack (Mossy)"}, {"Tactical Backpack"}, {"Eskimo Backpack"}, {"Tiger Backpack"}, {"Noel Backpack"}, {"Canned Spaghetti (Fechado)"}, {"Canned Spaghetti (Aberto)"}, {"Canned Baked Beans (Fechado)"}, {"Canned Baked Beans (Aberto)"}, {"Canned Sardines (Fechado)"}, {"Canned Sardines (Aberto)"}, {"Can of Tactical Bacon (Fechado)"}, {"Can of Tactical Bacon (Aberto)"}, {"Water Bottle"}, {"Burger"}, {"Pizza"}, {"Soda Bottle"}, {"Milk"}, {"Cooked Meat"}, {"Raw Meat"}, {"Antibiotics"}, {"Bandage"}, {"Medic Kit"}, {"Heat Pack"}, {"Painkiller"}, {"Blood Bag"}, {"Morphine"}, {"Engine"}, {"Tire"}, {"Tank Parts"}, {"Scrap Metal"}, {"Steel Sheet"}, {"Empty Gas Canister"}, {"Full Gas Canister"}, {"Stinger"}, {"Wood Pile"}, {"Roadflare"}, {"Wire Fence"}, {"Tent"}, {"Empty Water Bottle"}, {"Empty Soda Cans"}, {"Night Vision Goggles"}, {"Infrared Goggles"}, {"Map"}, {"Box of Matches"}, {"Watch"}, {"GPS"}, {"Toolbox"}, {"Radio Device"}, {"Syringe"}, {"Opener"}, {"Hose"}, {"Tire Repair Kit"}, {"Compass"}, ------- {"30Rnd. STANAG"}, {"FN FAL Mag."}, {"G36 Mag"}, {"30Rnd. AK"}, {"CZ 550 Mag."}, {"SVD Mag."}, {"M24 Mag."}, {"DMR Mag."}, {"10Rnd. M107"}, {"5Rnd. KSVK"}, {"5Rnd. Cheytac M200"}, {"100Rnd. M249 SAW"}, {"100Rnd. M240."}, {"PKM Mag."}, {"2Rnd. Slug"}, {"Bizon Mag"}, {"MG36 Mag."}, {"M1014 Slug"}, {"1866 Slug"}, {"PDW Mag"}, {"AKM Mag."}, {"5Rnd 12.7x99mm NATO"}, {"Sa-58 Mag."}, {"MP5 Mag"}, {"Grenade"}, {"Tear Gas"}, {"Binoculars"}, {"Parachute"}, {"Makarov Mag"}, {"G17 Mag"}, {"M1911 Mag"}, {"M9 Mag"}, {".45 ACP"} }; function noteAdmins(theAlert) for _,v in ipairs(getElementsByType("player")) do if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin"))) then outputChatBox("#FF0000[Backup]: #FFFFFF"..tostring(theAlert), v, 255, 255, 255, true); end end end if (dbType == "MySQL") then db = dbConnect("mysql", "dbname="..dbName..";host="..dbHost..";port="..dbPort, dbUser, dbPass, "share=1"); dbExec(db, "CREATE TABLE IF NOT EXISTS vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id)"); dbExec(db, "CREATE TABLE IF NOT EXISTS tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id)"); noteAdmins("Database connected to MySQL!"); elseif (dbType == "SQLite") then db = dbConnect("sqlite", "database.db"); dbExec(db, "CREATE TABLE IF NOT EXISTS vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id)"); dbExec(db, "CREATE TABLE IF NOT EXISTS tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id)"); noteAdmins("Database connected to SQLite!"); else noteAdmins("Error: `dbType` wrong attribute!"); return false; end function backup_vehs() dbExec(db, "DELETE FROM vehicles"); local vehicleCounter = 0; for _,veh in ipairs(getElementsByType("vehicle")) do if (not getElementData(veh, "helicrash") and not getElementData(veh, "deadVehicle")) then local col = getElementData(veh, "parent"); if (col and getElementType(col) == "colshape") then local model = getElementModel(veh); local x, y, z = getElementPosition(veh); local rX, rY, rZ = getElementRotation(veh); local slots = getElementData(col, "MAX_Slots") or 20; local fuel = getElementData(col, "fuel") or 0; local moving = getElementData(col, "Tire_inVehicle") or 0; local engines = getElementData(col, "Engine_inVehicle") or 0; local parts = getElementData(col, "Parts_inVehicle") or 0; local siren = getElementData(col, "Sirene_inVehicle") or 0; local receiver = getElementData(col, "receiver") or 0; local armorPointsMax = getElementData(col, "armorPointsMax") or 0; local armorPoints = getElementData(col, "armorPoints") or 0; local items = {}; vehicleCounter = vehicleCounter + 1; for _,v in ipairs(itemsDataTable) do local quantity = getElementData(col, v[1]) or 0; if (quantity > 0) then table.insert(items, {v[1], quantity}); end end dbExec(db, "INSERT INTO vehicles(model, x, y, z, rX, rY, rZ, slots, fuel, engines, receiver, armorPoints, armorPointsMax, moving, parts, items, id) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", model, x, y, z, rX, rY, rZ, slots, fuel, engines, receiver, armorPoints, armorPointsMax, moving, parts, toJSON(items), vehicleCounter) end end end noteAdmins("Veículos Salvos ["..vehicleCounter.."]"); end addEventHandler("onResourceStop",getResourceRootElement(),backup_vehs) setTimer(backup_vehs,3600000,0) function backup_tents() dbExec(db, "DELETE FROM tents"); local tentsCounter = 0; for _,col in ipairs(getElementsByType("colshape")) do if (getElementData(col, "tent")) then local tent = getElementData(col, "parent"); local x, y, z = getElementPosition(tent); local rX, rY, rZ = getElementRotation(tent); local model = getElementModel(tent); local slots = getElementData(col, "MAX_Slots") or 300; local scale = getObjectScale(tent); local items = {}; tentsCounter = tentsCounter + 1; for _,v in ipairs(itemsDataTable) do local quantity = getElementData(col, v[1]) or 0; if (quantity > 0) then table.insert(items, {v[1], quantity}); end end dbExec(db, "INSERT INTO tents(model, x, y, z, rX, rY, rZ, slots, scale, items, id) VALUES(?,?,?,?,?,?,?,?,?,?,?)", model, x, y, z, rX, rY, rZ, slots, scale, toJSON(items), tentsCounter) end end noteAdmins("Tendas Salvas ["..tentsCounter.."]"); end addEventHandler("onResourceStop",getResourceRootElement(),backup_tents) setTimer(backup_tents,3600000,0) function create_veh(model, x, y, z, rX, rY, rZ, slots, fuel, receiver, armorPoints, armorPointsMax, engines, moving, parts, items, id) local veh = createVehicle(model, x, y, z); local vehCol = createColSphere(x, y, z, 4); setElementRotation(veh, rX, rY, rZ); attachElements(vehCol, veh, 0, 0, 0); setElementData(vehCol, "parent", veh); setElementData(veh, "parent", vehCol); setElementData(vehCol, "vehicle", true); setElementData(vehCol, "MAX_Slots", tonumber(slots)); setElementData(vehCol, "Tire_inVehicle", tonumber(moving)); setElementData(vehCol, "Engine_inVehicle", tonumber(engines)); setElementData(vehCol, "Parts_inVehicle", tonumber(parts)); setElementData(vehCol, "spawn", {model, x, y, z}); setElementData(vehCol, "fuel", tonumber(fuel)); setElementData(vehCol, "receiver", tonumber(receiver)); setElementData(vehCol, "armorPointsMax", tonumber(armorPointsMax)); setElementData(vehCol, "armorPoints", tonumber(armorPoints)); for _,v in ipairs(fromJSON(items)) do setElementData(vehCol, v[1], v[2]); end end function create_tent(model, x, y, z, rX, rY, rZ, slots, scale, items, id) local tent = createObject(model, x, y, z); local tentCol = createColSphere(x, y, z, 4); setElementRotation(tent, rX, rY, rZ); setObjectScale(tent, scale); attachElements(tentCol, tent, 0, 0, 0); setElementData(tentCol, "parent", tent); setElementData(tent, "parent", tentCol); setElementData(tentCol, "tent", true); setElementData(tentCol, "vehicle", true); setElementData(tentCol, "MAX_Slots", slots); setElementData(tentCol,"visible",true) for _,v in ipairs(fromJSON(items)) do setElementData(tentCol, v[1], v[2]); end end function load_vehs(q) if (q) then local p = dbPoll(q, 0); if (#p > 0) then for _,d in pairs(p) do last_veh_id = d["id"]; create_veh(d["model"], d["x"], d["y"], d["z"], d["rX"], d["rY"], d["rZ"], d["slots"], d["fuel"],d["receiver"], d["armorPoints"], d["armorPointsMax"], d["engines"], d["moving"], d["parts"], d["items"], d["id"]); end end end noteAdmins("Veiculos Carregados!"); end function load_tents(q) if (q) then local p = dbPoll(q, 0); if (#p > 0) then for _,d in pairs(p) do last_tent_id = d["id"]; create_tent(d["model"], d["x"], d["y"], d["z"], d["rX"], d["rY"], d["rZ"], d["slots"], d["scale"], d["items"], d["id"]); end end end noteAdmins("Tendas Carregadas!"); end function start_resource () dbQuery(load_tents, {}, db, "SELECT * FROM `tents`") dbQuery(load_vehs, {}, db, "SELECT * FROM `vehicles`") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), start_resource) addEventHandler("onPlayerCommand", root, function(cmd) if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin"))) then if (cmd == "loadtent") then --carregar tendas dbQuery(load_tents, {}, db, "SELECT * FROM `tents`"); elseif (cmd == "loadcar") then --carregar veiculos dbQuery(load_vehs, {}, db, "SELECT * FROM `vehicles`"); elseif (cmd == "savecar") then --salvar veiculos backup_vehs(); elseif (cmd == "savetent") then -- salvar tendas backup_tents(); elseif (cmd == "backup") then --start stop backup a cada 30 minutos if (isTimer(vehbkTimer) and isTimer(tentbkTimer)) then killTimer(vehbkTimer); killTimer(tentbkTimer); noteAdmins(getPlayerName(source).."#FFFFFF Backup Automatico Parado!"); else vehbkTimer = setTimer(backup_vehs, 30*60000, 0); tentbkTimer = setTimer(backup_tents, 30*60000, 0); noteAdmins(getPlayerName(source).."#FFFFFF Backup Automatico Iniciado!"); end end end end);
  11. Eu havia tentado isto também, porém sem resultado, mas valeu pela tentativa de ajudar
  12. Boa noite, alguem pode me ajudar? o HUD é de veículos, estava funcionando normalmente, e de um dia pro outro parou de funcionar e ficou dando este erro. ERROR: HudVeh\client.Lua:28: attempt to compare boolean with number ja tentei de tudo e não consegui, se alguem puder me dizer onde estou errando, ou oque tenho que fazer. local sZ = { guiGetScreenSize() } local color = {} details = { {"Tire_inVehicle"}, {"Engine_inVehicle"}, {"Parts_inVehicle"}, } color.fuel = {80,190,80,135} color.engine = {80,190,80,135} color.parts = {80,190,80,135} color.tire = {80,190,80,135} color.armor = {255,0,0,255} color.health = {80,190,80,135} addEventHandler("onClientRender",getRootElement(), function() local inVehicle = getPedOccupiedVehicle(getLocalPlayer()) if inVehicle and isPedInVehicle(localPlayer) and getVehicleController(inVehicle) then if parent and fuel and armor then if fuel > 150/2 then color.fuel = {80,190,80,135} elseif fuel <= 150/2 and fuel > 150/3 then color.fuel = {80,190,80,135} elseif fuel <= 150/3 then color.fuel = {80,190,80,135} end if getElementData(parent,"Engine_inVehicle_HP") <= 400 and getElementData(parent,"Engine_inVehicle_HP") > 300 and getElementData(parent,"Engine_inVehicle") == getElementData(inVehicle,"needengine") then--by XaskeL color.engine = {95,146,85,255} elseif getElementData(parent,"Engine_inVehicle_HP") <= 300 and getElementData(parent,"Engine_inVehicle_HP") > 150 and getElementData(parent,"Engine_inVehicle") == getElementData(inVehicle,"needengine") then color.engine = {180,180,114,135} elseif getElementData(parent,"Engine_inVehicle_HP") <= 150 and getElementData(parent,"Engine_inVehicle") == getElementData(inVehicle,"needengine") then color.engine = {244,122,42,255} else color.engine = {199,40,40,255} end if getElementData(parent,"Parts_inVehicle_HP") <= 400 and getElementData(parent,"Parts_inVehicle_HP") > 300 and getElementData(parent,"Parts_inVehicle") == getElementData(inVehicle,"needparts") then color.parts = {80,190,80,135} elseif getElementData(parent,"Parts_inVehicle_HP") <= 300 and getElementData(parent,"Parts_inVehicle_HP") > 150 and getElementData(parent,"Parts_inVehicle") == getElementData(inVehicle,"needparts") then color.parts = {180,180,114,135} elseif getElementData(parent,"Parts_inVehicle_HP") <= 150 and getElementData(parent,"Parts_inVehicle") == getElementData(inVehicle,"needparts") then color.parts = {244,122,42,255} else color.parts = {199,40,40,255} end if getElementData(parent,"Tire_inVehicle_HP") <= 400 and getElementData(parent,"Tire_inVehicle_HP") > 300 and getElementData(parent,"Tire_inVehicle") == getElementData(inVehicle,"needtires") then color.tire = {80,190,80,135} elseif getElementData(parent,"Tire_inVehicle_HP") <= 300 and getElementData(parent,"Tire_inVehicle_HP") > 150 and getElementData(parent,"Tire_inVehicle") == getElementData(inVehicle,"needtires") then color.tire = {180,180,114,135} elseif getElementData(parent,"Tire_inVehicle_HP") <= 150 and getElementData(parent,"Tire_inVehicle") == getElementData(inVehicle,"needtires") then color.tire = {244,122,42,255} else color.tire = {199,40,40,255} end if getElementHealth(inVehicle) > 500 then color.health = {95,146,85,255} elseif getElementHealth(inVehicle) < 500 and getElementHealth(inVehicle) > 350 then color.health = {180,180,114,135} elseif getElementHealth(inVehicle) <= 350 then color.health = {200,30,30,135} else color.tire = {199,40,40,255} end -- fuel dxDrawBoxFon(sZ[1] * 0.010,sZ[2] * 0.450,10,-150,tocolor(0,0,0,135),tocolor(0,0,0,255)) dxDrawBoxFon(sZ[1] * 0.010,sZ[2] * 0.450,10,-fuel,tocolor(unpack(color.fuel)),tocolor(0,0,0,0)) -- armor points if armor > 0 then dxDrawBoxFon(sZ[1] * 0.070,sZ[2] * 0.450,10,-150,tocolor(0,0,0,255),tocolor(0,0,0,255)) dxDrawBoxFon(sZ[1] * 0.070,sZ[2] * 0.450,10,-armor,tocolor(unpack(color.armor)),tocolor(0,0,0,0)) end -- engine dxDrawBoxFon(sZ[1] * 0.025,sZ[2] * 0.331,37,17,tocolor(unpack(color.engine)),tocolor(0,0,0,255)) --dxDrawText("ENG",sZ[1] * 0.029,sZ[2] * 0.340,40,20,tocolor(255,255,255,255),1,"default-bold") dxDrawText("ENG",sZ[1] * 0.029,sZ[2] * 0.333,40,20,tocolor(0,0,0,255),0.85,"default-bold") -- dxDrawText("ENG", (screenW * 0.0266) + 1, (screenH * 0.3369) + 1, (screenW * 0.0578) + 1, (screenH * 0.3574) + 1, tocolor(0, 0, 0, 255), 1.10, "default-bold", "center", "center", false, false, false, false, false) -- dxDrawText("ENG", screenW * 0.0266, screenH * 0.3369, screenW * 0.0578, screenH * 0.3574, tocolor(255, 255, 255, 255), 1.10, "default-bold", "center", "center", false, false, false, false, false) -- Parts dxDrawBoxFon(sZ[1] * 0.025,sZ[2] * 0.355,37,17,tocolor(unpack(color.parts)),tocolor(0,0,0,255)) dxDrawText("PARTS",sZ[1] * 0.029,sZ[2] * 0.357,40,20,tocolor(0,0,0,255),0.85,"default-bold") -- Whl dxDrawBoxFon(sZ[1] * 0.025,sZ[2] * 0.383,37,17,tocolor(unpack(color.tire)),tocolor(0,0,0,255)) dxDrawText("WHL",sZ[1] * 0.029,sZ[2] * 0.383,40,20,tocolor(0,0,0,255),1,"default-bold") -- HULL dxDrawBoxFon(sZ[1] * 0.025,sZ[2] * 0.305,37,17,tocolor(unpack(color.health)),tocolor(0,0,0,255)) dxDrawText("HULL",sZ[1] * 0.029,sZ[2] * 0.306,40,20,tocolor(0,0,0,255),0.85,"default-bold") checkVehicleMovable(inVehicle) end end end) function dxDrawBoxFon(x, y, w, h, rcolor, lcolor) dxDrawRectangle(x, y, w, h, rcolor) dxDrawLine(x - 1, y - 1, x - 1, y + h, lcolor, 1) dxDrawLine(x + w, y - 1, x + w, y + h, lcolor, 1) dxDrawLine(x - 1, y + h, x + w, y + h, lcolor, 1) dxDrawLine(x - 1, y - 1, x + w, y - 1, lcolor, 1) end function drawLine(x,y,w,h,lcolor) dxDrawLine(x - 1, y + h, x + w, y + h, lcolor, 1) end function checkVehicleMovable(veh) if isElement(veh) then local parent = getElementData(veh,"parent") if parent then if ((getElementData(parent,"Tire_inVehicle") or 0) ~= getElementData(veh,"needtires")) then setVehicleEngineState(veh,false) return end if ((getElementData(parent,"Engine_inVehicle") or 0) ~= getElementData(veh,"needengine")) then setVehicleEngineState(veh,false) return end if ((getElementData(parent,"Parts_inVehicle") or 0) ~= getElementData(veh,"needparts")) then setVehicleEngineState (veh,false) return end end end end
  13. várias armas em um mesmo id, por exemplo o id da m4 padrão é o 30 certo? fiz várias armas em cima do id 30 mudando as skins.
  14. Olá boa noite, seguinte, tenho um problema que creio que não deve ser difícil porém não sei onde estou errando, oque acontece, tenho um servidor de dayz, e como todos sabem no inventario existem as armas primarias, armas secundarias e armas especiais, e eu queria que quando o player matasse outro player, mostrasse o nome da arma, porém as armas do meu servidor são duplicadas, então eu só consigo fazer a função aparecer, quando o player usa uma M4A1 por exemplo só aparece M4, porque foi feito em base do id da M4, que não me recordo se é o 30 ou 31, creio que seja o 30, mas enfim, queria saber como faço para poder mostrar o nome da arma exato quando o player morre, eu consegui descobrir como faz, porém só consigo pra arma primária, segue abaixo: currentweapon_1 = arma primaria currentweapon_2 = arma secundaria currentweapon_3 = armas especiais ou seja, conforme o player morre vai aparecer a arma no qual está selecionado na mão. -- o código funcional que mostra o nome da arma do player que matou triggerClientEvent ( "onRollMessageStart", getRootElement(),"#FF4500"..getPlayerName(source).." #FFA500Foi Morto por: #FF4500"..getPlayerName(killer).." #FFA500Pela Arma: #FFA500( #FF4500"..(getElementData ( killer, "currentweapon_1") or "fists").."#FFA500)",255,0,0, "died") -- o mesmo codigo porém adicionando o currentweapon 2 e currentweapon 3, este também é funcional, porém continua a mesma coisa, só mostra o nome da arma primária que no caso é o currentweapon_1 triggerClientEvent ( "onRollMessageStart", getRootElement(),"#FF4500"..getPlayerName(source).." #FFA500Foi Morto por: #FF4500"..getPlayerName(killer).." #FFA500Pela Arma: #FFA500( #FF4500"..(getElementData ( killer, "currentweapon_1" or "currentweapon_2" or "currentweapon_3" or "currentweapon_4") or "fists").."#FFA500)",255,0,0, "died") se alguem puder me ajudar, obrigado!! detalhe que esqueci de colocar, o segundo codigo funciona normal e não acusa erros, porém como eu disse acima, só funciona para armas primárias!!