Jump to content

~Sr.Victor

Members
  • Posts

    25
  • Joined

  • Last visited

Recent Profile Visitors

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

~Sr.Victor's Achievements

Advanced Member

Advanced Member (8/54)

0

Reputation

  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.
×
×
  • Create New...