Jump to content

~Sr.Victor

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by ~Sr.Victor

  1. Queria colocar ACL em um salário vip que tenho, mas todas as formas que tento não vai. function giveSalarioVIP(playerSource) if getElementData(playerSource, "isVIPRevolution") or getElementData(playerSource, "isVIPOmega") or getElementData(playerSource, "isVIPSigma") or getElementData(playerSource, "isVIPEpsylon") or getElementData(playerSource, "isVIPAlpha") then local account = getPlayerAccount(playerSource) local timeAtual = getRealTime().timestamp local day = 18000 local dataUltimaTroca = getAccountData(account, "ultimaTrocaSalario") or timeAtual - day local calc = timeAtual - dataUltimaTroca if calc < day then return outputChatBox("Espere "..secondsToTimeDesc(day - calc).." para receber o salário novamente", playerSource, 255, 0, 0) end local moneyValue, typeVIP = getMoneyFromACL(playerSource) if givePlayerMoney(playerSource, moneyValue) then outputChatBox("#00ffff#===========================================================", root, 0, 255, 0, true) outputChatBox("["..typeVIP.."] "..getPlayerName(playerSource).." pegou seu salário de $"..convertNumber(moneyValue)..", usando /salario", root, 0, 255, 0, true) outputChatBox("#00ffff#===========================================================", root, 0, 255, 0, true) setAccountData(account, "ultimaTrocaSalario", timeAtual) end else outputChatBox("Você não tem permissão para usar este comando. Adquira já seu VIP!", playerSource, 255, 0, 0) end end addCommandHandler("salario", giveSalarioVIP) function getMoneyFromACL(player) if getElementData(player, "isVIPRevolution") then return 80000, "VIP Revolution" elseif getElementData(player, "isVIPOmega") then return 50000, "VIP Omega" elseif getElementData(player, "isVIPSigma") then return 40000, "VIP Sigma" elseif getElementData(player, "isVIPEpsylon") then return 30000, "VIP Epsylon" elseif getElementData(player, "isVIPAlpha") then return 20000, "VIP Alpha" end return false end function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function secondsToTimeDesc( seconds ) if seconds then local results = {} local sec = ( seconds %60 ) local min = math.floor ( ( seconds % 3600 ) /60 ) local hou = math.floor ( ( seconds % 86400 ) /3600 ) local day = math.floor ( seconds /86400 ) if day > 0 then table.insert( results, day .. ( day == 1 and " dia" or " dias" ) ) end if hou > 0 then table.insert( results, hou .. ( hou == 1 and " hora" or " horas" ) ) end if min > 0 then table.insert( results, min .. ( min == 1 and " minuto" or " minutos" ) ) end if sec > 0 then table.insert( results, sec .. ( sec == 1 and " segundo" or " segundos" ) ) end return string.reverse ( table.concat ( results, ", " ):reverse():gsub(" ,", " e ", 1 ) ) end return "" end
  2. Estou com um gerenciador de vips, queria colocar quando o VIP é dado á alguém, é dada uma acl a pessoa. local vips = {} addEventHandler("onResourceStart", resourceRoot, function() --executeSQLQuery("DROP TABLE VIPS" ) executeSQLQuery("CREATE TABLE IF NOT EXISTS VIPS (type TEXT, login TEXT, nick TEXT, inicio TIMESTAMP, termino TIMESTAMP, staff TEXT)") for _, row in ipairs(executeSQLQuery("SELECT * FROM VIPS ORDER BY termino ASC")) do if (getAccount(row.login)) then vips[row.login] = tonumber(row.termino) local thePlayer = getAccountPlayer(getAccount(row.login)) if (thePlayer) then if row.type == "Revolution" then if not getElementData(thePlayer, "isVIPRevolution") then setElementData(thePlayer, "isVIPRevolution", true) end elseif row.type == "Omega" then if not getElementData(thePlayer, "isVIPOmega") then setElementData(thePlayer, "isVIPOmega", true) end elseif row.type == "Sigma" then if not getElementData(thePlayer, "isVIPSigma") then setElementData(thePlayer, "isVIPSigma", true) end elseif row.type == "Epsylon" then if not getElementData(thePlayer, "isVIPEpsylon") then setElementData(thePlayer, "isVIPEpsylon", true) end elseif row.type == "Alpha" then if not getElementData(thePlayer, "isVIPAlpha") then setElementData(thePlayer, "isVIPAlpha", true) end end end end end end ) addEvent( "setVip", true ) addEventHandler( "setVip", resourceRoot, function(accountName, dias, type) if (accountName and tonumber(dias)) then dias = tonumber(dias) if (getAccount(accountName)) then if (dias > 0) then local thePlayer = getAccountPlayer(getAccount(accountName)) local tipoVIP = type local inicio = getRealTime().timestamp local termino = inicio + ( dias * 86400 ) local staff = getPlayerName(client).." ("..getAccountName (getPlayerAccount (client))..")" if (not vips[accountName]) then outputChatBox("*Você adicionou "..dias.." dia(s) de VIP para a conta: "..accountName, client, 0, 255, 0) saveLog(getPlayerName(client).. " adicionou "..(dias).." dia(s) de "..tipoVIP.." para a conta: "..accountName) vips[accountName] = termino if (thePlayer) then if tipoVIP == "Revolution" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFadicionou #00FF00"..dias.." dia(s) #FFFFFFde VIP para sua conta (#00FF00"..accountName.."#FFFFFF)", thePlayer, 255, 255, 255, true) setElementData(thePlayer, "isVIPRevolution", true) givePlayerMoney(thePlayer, 1500000) elseif tipoVIP == "Omega" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFadicionou #00FF00"..dias.." dia(s) #FFFFFFde VIP para sua conta (#00FF00"..accountName.."#FFFFFF)", thePlayer, 255, 255, 255, true) setElementData(thePlayer, "isVIPOmega", true) givePlayerMoney(thePlayer, 1200000) elseif tipoVIP == "Sigma" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFadicionou #00FF00"..dias.." dia(s) #FFFFFFde VIP para sua conta (#00FF00"..accountName.."#FFFFFF)", thePlayer, 255, 255, 255, true) setElementData(thePlayer, "isVIPSigma", true) givePlayerMoney(thePlayer, 800000) elseif tipoVIP == "Epsylon" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFadicionou #00FF00"..dias.." dia(s) #FFFFFFde VIP para sua conta (#00FF00"..accountName.."#FFFFFF)", thePlayer, 255, 255, 255, true) setElementData(thePlayer, "isVIPEpsylon", true) givePlayerMoney(thePlayer, 300000) elseif tipoVIP == "Alpha" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFadicionou #00FF00"..dias.." dia(s) #FFFFFFde VIP para sua conta (#00FF00"..accountName.."#FFFFFF)", thePlayer, 255, 255, 255, true) setElementData(thePlayer, "isVIPAlpha", true) givePlayerMoney(thePlayer, 100000) end executeSQLQuery("INSERT INTO VIPS (type, login, nick, inicio, termino, staff) VALUES(?, ?, ?, ?, ?, ?)", tipoVIP, accountName, getPlayerName(thePlayer), inicio, termino, staff) triggerClientEvent(root, "ativarVip", resourceRoot, 1, removeHex(getPlayerName(thePlayer)), tipoVIP) else executeSQLQuery("INSERT INTO VIPS (type, login, nick, inicio, termino, staff) VALUES(?, ?, ?, ?, ?, ?)", tipoVIP, accountName, "--", inicio, termino, staff) end else outputChatBox("*A conta: "..accountName.." já possui VIP!", client, 255, 0, 0) end else outputChatBox("*O valor: "..tostring(dias).." é inválido!", client, 255, 0, 0) end else outputChatBox("*A conta: "..accountName.." é inexistente!", client, 255, 0, 0) end end end ) addEvent( "removerVIP", true ) addEventHandler( "removerVIP", resourceRoot, function(accountName) if (accountName) then if (getAccount(accountName)) then if (vips[accountName]) then outputChatBox("*Você removeu o VIP da conta: "..accountName, client, 0, 255, 0) saveLog(getPlayerName(client).. " removeu o VIP da conta: "..accountName) local thePlayer = getAccountPlayer(getAccount(accountName)) if (thePlayer) then local tipoVIP = getVIPType(accountName) if tipoVIP == "Revolution" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFremoveu o VIP da sua conta", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPRevolution") elseif tipoVIP == "Omega" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFremoveu o VIP da sua conta", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPOmega") elseif tipoVIP == "Sigma" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFremoveu o VIP da sua conta", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPSigma") elseif tipoVIP == "Epsylon" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFremoveu o VIP da sua conta", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPEpsylon") elseif tipoVIP == "Alpha" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFF"..getPlayerName(client).." #FFFFFFremoveu o VIP da sua conta", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPAlpha") end end executeSQLQuery("DELETE FROM VIPS WHERE login=?", accountName) vips[accountName] = nil else outputChatBox("*A conta: "..accountName.." não possui VIP!", client, 255, 0, 0) end else outputChatBox("*A conta: "..accountName.." é inexistente!", client, 255, 0, 0) end end end ) addEvent( "alterarVip", true ) addEventHandler( "alterarVip", resourceRoot, function(accountName, dias) if (accountName and tonumber(dias)) then dias = tonumber(dias) if (getAccount(accountName)) then if (dias > 0) then local thePlayer = getAccountPlayer(getAccount(accountName)) local termino = getRealTime().timestamp + ( dias * 86400 ) executeSQLQuery("UPDATE VIPS SET termino = ? WHERE login =?", termino, accountName) vips[accountName] = termino saveLog(getPlayerName(client).. " alterou o tempo de VIP da conta: "..accountName.." para "..dias.." dia(s)") outputChatBox("*Você alterou o tempo de VIP da conta: "..accountName.." para "..dias.." dia(s)", client, 0, 255, 0) if (thePlayer) then local tipoVIP = getVIPType(accountName) outputChatBox("#00FF00[VIP] #FFFFFF"..getPlayerName(client).." #FFFFFFmudou o seu tempo de VIP para #00FF00"..dias.." dia(s)", thePlayer, 255, 255, 255, true) triggerClientEvent(root, "ativarVip", resourceRoot, 2, removeHex(getPlayerName(thePlayer)), tipoVIP) end triggerEvent ( "getVipList", resourceRoot, client ) else outputChatBox("*O valor: "..tostring(dias).." é inválido!", client, 255, 0, 0) end else outputChatBox("*A conta: "..accountName.." é inexistente!", client, 255, 0, 0) end end end ) addEvent( "giveAll", true ) addEventHandler( "giveAll", resourceRoot, function(dias) if (tonumber(dias)) then dias = tonumber(dias) if (dias > 0) then for acc, termino in pairs(vips) do if (acc and getAccount(acc)) then if (vips[acc]) then termino = vips[acc] + ( dias * 86400 ) vips[acc] = termino executeSQLQuery("UPDATE VIPS SET termino = ? WHERE login =?", termino, acc) end end end saveLog(getPlayerName(client).. " incrementou "..tostring(dias).." dia(s) nos VIPS") outputChatBox("* Você incrementou "..tostring(dias).." dia(s) nos VIPS", client, 0, 255, 0) triggerEvent ( "loadLog", resourceRoot, client ) else outputChatBox("*O valor: "..tostring(dias).." é inválido!", client, 255, 0, 0) end end end ) addEvent( "removeAll", true ) addEventHandler( "removeAll", resourceRoot, function(dias) if (tonumber(dias)) then dias = tonumber(dias) if (dias > 0) then for acc, termino in pairs(vips) do if (acc and getAccount(acc)) then if (vips[acc]) then termino = vips[acc] - ( dias * 86400 ) vips[acc] = termino executeSQLQuery("UPDATE VIPS SET termino = ? WHERE login =?", termino, acc) end end end saveLog(getPlayerName(client).. " removeu "..tostring(dias).." dia(s) nos VIPS") outputChatBox("* Você removeu "..tostring(dias).." dia(s) nos VIPS", client, 0, 255, 0) verificar() triggerEvent ( "loadLog", resourceRoot, client ) else outputChatBox("*O valor: "..tostring(dias).." é inválido!", client, 255, 0, 0) end end end ) function isPlayerVip(player) if getElementData(player, "isVIPRevolution") then return true elseif getElementData(player, "isVIPOmega") then return true elseif getElementData(player, "isVIPSigma") then return true elseif getElementData(player, "isVIPEpsylon") then return true elseif getElementData(player, "isVIPAlpha") then return true end return false end function getVipTempo(player) local acc = getAccountName(getPlayerAccount(player)) if (vips[acc]) then return secondsToTimeDesc(vips[acc] - getRealTime().timestamp) end return false end function getVipValidade(player) local acc = getAccountName(getPlayerAccount(player)) if (vips[acc]) then local timestamp = getRealTime(vips[acc]) return string.format("%02d/%02d/%d", timestamp.monthday, timestamp.month +1, timestamp.year +1900, timestamp.hour, timestamp.minute) end return false end addEvent( "getAccName", true ) addEventHandler( "getAccName", resourceRoot, function(player) local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local accountName = getAccountName(account) triggerClientEvent(client, "sendAccName", resourceRoot, accountName) else outputChatBox("#00FF00[VIP] #FFFFFFEste jogador não esta logado.", client, 255, 255, 255, true) end end ) addEvent( "getVipList", true ) addEventHandler( "getVipList", resourceRoot, function(staff) staff = staff or client local vipList = executeSQLQuery("SELECT * FROM VIPS") for _, row in ipairs(vipList) do local inicio = getRealTime(row.inicio) local termino = getRealTime(row.termino) row.nick = row.nick:gsub("#%x%x%x%x%x%x", "") row.type = row.type row.staff = row.staff:gsub("#%x%x%x%x%x%x", "") row.inicio = string.format ( "%02d/%02d/%d", inicio.monthday, inicio.month +1, inicio.year +1900) row.tempo = secondsToTimeDesc(row.termino - getRealTime().timestamp) row.termino = string.format ( "%02d/%02d/%d", termino.monthday, termino.month +1, termino.year +1900) local acc = getAccount(row.login) if acc then local player = getAccountPlayer(acc) if (player) then row.status = "ONLINE" else row.status = "OFFLINE" end end end triggerClientEvent(staff, "sendVipList", resourceRoot, vipList) end ) addEvent( "loadLog", true ) addEventHandler( "loadLog", resourceRoot, function(staff) staff = staff or client local file = fileOpen("logs.txt") if (file) then local logs = fileRead (file, fileGetSize( file ) ) fileClose(file) triggerClientEvent(staff, "sendLog", resourceRoot, logs) end end ) function verificar() for acc, termino in pairs(vips) do if (acc and getAccount(acc)) then if (vips[acc]) then if (vips[acc] < getRealTime().timestamp) then local thePlayer = getAccountPlayer(getAccount(acc)) if (thePlayer) then local tipoVIP = getVIPType(acc) saveLog("O "..tipoVIP.." da conta: "..acc.." expirou") if tipoVIP == "Revolution" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFFO seu tempo de VIP expirou!", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPRevolution") elseif tipoVIP == "Omega" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFFO seu tempo de VIP expirou!", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPOmega") elseif tipoVIP == "Sigma" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFFO seu tempo de VIP expirou!", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPSigma") elseif tipoVIP == "Epsylon" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFFO seu tempo de VIP expirou!", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPEpsylon") elseif tipoVIP == "Alpha" then outputChatBox("#00FF00["..tipoVIP.."] #FFFFFFO seu tempo de VIP expirou!", thePlayer, 255, 255, 255, true) removeElementData(thePlayer, "isVIPAlpha") end end executeSQLQuery("DELETE FROM VIPS WHERE login = ?", acc) vips[acc] = nil end end end end end setTimer(verificar, 60000, 0) addEventHandler( "onPlayerChangeNick", root, function(_, newNick) local acc = getPlayerAccount(source) if (acc and not isGuestAccount(acc)) then local acc = getAccountName(acc) if (vips[acc]) then executeSQLQuery( "UPDATE VIPS SET nick = ? WHERE login = ?", newNick, acc ) end end end ) addEventHandler("onPlayerLogin", root, function(_, acc) local acc = getAccountName(acc) if (vips[acc]) then local tipoVIP = getVIPType(acc) if tipoVIP == "Revolution" then setElementData(source, "isVIPRevolution", true) elseif tipoVIP == "Omega" then setElementData(source, "isVIPOmega", true) elseif tipoVIP == "Sigma" then setElementData(source, "isVIPSigma", true) end executeSQLQuery( "UPDATE VIPS SET nick = ? WHERE login = ?", getPlayerName(source), acc ) end end ) addCommandHandler("vipadmin", function(admin) if isPlayerInACL(admin, "Console") then triggerClientEvent(admin, "openPanel", resourceRoot) end end) function removeHex(s) if type(s) == "string" then while(s:find("#%x%x%x%x%x%x")) do s = s:gsub("#%x%x%x%x%x%x","") end end return s or false end function getVIPType( accountName ) local q = executeSQLQuery( "SELECT type FROM VIPS WHERE login = ?", accountName ) if #q ~= 0 then return q[1].type else return false end end function isPlayerInACL(player, acl) if isElement(player) and getElementType(player) == "player" and aclGetGroup(acl or "") and not isGuestAccount(getPlayerAccount(player)) then local account = getPlayerAccount(player) return isObjectInACLGroup( "user.".. getAccountName(account), aclGetGroup(acl) ) end return false end function saveLog(txt) local file = false if not ( fileExists ( "logs.txt" ) ) then fileCreate ( "logs.txt" ) end file = fileOpen ("logs.txt") fileSetPos ( file, fileGetSize( file ) ) local tag = string.format ( "[%02d/%02d/%d %02d:%02d:%02d] : ", getRealTime().monthday, getRealTime().month +1, getRealTime().year +1900, getRealTime().hour, getRealTime().minute, getRealTime().second ) fileWrite(file, tag..txt.."\r\n") fileClose(file) end function secondsToTimeDesc( seconds ) if seconds then local results = {} local sec = ( seconds %60 ) local min = math.floor ( ( seconds % 3600 ) /60 ) local hou = math.floor ( ( seconds % 86400 ) /3600 ) local day = math.floor ( seconds /86400 ) if day > 0 then table.insert( results, day .. ( day == 1 and " dia" or " dias" ) ) end if hou > 0 then table.insert( results, hou .. ( hou == 1 and " hora" or " horas" ) ) end if (min > 0 and day <= 0) then table.insert( results, min .. ( min == 1 and " minuto" or " minutos" ) ) end if (sec > 0 and hou <= 0) then table.insert( results, sec .. ( sec == 1 and " segundo" or " segundos" ) ) end return string.reverse ( table.concat ( results, ", " ):reverse():gsub(" ,", " e ", 1 ) ) end return "" end local gui = { edit = {}, window = {}, tabpanel = {}, label = {}, button = {}, tab = {}, gridlist = {}, memo = {}, combobox = {} } local vips = { {"Revolution"}, {"Omega"}, {"Sigma"}, {"Epsylon"}, {"Alpha"}, } local scX, scY = guiGetScreenSize() function centerWindow(center_window) local windowW, windowH = guiGetSize(center_window, false) local x, y = (scX - windowW) /2,(scY - windowH) /2 return guiSetPosition(center_window, x, y, false) end addEventHandler("onClientResourceStart", resourceRoot, function() gui.window[1] = guiCreateWindow(515, 227, 580, 415, "GERENCIAMENTO DE VIPS", false) guiWindowSetSizable(gui.window[1], false) centerWindow(gui.window[1]) guiSetVisible(gui.window[1], false) gui.button[1] = guiCreateButton(545, 20, 25, 25, "X", false, gui.window[1]) gui.tabpanel[1] = guiCreateTabPanel(10, 45, 560, 360, false, gui.window[1]) gui.tab[1] = guiCreateTab("NOVO VIP", gui.tabpanel[1]) gui.edit[1] = guiCreateEdit(10, 10, 260, 25, "Buscar...", false, gui.tab[1]) gui.gridlist[1] = guiCreateGridList(10, 45, 260, 280, false, gui.tab[1]) guiGridListAddColumn(gui.gridlist[1], "JOGADORES ONLINE", 0.9) guiGridListSetSortingEnabled(gui.gridlist[1], false) gui.label[1] = guiCreateLabel(315, 25, 200, 15, "CONTA", false, gui.tab[1]) guiLabelSetHorizontalAlign(gui.label[1], "center", false) gui.edit[2] = guiCreateEdit(315, 50, 200, 37, "", false, gui.tab[1]) gui.label[2] = guiCreateLabel(340, 106, 146, 15, "DIAS DE VIP", false, gui.tab[1]) guiLabelSetHorizontalAlign(gui.label[2], "center", false) gui.edit[3] = guiCreateEdit(340, 131, 146, 37, "", false, gui.tab[1]) gui.combobox[1] = guiCreateComboBox(315, 190, 200, 80, "Selecione um item", false, gui.tab[1]) gui.button[2] = guiCreateButton(315, 280, 200, 37, "ADICIONAR VIP", false, gui.tab[1]) guiSetFont(gui.button[2], "default-bold-small") gui.tab[2] = guiCreateTab("LISTA DE VIPS", gui.tabpanel[1]) gui.gridlist[2] = guiCreateGridList(8, 49, 542, 232, false, gui.tab[2]) guiGridListAddColumn(gui.gridlist[2], "JOGADOR", 0.2) guiGridListAddColumn(gui.gridlist[2], "TIPO", 0.15) guiGridListAddColumn(gui.gridlist[2], "CONTA", 0.15) guiGridListAddColumn(gui.gridlist[2], "STATUS", 0.15) guiGridListAddColumn(gui.gridlist[2], "INICIO", 0.15) guiGridListAddColumn(gui.gridlist[2], "TÉRMINO", 0.15) guiGridListAddColumn(gui.gridlist[2], "TEMPO", 0.25) guiGridListAddColumn(gui.gridlist[2], "STAFF", 0.25) guiGridListSetSortingEnabled(gui.gridlist[2], false) gui.edit[4] = guiCreateEdit(382, 10, 168, 29, "Buscar...", false, gui.tab[2]) gui.edit[5] = guiCreateEdit(10, 291, 113, 35, "DIAS", false, gui.tab[2]) guiSetEnabled(gui.edit[5], false) gui.button[3] = guiCreateButton(133, 291, 175, 35, "ALTERAR TEMPO DE VIP", false, gui.tab[2]) guiSetEnabled(gui.button[3], false) gui.button[4] = guiCreateButton(427, 291, 123, 35, "REMOVER VIP", false, gui.tab[2]) guiSetEnabled(gui.button[4], false) gui.tab[3] = guiCreateTab("ADICIONAIS", gui.tabpanel[1]) gui.memo[1] = guiCreateMemo(10, 124, 540, 202, "", false, gui.tab[3]) guiMemoSetReadOnly(gui.memo[1], true) gui.label[3] = guiCreateLabel(10, 101, 540, 13, "HISTÓRICO", false, gui.tab[3]) gui.edit[6] = guiCreateEdit(10, 35, 100, 34, "", false, gui.tab[3]) gui.label[4] = guiCreateLabel(10, 10, 378, 15, "ADICIONAR/REMOVER DIAS DE VIP EM TODOS VIPS EXISTENTES", false, gui.tab[3]) gui.button[5] = guiCreateButton(120, 35, 100, 34, "ADICIONAR", false, gui.tab[3]) gui.button[6] = guiCreateButton(230, 35, 100, 34, "REMOVER", false, gui.tab[3]) gui.label[5] = guiCreateLabel(10, 73, 539, 15, "_______________________________________________________________________________", false, gui.tab[3]) guiLabelSetHorizontalAlign(gui.label[5], "center", false) end ) local ganhadorVip, typeVip, currentType local musics = {"music.mp3", "music2.mp3", "music3.mp3"} addEvent("ativarVip", true) addEventHandler("ativarVip", resourceRoot, function(typeCurrent, target, type) local sound = playSound(musics[math.random(#musics)], false) currentType, ganhadorVip, typeVip = typeCurrent, target, type if currentType == 1 then fadeInText("❤ O cidadão "..ganhadorVip.." ativou o plano VIP "..typeVip.." na cidade ❤", scX/2-400, 20, scX/2+400, 100, 255, 255, 0, 2, "default-bold", "center", "center", true, true, true, 1000, 1, "Linear") elseif currentType == 2 then fadeInText("❤ O cidadão "..ganhadorVip.." renovou o plano VIP "..typeVip.." na cidade ❤", scX/2-400, 20, scX/2+400, 100, 255, 255, 0, 2, "default-bold", "center", "center", true, true, true, 1000, 1, "Linear") end setTimer(function() if currentType == 1 then fadeOutText("❤ O cidadão "..ganhadorVip.." ativou o plano VIP "..typeVip.." na cidade ❤", scX/2-400, 20, scX/2+400, 100, 255, 255, 0, 2, "default-bold", "center", "center", true, true, true, 1000, 1, "Linear") elseif currentType == 2 then fadeOutText("❤ O cidadão "..ganhadorVip.." renovou o plano VIP "..typeVip.." na cidade ❤", scX/2-400, 20, scX/2+400, 100, 255, 255, 0, 2, "default-bold", "center", "center", true, true, true, 1000, 1, "Linear") end currentType, ganhadorVip, typeVip = nil, nil, nil if isElement(sound) then stopSound(sound) end end, 16000, 1) end ) addEvent("openPanel", true) addEventHandler("openPanel", resourceRoot, function() guiSetVisible( gui.window[1], true ) showCursor( true ) refreshPlayersList() guiComboBoxClear(gui.combobox[1]) for i, vipName in ipairs(vips) do guiComboBoxAddItem(gui.combobox[1], vipName[1]) end end ) addEvent( "sendLog", true ) addEventHandler( "sendLog", resourceRoot, function(txt) guiSetText(gui.memo[1],txt) end ) local saveVipList = false addEvent( "sendVipList", true ) addEventHandler( "sendVipList", resourceRoot, function(viplist) saveVipList = viplist guiSetEnabled(gui.edit[5], false) guiSetEnabled(gui.button[3], false) guiSetEnabled(gui.button[4], false) guiGridListClear(gui.gridlist[2]) for i,v in ipairs(viplist) do local row = guiGridListAddRow(gui.gridlist[2]) guiGridListSetItemText ( gui.gridlist[2], row, 1, v.nick, false, false ) guiGridListSetItemColor ( gui.gridlist[2], row, 1, 255, 255, 0 ) guiGridListSetItemText ( gui.gridlist[2], row, 2, v.type, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 3, v.login, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 4, v.status or "N/A", false, false ) if (v.status == "ONLINE") then guiGridListSetItemColor ( gui.gridlist[2], row, 4, 0, 255, 0 ) elseif (v.status == "OFFLINE") then guiGridListSetItemColor ( gui.gridlist[2], row, 4, 255, 0, 0 ) end guiGridListSetItemText ( gui.gridlist[2], row, 5, v.inicio, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 6, v.termino, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 7, v.tempo, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 8, v.staff, false, false ) end end ) addEvent( "sendAccName", true ) addEventHandler( "sendAccName", resourceRoot, function(accountName) guiSetText ( gui.edit[2], accountName ) end ) function refreshPlayersList() guiGridListClear(gui.gridlist[1]) for _, player in pairs(getElementsByType("player")) do local row = guiGridListAddRow(gui.gridlist[1]) guiGridListSetItemText(gui.gridlist[1], row, 1, getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), false, false) guiGridListSetItemData (gui.gridlist[1], row, 1, player) if getElementData(player, "isVIPSigma") or getElementData(player, "isVIPOmega") or getElementData(player, "isVIPRevolution") or getElementData(player, "isVIPAlpha") or getElementData(player, "isVIPRevolution") then guiGridListSetItemColor (gui.gridlist[1], row, 1, 255, 255, 0) end end end addEventHandler("onClientGUITabSwitched", resourceRoot, function(tab) if not tab then return end if (tab == gui.tab[1]) then refreshPlayersList() elseif (tab == gui.tab[2]) then triggerServerEvent ( "getVipList", resourceRoot) guiSetEnabled(gui.edit[5], false) guiSetEnabled(gui.button[3], false) guiSetEnabled(gui.button[4], false) elseif (tab == gui.tab[3]) then triggerServerEvent ( "loadLog", resourceRoot) end end ) addEventHandler("onClientGUIChanged", resourceRoot, function() if (source == gui.edit[1]) then guiGridListClear(gui.gridlist[1]) if guiGetText(source) ~= "" and guiGetText(source) ~= "Buscar..." then for _, player in ipairs(getElementsByType"player") do if string.find(string.lower(string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")), guiGetText(source)) then local row = guiGridListAddRow(gui.gridlist[1]) guiGridListSetItemText(gui.gridlist[1], row, 1, getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), false, false) guiGridListSetItemData(gui.gridlist[1], row, 1, player) if getElementData(player, "isVIPSigma") or getElementData(player, "isVIPOmega") or getElementData(player, "isVIPRevolution") or getElementData(player, "isVIPEpsylon") or getElementData(player, "isVIPAlpha") then guiGridListSetItemColor(gui.gridlist[1], row, 1, 255, 255, 0) end end end else refreshPlayersList() end end if (source == gui.edit[4]) then guiSetEnabled(gui.edit[5], false) guiSetEnabled(gui.button[3], false) guiSetEnabled(gui.button[4], false) guiGridListClear(gui.gridlist[2]) if guiGetText(source) ~= "" and guiGetText(source) ~= "Buscar..." then for i,v in ipairs(saveVipList) do local searchNick = string.find(string.lower(string.gsub(v.nick, "#%x%x%x%x%x%x", "")), guiGetText(source)) local searchAcc = string.find(string.lower(v.login), guiGetText(source)) local searchStaff = string.find(string.lower(string.gsub(v.staff, "#%x%x%x%x%x%x", "")), guiGetText(source)) if (searchNick or searchAcc or searchStaff) then local row = guiGridListAddRow(gui.gridlist[2]) guiGridListSetItemText ( gui.gridlist[2], row, 1, v.nick, false, false ) guiGridListSetItemColor ( gui.gridlist[2], row, 1, 255, 255, 0 ) guiGridListSetItemText ( gui.gridlist[2], row, 2, v.type, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 3, v.login, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 4, v.status, false, false ) if (v.status == "ONLINE") then guiGridListSetItemColor ( gui.gridlist[2], row, 4, 0, 255, 0 ) elseif (v.status == "OFFLINE") then guiGridListSetItemColor ( gui.gridlist[2], row, 4, 255, 0, 0 ) end guiGridListSetItemText ( gui.gridlist[2], row, 5, v.inicio, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 6, v.termino, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 7, v.tempo, false, false ) guiGridListSetItemText ( gui.gridlist[2], row, 8, v.staff, false, false ) end end else triggerServerEvent ( "getVipList", resourceRoot) end end if (source == gui.edit[3] or source == gui.edit[5]) then local currText = guiGetText( source ) local newText = string.gsub( currText, "[^0-9]", "" ) if newText ~= currText then guiSetText( source, newText ) end end end) addEventHandler("onClientGUIClick", resourceRoot, function(button) if button == "left" then if (source == gui.button[5]) then local days = guiGetText(gui.edit[6]) if (days and tonumber(days)) then triggerServerEvent ( "giveAll", resourceRoot, days) end end if (source == gui.button[6]) then local days = guiGetText(gui.edit[6]) if (days and tonumber(days)) then triggerServerEvent ( "removeAll", resourceRoot, days) end end if (source == gui.button[3]) then local row, column = guiGridListGetSelectedItem(gui.gridlist[2]) if (row and row ~= -1) then local accountName = guiGridListGetItemText ( gui.gridlist[2], row, 3 ) local days = guiGetText(gui.edit[5]) if (accountName and days) then triggerServerEvent ( "alterarVip", resourceRoot, accountName, days) end end end if (source == gui.button[1]) then guiSetVisible( gui.window[1], false ) showCursor( false ) end if (source == gui.edit[1]) then if (guiGetText(source) == "Buscar...") then guiSetText(source, "") end guiSetInputMode("no_binds_when_editing") else if (guiGetText(gui.edit[1]) == "") then guiSetText(gui.edit[1],"Buscar...") end end if (source == gui.edit[4]) then if (guiGetText(source) == "Buscar...") then guiSetText(source, "") end guiSetInputMode("no_binds_when_editing") else if (guiGetText(gui.edit[4]) == "") then guiSetText(gui.edit[4],"Buscar...") end end if (source == gui.edit[5]) then if (guiGetText(source) == "DIAS") then guiSetText(source, "") end else if (guiGetText(gui.edit[5]) == "") then guiSetText(gui.edit[5],"DIAS") end end if (source == gui.gridlist[1]) then local row, column = guiGridListGetSelectedItem(source) if (row and row ~= -1) then local player = guiGridListGetItemData(source, row, column) if (player) and isElement(player) then guiSetText ( gui.edit[2], "" ) triggerServerEvent ( "getAccName", resourceRoot, player ) end else guiSetText ( gui.edit[2], "" ) end end if (source == gui.gridlist[2]) then local row, column = guiGridListGetSelectedItem(source) if (row and row ~= -1) then local accountName = guiGridListGetItemText ( gui.gridlist[2], row, 3 ) if (accountName) then guiSetEnabled(gui.edit[5], true) guiSetEnabled(gui.button[3], true) guiSetEnabled(gui.button[4], true) end --triggerServerEvent ( "getAccName", resourceRoot, player ) else guiSetEnabled(gui.edit[5], false) guiSetEnabled(gui.button[3], false) guiSetEnabled(gui.button[4], false) end end if (source == gui.button[2]) then local accountName = guiGetText(gui.edit[2]) local days = guiGetText(gui.edit[3]) local tipoVIP = guiComboBoxGetSelected(gui.combobox[1]) if (accountName and days and tipoVIP) then if days ~= "" and tonumber(days) > 0 and tipoVIP ~= -1 then local type = guiComboBoxGetItemText(gui.combobox[1], tipoVIP) triggerServerEvent ( "setVip", resourceRoot, accountName, days, type) setTimer(refreshPlayersList,1000,1) end end end if (source == gui.button[4]) then local row, column = guiGridListGetSelectedItem(gui.gridlist[2]) if (row and row ~= -1) then local accountName = guiGridListGetItemText ( gui.gridlist[2], row, 3 ) guiGridListRemoveRow ( gui.gridlist[2], row ) guiSetEnabled(gui.edit[5], false) guiSetEnabled(gui.button[3], false) guiSetEnabled(gui.button[4], false) triggerServerEvent ( "removerVIP", resourceRoot, accountName) end end end end) function dxDrawBorderedText (text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak,postGUI, border, a) for oX = -border, border do for oY = -border, border do dxDrawText(text, left + oX, top + oY, right + oX, bottom + oY, tocolor(0, 0, 0, a), scale, font, alignX, alignY, clip, wordBreak,postGUI) end end dxDrawText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end function fadeInText (text, left, top, right, bottom, r, g, b, scale, font, alignX, alignY, clip, wordBreak, postGUI, theDuration, border, theType, thePeriod, theAmplitude, theOvershoot) local start = getTickCount() function renderTxIn () local now = getTickCount() local endTime = start + theDuration local elapsedTime = now - start local duration = endTime - start local progress = elapsedTime / duration local a = interpolateBetween (0, 0, 0, 255, 0, 0, progress, theType, thePeriod, theAmplitude, theOvershoot) dxDrawBorderedText (text, left, top, right, bottom, tocolor (r, g, b, a), scale, font, alignX, alignY, clip, wordBreak,postGUI, border, a) end addEventHandler ("onClientRender", getRootElement(), renderTxIn) end function fadeOutText (text, left, top, right, bottom, r, g, b, scale, font, alignX, alignY, clip, wordBreak, postGUI, theDuration, border, theType, thePeriod, theAmplitude, theOvershoot) local start = getTickCount() removeEventHandler ("onClientRender", getRootElement(), renderTxIn) function renderTxOut () local now = getTickCount() local endTime = start + theDuration local elapsedTime = now - start local duration = endTime - start local progress = elapsedTime / duration local a = interpolateBetween (255, 0, 0, 0, 0, 0, progress, theType, thePeriod, theAmplitude, theOvershoot) dxDrawBorderedText (text, left, top, right, bottom, tocolor (r, g, b, a), scale, font, alignX, alignY, clip, wordBreak,postGUI, border, a) end addEventHandler ("onClientRender", getRootElement(), renderTxOut) setTimer (function() removeEventHandler ("onClientRender", getRootElement(), renderTxOut) end, theDuration+100, 1) end
  3. I put it, but when I activate the mod the players are already redirected.
  4. Is it possible to put a command for players to be redirected?
  5. ~Sr.Victor

    Command

    I wanted to place a command to do the redirection, and not as soon as it activates. Because I have a separate event server, and I need players to return to the official with a given command. local IP = "" local Porta = addEvent( "redirecionar", true ) addEventHandler( "redirecionar", root, function (player) for index, player in ipairs ( getElementsByType ( "player" ) ) do redirectPlayer ( player, IP, Porta ) end end )
  6. I don't know how to do it, I wanted to put a time of 10 seconds to type the command again and also the command can only be given with the ACL function progressodeagle(thePlayer) if isElementWithinMarker(thePlayer, deagle2) then local currentMoney = getPlayerMoney(thePlayer) if currentMoney >= 2500 then takePlayerMoney(thePlayer, 2500) giveWeapon(thePlayer, 24, 2) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "ped", "bomber", 16000, true, false, false, false) setTimer(setPedFrozen, 16000, 1, thePlayer, false) setTimer(giveWeapon,16000, 1, thePlayer, 24, 450) else exports.hy_info:showBoxS(thePlayer, "#00FFFFVocê não possui dinheiro para fabricar esta arma!", "error") end end end addCommandHandler("fabricar", progressodeagle)
  7. It worked, thank you very much! Can you put a delay to give the command?
  8. Hello, I have a script for making weapons. However, if the person has no money, he can manufacture it anyway. I want that if the person has no money a warning appears in the chat function progressodeagle(thePlayer) if isElementWithinMarker (thePlayer, deagle2) then takePlayerMoney(thePlayer, 2500) giveWeapon(thePlayer, 24, 2) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "ped", "bomber", 16000, true, false, false, false) setTimer(setPedFrozen, 16000, 1, thePlayer, false) setTimer(giveWeapon,16000, 1, thePlayer, 24, 450) end end addCommandHandler("fabricar", progressodeagle)
  9. No debug não aparece nada, porém não abre mais. Quer pegar meu discord para um melhor contato?
  10. Olá, tentei colocar um sistema de fabricar armas por acl porém não consegui. Podem me ajudar? function abrir1 (thePlayer) if (thePlayer) and (getElementType (thePlayer) == "player") then triggerClientEvent (thePlayer, "tec9gui", thePlayer) end end addEventHandler ("onMarkerHit", tec9, abrir1) function abrir1 () if (painel) then removeEventHandler("onClientRender", root, Tec9gui) painel = false else addEventHandler("onClientRender", root, Tec9gui) painel = true end end addEvent ("tec9gui", true) addEventHandler("tec9gui", root, abrir1)
  11. Bom dia, tenho um script de quando a pessoa é punida aparece a mensagem em um canal do discord. Porém só aparece o tempo, alguém poderia me ajudar? function Prender (Jogador_Selecionado, getMotivo, getTempo) local Criminoso = getPlayerID(Jogador_Selecionado) --local Estrelas = getPlayerWantedLevel(Criminoso) local QuantidadePreso = getElementData(Criminoso, "PrisaoStaff:QuantidadePreso") or 0 local Tempo = tonumber(getTempo) local Motivo = getMotivo local jX, jY, jZ = getElementPosition (Criminoso) local pX, pY, pZ = getElementPosition (source) local IDPolicial = getElementData(source, "ID") or 0 if Tempo == 0 then --outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffDigite o tempo!", source, 255, 0, 0, true ) return end setElementData(Criminoso, "PrisaoStaff:NaViatura", nil) setElementData(Criminoso, "PrisaoStaff:Comunicação", nil) setPedAnimation(Criminoso, nil) --setElementData(Criminoso, "PrisaoStaff:Algemado", true) setElementData(Criminoso, "STAFF:TempoPrisao", Tempo) setElementData(Criminoso, "STAFF:Mtv_Prisao", Motivo) setElementData(Criminoso, "STAFF:ID2", IDPolicial) setElementPosition(Criminoso, -483.92803955078,-522.12237548828,25.517845153809) setElementInterior(Criminoso, 0) local time = getRealTime() local Horas = time.hour local Minutos = time.minute local Dia = time.monthday local Mes = time.month +1 local Ano = time.year + 1900 setElementData(Criminoso, "PrisaoStaff:MotivoPrisao", Motivo) setElementData(Criminoso, "PrisaoStaff:QuantidadePreso", QuantidadePreso+1) setElementData(Criminoso, "PrisaoStaff:HoraPrisao", Horas..":"..Minutos) setElementData(Criminoso, "PrisaoStaff:DataPrisao", Dia.."/"..Mes.."/"..Ano) --outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê puniu o jogador "..getPlayerName(Criminoso).."#ffffff por "..Tempo.." minutos pelo motivo de "..Motivo.." !", source, 255, 0, 0, true ) outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO STAFF "..getPlayerName(source).." puniu o jogador "..getPlayerName(Criminoso).."#ffffff por "..Tempo.." minutos pelo motivo de "..Motivo.." !", root, 255, 0, 0, true ) outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê foi preso !", Criminoso, 255, 0, 0, true ) triggerClientEvent(Criminoso, "PrisaoStaff:SendoPreso", Criminoso) --takeAllWeapons(Criminoso) --setPlayerWantedLevel(Criminoso, 0) --toggleAllControls (Criminoso, false ) TempoPrender[Criminoso] = setTimer(function() setElementData(Criminoso, "STAFF:TempoPrisao", nil) setElementData(Criminoso, "STAFF:Mtv_Prisao", nil) setElementData(Criminoso, "STAFF:ID2", nil) setElementData(Criminoso, "STAFF:TempoPrisao2", nil) setElementInterior(Criminoso, 0) setElementPosition(Criminoso, -490.7184753418,-548.61706542969,25.5234375) triggerClientEvent(Criminoso, "PrisaoStaff:Liberado", Criminoso) outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê foi solto !", Criminoso, 255, 0, 0, true ) --takeAllWeapons(Criminoso) --setPlayerWantedLevel(Criminoso, 0) --setPedAnimation(Criminoso, nil) --toggleAllControls (Criminoso, true ) --setElementData(Criminoso, "PrisaoStaff:Algemado", true) --setElementFrozen(Criminoso, true) end, Tempo*60000, 1) end addEvent ("PrisaoStaff:FazerPrisao", true) addEventHandler ("PrisaoStaff:FazerPrisao", root, Prender) function sendDiscordMessage ( message ) sendOptions = { queueName = " dcq " , connectionAttempts = 3 , connectTimeout = 5000 , formFields = { content = "``` " .. message .. " ```" } } fetchRemote ( discordWebhookURL, sendOptions, callback) end function callback () outputDebugString ( " Mensagem enviada! " ) end https://prnt.sc/tqk2av
  12. bindKey("tab", "both", function() if isEventHandlerAdded("onClientRender", root, scoreboardMenu) then removeEventHandler("onClientRender", root, scoreboardMenu) destroyPed() else addEventHandler("onClientRender", root, scoreboardMenu) createModelPed() end end )
  13. Olá! queria colocar delay de 3 segundos em uma dashboard que tenho, devido um bug que ela tem quando fica apertando o TAB várias vezes.
  14. Queria um script de quando morrer perder as armas, porém se deslogar ele continua com elas. Alguém pode me ajudar ?
  15. I need a scripter please, add my discord [Coord]~Sr.Victor [5]#4395
  16. What is this? triggered serverside event requestLODsClient, but event is not added serverside
  17. I need the contact of some scripter please
  18. Please help me! https://prnt.sc/sy6nx2 function Loguei () setTimer(function(source) local Tempo = getElementData(source, "TempoPrisao") or 0 if Tempo >= 1 then local Tempo2 = getElementData(source, "TempoPrisao2") or 0 local Tempo3 = Tempo2 + 3 setTimer(function (source) if Tempo3 >= 1 then setElementInterior(source, 10) setElementPosition(source, 219.30274963379,109.94602966309,999.015625) setElementData(source, "TempoPrisao", Tempo3) setElementData(source, "TempoVolta", Tempo3) triggerClientEvent(source, "TS:SendoPreso", source) takeAllWeapons(source) setPlayerWantedLevel(source, 0) end end, 3000, 1, source) TempoPrender[source] = setTimer(function (source) if Tempo3 >= 1 then setElementData(source, "TempoPrisao", nil) setElementData(source, "TempoPrisao2", nil) setElementData(source, "Mtv_Prisao", nil) setElementData(source, "ID2", nil) setElementInterior(source, 0) setElementPosition(source, 1539.87463, -1675.75757, 13.54949) triggerClientEvent(source, "TS:Liberado", source) outputChatBox ( "#0037FF✘#ffffffDelegacia#0037FF✘➺ #ffffffVocê foi solto !", source, 255, 0, 0, true ) takeAllWeapons(source) setPlayerWantedLevel(source, 0) end end, Tempo3*60000, 1, source) end end, 1000, 1, source) end addEventHandler ("onPlayerLogin", root, Loguei) Warning: setElementInterior(source, 0) setElementPosition(source, 1539.87463, -1675.75757, 13.54949) triggerClientEvent(source, "TS:Liberado", source) outputChatBox ( "#0037FF✘#ffffffDelegacia#0037FF✘➺ #ffffffVocê foi solto !", source, 255, 0, 0, true ) takeAllWeapons(source) setPlayerWantedLevel(source, 0)
  19. There is a "shared.Lua" tune = { --- Lista de objetos elements = { ["Caixa de Som #1"] = {}, ["Caixa de Som #2"] = {}, ["Caixa de Som #3"] = {}, ["Caixa de Som #4"] = {}, ["Caixa de Som #5"] = {}, }, --- Registre mods para arquivos aqui mods = { {"mods/sab.txd", "mods/sab.dff", 1924}, {"mods/taxi_4.txd", "mods/sab_2.dff", 1925}, {"mods/sab_3.txd", "mods/sab_3.dff", 1926}, {"mods/sab_4.txd", "mods/sab_4.dff", 1927}, {"mods/sab_4.txd", "mods/sab_5.dff", 1928}, } } tune.key = "5" --- bind para abrir o painel tune.move = {} ---- ID dos objetos tune.ID = { ["Caixa de Som #1"] = 1924, ["Caixa de Som #2"] = 1925, ["Caixa de Som #3"] = 1926, ["Caixa de Som #4"] = 1927, ["Caixa de Som #5"] = 1928, } function getTuneObjectID(name) return tune.ID[name] end
  20. I need help, I have a script to send weapon flooding the debug: [2020-06-11 17:07:13] WARNING: EnviarArmas\server.Lua:49: Bad argument @ 'triggerClientEvent' [Expected element at argument 1] [2020-06-11 17:07:13] WARNING: EnviarArmas\server.Lua:50: Bad argument @ 'setElementData' [Expected element at argument 1] [2020-06-11 17:07:13] WARNING: EnviarArmas\server.Lua:52: Bad argument @ 'setElementData' [Expected element at argument 1] [2020-06-11 17:07:13] WARNING: EnviarArmas\server.Lua:53: Bad argument @ 'setElementData' [Expected element at argument 1] [2020-06-11 17:07:13] WARNING: EnviarArmas\server.Lua:54: Bad argument @ 'setElementData' [Expected element at argument 1] [2020-06-11 17:07:13] WARNING: EnviarArmas\server.Lua:55: Bad argument @ 'setElementData' [Expected element at argument 1] -------------------------------- Funções Iniciais function IniciarVendaArmas (source, Arma_Selecionada, getID, getPreco, getMunicao, WeaponID) local Jogador = getPlayerID(getID) local Preco = tonumber(getPreco) local Municao = tonumber(getMunicao) local MunicaoAtual = getElementData(source, "TS:MuniAtual") or 0 if not Jogador then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffJogador não encontrado!") return end if source == Jogador then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê não pode vender arma para você mesmo!") return end --if getElementData(Jogador, "TS:Vendedor") then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador já esta em uma negociação!") return end if tonumber(MunicaoAtual) < tonumber(getMunicao) then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê não tem essa munição!") else if Preco <= 0 then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffValor tem q ser maior do que 0!") return end if Preco >= 100000 then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffValor tem q ser menor do que 100000!") return end local Posx, Posy, Poz = getElementPosition ( source ) local Posx1, Posy1, Pos1z = getElementPosition ( Jogador ) local Distancia = getDistanceBetweenPoints3D ( Posx, Posy, Poz, Posx1, Posy1, Pos1z ) if Distancia > 3 then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador está muito longe!") return end setElementData(source, "TS:Cliente", Jogador) setElementData(Jogador, "TS:Vendedor", source) setElementData(source, "TS:Preco", getPreco) setElementData(source, "TS:Muni", Municao) setElementData(source, "TS:NomeArma", Arma_Selecionada) triggerClientEvent(Jogador, "TS:ConfirmacaoWeapon", Jogador) end end addEvent ("TS:IniciarVendaArmas", true) addEventHandler ("TS:IniciarVendaArmas", root, IniciarVendaArmas) function Rejeitado () local Vendedor = getElementData(source, "TS:Vendedor") if Vendedor then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador recusou a negociação!") triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê rejeitou a negociação!") setElementData(Vendedor, "TS:Cliente", nil) setElementData(source, "TS:Vendedor", nil) setElementData(Vendedor, "TS:Preco", nil) setElementData(Vendedor, "TS:Muni", nil) setElementData(Vendedor, "TS:IDArma", nil) setElementData(Vendedor, "TS:NomeArma", nil) end end addEvent ("TS:Rejeitado", true) addEventHandler ("TS:Rejeitado", root, Rejeitado) function AceitarWeapon () local Vendedor = getElementData(source, "TS:Vendedor") if Vendedor then local Preco = tonumber(getElementData(Vendedor, "TS:Preco")) or 0 local Municoes = getElementData(Vendedor, "TS:Muni") or 5 local IDArmaTS = tonumber(getElementData(Vendedor, "TS:IDArma")) or 0 local NomeArma = getElementData(Vendedor, "TS:NomeArma") or "Error" local MunicaoAtual = getElementData(Vendedor, "TS:MuniAtual") or 0 local MunicaoTotalVendedor = MunicaoAtual - Municoes if getPlayerMoney(source) < Preco then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffDinheiro Insuficiente!") triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador não tem dinheiro suficiente!") setElementData(Vendedor, "TS:Cliente", nil) setElementData(source, "TS:Vendedor", nil) setElementData(Vendedor, "TS:Preco", nil) setElementData(Vendedor, "TS:Muni", nil) setElementData(Vendedor, "TS:IDArma", nil) setElementData(Vendedor, "TS:NomeArma", nil) return end takePlayerMoney(source, Preco) givePlayerMoney(Vendedor, Preco) takeWeapon(Vendedor, IDArmaTS, Municoes) giveWeapon(source, IDArmaTS, Municoes, true ) setElementData(Vendedor, "TS:Cliente", nil) setElementData(source, "TS:Vendedor", nil) setElementData(Vendedor, "TS:Preco", nil) setElementData(Vendedor, "TS:Muni", nil) setElementData(Vendedor, "TS:IDArma", nil) setElementData(Vendedor, "TS:NomeArma", nil) triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador aceitou a negociação !") triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê aceitou a negociação!") end end addEvent ("TS:AceitarWeapon", true) addEventHandler ("TS:AceitarWeapon", root, AceitarWeapon) --------- Não mecha function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end
  21. I have a speaker script, I wanted to make sure that when I left the server, the speaker disappeared. Because it keeps flying in the air. Server: function createTuneObject(player, object) local vehicle = getPedOccupiedVehicle(player) if vehicle then if not tune.elements[object][vehicle] then local x, y, z = getElementPosition(vehicle) local rx, ry, rz = getElementRotation (vehicle) local ID = getTuneObjectID(object) tune.elements[object][vehicle] = createObject(ID, x, y, z, rx, ry, rz) attachElements(tune.elements[object][vehicle], vehicle, 0, -0.15 , 0.1 , 0, 0, 0) else if isElement(tune.elements[object][vehicle]) then destroyElement(tune.elements[object][vehicle]) end tune.elements[object][vehicle] = false end end end addEvent("createTuneObject", true) addEventHandler("createTuneObject", root, createTuneObject) function moveTuneObject(player, object, move) local vehicle = getPedOccupiedVehicle(player) if vehicle then if tune.elements[object][vehicle] then x, y, z = getElementAttachedOffsets(tune.elements[object][vehicle]) if move == "up" then setElementAttachedOffsets (tune.elements[object][vehicle], x, y, z+0.03) elseif move == "down" then setElementAttachedOffsets (tune.elements[object][vehicle], x, y, z-0.03) elseif move == "left" then setElementAttachedOffsets (tune.elements[object][vehicle], x-0.03, y, z) elseif move == "right" then setElementAttachedOffsets (tune.elements[object][vehicle], x+0.03, y, z) elseif move == "front" then setElementAttachedOffsets (tune.elements[object][vehicle], x, y+0.03, z) elseif move == "back" then setElementAttachedOffsets (tune.elements[object][vehicle], x, y-0.03, z) end end end end addEvent("moveTuneObject", true) addEventHandler("moveTuneObject", root, moveTuneObject) addEventHandler("onElementDestroy", root, function () if getElementType(source) == "vehicle" then local attached = getAttachedElements(source) for i,v in pairs(attached) do end end end) Client: screenW, screenH = guiGetScreenSize() tune.window = guiCreateStaticImage(650, screenH*0.5-285*0.5, 300, 285, "files/main.png", false) guiSetVisible(tune.window, false) tune.grid = guiCreateGridList(5, 47, 290, 150, false, tune.window) guiGridListAddColumn(tune.grid, "Objeler", 0.9) tune.select = guiCreateStaticImage(140, 210, 140, 25, "files/but.png", false, tune.window) tune.close = guiCreateStaticImage(140, 245, 140, 25, "files/buts.png", false, tune.window) tune.front = guiCreateStaticImage(45, 210, 30, 30, "files/up.png", false, tune.window) tune.left = guiCreateStaticImage(10, 245, 30, 30, "files/l.png", false, tune.window) tune.right = guiCreateStaticImage(80, 245, 30, 30, "files/r.png", false, tune.window) tune.back = guiCreateStaticImage(45, 245, 30, 30, "files/do.png", false, tune.window) tune.up = guiCreateStaticImage(80, 210, 30, 30, "files/s.png", false, tune.window) tune.down = guiCreateStaticImage(10, 210, 30, 30, "files/s1.png", false, tune.window) addEventHandler("onClientGUIClick", root, function () local selected = guiGridListGetItemText(tune.grid, guiGridListGetSelectedItem(tune.grid), 1) if source == tune.select then if selected ~= "" then triggerServerEvent("createTuneObject", localPlayer, localPlayer, selected) end elseif source == tune.close then guiSetVisible(tune.window, false) showCursor(false) elseif source == tune.front then if selected == "" then return end triggerServerEvent("moveTuneObject", localPlayer, localPlayer, selected, "front") elseif source == tune.back then if selected == "" then return end triggerServerEvent("moveTuneObject", localPlayer, localPlayer, selected, "back") elseif source == tune.left then if selected == "" then return end triggerServerEvent("moveTuneObject", localPlayer, localPlayer, selected, "left") elseif source == tune.right then if selected == "" then return end triggerServerEvent("moveTuneObject", localPlayer, localPlayer, selected, "right") elseif source == tune.down then if selected == "" then return end triggerServerEvent("moveTuneObject", localPlayer, localPlayer, selected, "down") elseif source == tune.up then if selected == "" then return end triggerServerEvent("moveTuneObject", localPlayer, localPlayer, selected, "up") end end) tune.table = {} for i,v in pairs(tune.elements) do table.insert(tune.table, {i}) table.sort(tune.table, function(a, b) return a[1] < b[1] end ) end for i,v in pairs(tune.table) do row = guiGridListAddRow(tune.grid) guiGridListSetItemText(tune.grid, row, 1, v[1], false, false) end bindKey(tune.key, "down", function () guiSetVisible(tune.window, not guiGetVisible(tune.window)) showCursor(guiGetVisible(tune.window)) end) for i,v in pairs(tune.mods) do txd = engineLoadTXD(v[1], v[3]) engineImportTXD(txd, v[3]) dff = engineLoadDFF(v[2], v[3]) engineReplaceModel(dff, v[3]) end https://imgur.com/a/lOrUPUw
  22. function getPlayerID(player) return getElementData(player,"ID") end function getPlayerIDG(thePlayer) return getElementData(thePlayer,"ID") end function getPlayerID(player) return getElementData(player,"ID") end function getPlayerIDG(thePlayer) return getElementData(thePlayer,"ID") end
  23. I have a chat giving an error in an outputChatBox, I don't know what that is. Please help me! ERROR: [BRR]Chat\AirNew_S.Lua:42: attempt to concatenate a boolean value addEventHandler("onPlayerChat", root, function(tresc, msgtype) if (msgtype == 0) then cancelEvent() local x,y,z = getElementPosition(source) for key, gracze in ipairs(getElementsByType("player")) do local x2,y2,z2 = getElementPosition(gracze) if ( getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) < DistanciaDoChatLocal ) then local int = getElementInterior ( source ) local dim = getElementDimension ( source ) local int2 = getElementInterior ( gracze ) local dim2 = getElementDimension ( gracze ) if ( int == int2 and dim == dim2 ) then conta = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #FF7F50 ● Fundador ● #ffffff "..getPlayerName(source).. " #FFFFFF["..getPlayerID(source).."]: #EEDD82"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "SuperModerator" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #B452CD● Coordenador ● #ffffff "..getPlayerName(source).. " #FFFFFF["..getPlayerID(source).."]: #EEDD82"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Staff" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #FF8C00● Staff ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #EEDD82"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Revolution" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #40E0D0● Revolution ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Omega" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #00FFFF● Omega ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Sigma" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #48D1CC● Sigma ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Epsylon" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #ADD8E60● Epsylon ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Alpha" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #EEDD82● Alpha ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#ffffff[#FFFF00ʙʀʀ|ʟᴏᴄᴀʟ#ffffff] #00FF00● Cidadão ● #FFFFFF "..getPlayerName(source).." #FFFFFF["..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) end end end end end end)
×
×
  • Create New...