-
Posts
100 -
Joined
-
Last visited
Everything posted by BonSay~^
-
Coloque assim function dx() dxDrawText("F1 - Painel De Jogador", 448, 313, 573, 329, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F2 - Shop De Habilidades", 448, 335, 573, 351, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F3 - Chat Privado", 448, 356, 573, 372, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F4 - Painel De Animacao", 448, 378, 573, 394, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F5 - Controles De Veiculo", 448, 399, 573, 415, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F7 - Painel De Drogas", 448, 421, 573, 437, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F8 - Console", 448, 442, 573, 458, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F9 - Painel De Ajuda", 448, 463, 573, 479, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F10 - Transferidor De Dinheiro ", 448, 485, 573, 501, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F11 - Mapa", 448, 507, 573, 523, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F11 - Mapa", 448, 507, 573, 523, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F12 - Print", 448, 529, 573, 545, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Para Ver Teles:/teles", 448, 551, 573, 567, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end painel = false function Comandos(_,state) if painel == true then if state == "down" then if isCursorOnElement(x*853, y*390, x*167, y*30) then if painel then removeEventHandler("onClientRender", root, dx) painel = false else addEventHandler("onClientRender", root, dx) painel = true end end end end end addEventHandler("onClientClick", root, Comandos)
-
Eae galera eu queria saber como fazer uma Velocidade 3x para um painel em dx mas eu queria que quando ativasse ela ativasse so pro personagem do player e nao todo mundo fica rapido eo jogo tambem queria so o personagem rapidao mas o jogo continuava em velocidade normal eos outros players tambem como faço isso ja vi isso em um servidor
-
Vai na pasta resources vai em [ gamemodes ] vai em play abre novamente a pasta play que esta em .zip e abre broph.lua procura setElementModel vai esta setElementModel(player,math.random(316) ) no lugar de math.random(316) voce coloca o numero da skin que voce quer que o personagem de respawn e pronto
-
Como faço pra quando eu digitar /eventodesativar todos os players que estarem em uma dimensao X morrerem ?
-
Axo que o problema de nao descrescer e por que na parte do codigo que expira o vip so pra decrescer as horas e nao os minutos dias segundos e por isso que nao quer contar testei tirar 3600000 que e 1 dia e colocar 1000 que e 1 segundo e começou a tirar 1 hora de vip a cada 1 segundo so nao sei como colocar pra descrescer os segundos dias minutos
-
E como posso usar o timestamp
-
Nao qualquer tempo de vip que eu colocar na minha conta nao decresce o tempo e nao quer expirar o tempo de vip depois que passa o tempo que eu coloquei nao expira ele fica pra sempre Talvez o codigo inteiro lhe ajude a axar o erro ------------------------------------------------------------------------------------ -- RIGHTS: All rights reserved by developers -- PURPOSE: Donate stuff server -- DEVELOPERS: Sebbe (Smart) ------------------------------------------------------------------------------------ local donate = {} local allTimeDonate = {} local con = dbConnect("sqlite", "db/donate.db") dbExec(con, "CREATE TABLE IF NOT EXISTS donators (account TEXT, time TEXT)") function loadUsers(query) local data = dbPoll(query, 0) if (data) then for ind, d in ipairs(data) do allTimeDonate[d.account] = d.time if (d.account and getAccount(d.account) and getAccountPlayer(getAccount(d.account))) then donate[d.account] = tonumber(d.time) end end end end dbQuery(loadUsers, con, "SELECT * FROM donators") function isPlayerDonator(player) local account = getAccountName(getPlayerAccount(player)) return donate[account] end function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if account then local account = aclGroupAddObject (aclGetGroup("VIP"), "user."..account) end if (account and hours) then if (not getAccount(account)) then outputChatBox("#000000[#FFD700 V.I.P#000000 ] #FFFFFFNao existe nenhuma conta chamada #FF4500"..account.." #000000.", player, 255, 255, 255, true) return end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " Adicionou "..hours.." Horas V.I.P na conta "..account) outputChatBox("#000000[#FFD700 V.I.P#000000 ]#FFFFFF Adicionado "..hours.." Horas #FFD700 V.I.P#FFFFFF na conta "..account, player, 255, 255, 255, true) if (plr) then outputChatBox("#000000[#FFD700 V.I.P#000000 ]#FFFFFF Foi adicionado "..hours.." Horas #FFD700 V.I.P em sua #FF0000CONTA", plr, 255, 255, 255, true) end end end end addCommandHandler("addvip", addDonatorToDB) function removeOfflineVIP(player, cmd, account) if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end if account then aclGroupRemoveObject (aclGetGroup("VIP"), "user."..account) end if (account) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (donate[account]) then donate[account] = nil end if (allTimeDonate[account]) then allTimeDonate[account] = nil end dbExec(con, "DELETE FROM donators WHERE account=?", tostring(account)) outputDebugString(getPlayerName(player).. " removed account "..account.." from database") end end addCommandHandler("removevip", removeOfflineVIP) function makeDonateTick() for ind, d in pairs(donate) do if (ind and getAccount(ind)) then if (getAccountPlayer(getAccount(ind))) then if (donate[ind] and donate[ind] < 1 and donate[ind] ~= 0) then aclGroupRemoveObject (aclGetGroup("VIP"), "user."..ind) donate[ind] = nil allTimeDonate[ind] = nil dbExec(con, "DELETE FROM donators WHERE account=?", tostring(ind)) outputDebugString("Remove account "..ind.." from database because time ran out", root, 255, 255, 0) elseif (donate[ind] and donate[ind] > 1 and donate[ind] ~= 0) then donate[ind] = donate[ind] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[ind]), tostring(ind)) outputDebugString("Account "..ind.." VIP Time set to "..donate[ind].." Hours") elseif (donate[ind]) then outputDebugString("Account "..ind.." has infinite VIP hours") end end end end end setTimer(makeDonateTick, 3600000 , 0) function getVipsTable(player) --if (exports.CEDadmin:doesPlayerHaveAccess(player, "viewVipGUI")) then if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end triggerClientEvent(player, "donate.showDonateMembers", player, allTimeDonate) end addCommandHandler("showvip", getVipsTable) function donaterLoggedIn() dbQuery(loadUsers, con, "SELECT * FROM donators") end addEventHandler("onPlayerLogin", root, donaterLoggedIn) function getMyVIP( player ) if isPlayerDonator(player) then if (tonumber(isPlayerDonator(player)) == 0) then -- VIP sem tempo pra acabar return outputChatBox("O seu vip tem duração eterna.", player, 255, 255, 255, true) end local vipSecs = isPlayerDonator(player) * 3600 local sec = math.floor( vipSecs %60 ) local minutes = math.floor( (vipSecs % 3600) /60 ) local hours = math.floor( (vipSecs / 3600) % 24 ) local days = math.floor( vipSecs / 86400 ) outputChatBox("Voce tem "..tostring(days).." dias, "..tostring(hours).." horas, "..tostring(minutes).." minutos, "..tostring(sec).." segundos de vip", player, 255, 255, 255, true) end end addCommandHandler("viptime", getMyVIP) function setCorrectVIPData() for ind, plr in pairs(getElementsByType("player")) do setElementData(plr, "vipTime", donate[getAccountName(getPlayerAccount(plr))]) end end setTimer(setCorrectVIPData, 1000, 0)
-
Esta funfando normal e so colocar por exemplo 224.45 que vai os segundos e minutos mas nao esta decrescendo
-
como posso colocar uma cor HEX nesse letreiro ? Código removido
-
Aqui esta sem erros eu testei e funcionou normalmente addCommandHandler( "revistar", function ( thePlayer ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "pm" ) ) then -- se quiser trocar esse grupo de pm para outro e so editar ele else outputChatBox("Você não tem permissão pra usar este comando!", thePlayer, 255, 255, 255, true) end end )
-
Ta nao teve bug mas nao ta decrescendo o tempo so o dia fica 0 os minutos fica 0 eos segundos fica 0 o unico que fica eas horas
-
Stanley a funçao pode ser mudada isso foi um exemplo
-
Olha sinceramente usando uma permissao da acl e bem mas facil aqui esta o codigo pronto !! function revistar ( player, cmd ) if hasObjectPermissionTo ( player, "function.banPlayer" ) then -- para poder usar o comando tem que ter essa permissao na acl else outputChatBox(" Acesso negado apenas policias podem usar este comando !! ",player,255,0,0) end end addCommandHandler ( "revistar", revistar )
-
function getMyVIP(seconds) if seconds then local sec = ( seconds %60 ) local minutes = math.floor ( ( seconds % 3600 ) /60 ) local hours = math.floor ( ( seconds % 86400 ) /3600 ) local days = math.floor ( seconds /86400 ) end if (tonumber(hours) == 0) then hours = "infinite" minutes = "nil" end outputChatBox("Voce tem '..days..' dias, '..hours..' horas , '..minutes..' minutos , '..sec..' segundos de vip", seconds, 255, 255, 255, true) end addCommandHandler("viptime", getMyVIP) consegui nao
-
Hmmm mas uma coisa como faço no lugar de horas colocar dias horas minutos e segundos ? ------------------------------------------------------------------------------------ -- RIGHTS: All rights reserved by developers -- PURPOSE: Donate stuff server -- DEVELOPERS: Sebbe (Smart) ------------------------------------------------------------------------------------ local donate = {} local allTimeDonate = {} local con = dbConnect("sqlite", "db/donate.db") dbExec(con, "CREATE TABLE IF NOT EXISTS donators (account TEXT, time TEXT)") function loadUsers(query) local data = dbPoll(query, 0) if (data) then for ind, d in ipairs(data) do allTimeDonate[d.account] = d.time if (d.account and getAccount(d.account) and getAccountPlayer(getAccount(d.account))) then donate[d.account] = tonumber(d.time) end end end end dbQuery(loadUsers, con, "SELECT * FROM donators") function isPlayerDonator(player) local account = getAccountName(getPlayerAccount(player)) return donate[account] end function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if account then local account = aclGroupAddObject (aclGetGroup("VIP"), "user."..account) end if (account and hours) then if (not getAccount(account)) then outputChatBox("#000000[#FFD700 V.I.P#000000 ] #FFFFFFNao existe nenhuma conta chamada #FF4500"..account.." #000000.", player, 255, 255, 255, true) return end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " Adicionou "..hours.." Horas V.I.P na conta "..account) outputChatBox("#000000[#FFD700 V.I.P#000000 ]#FFFFFF Adicionado "..hours.." Horas #FFD700 V.I.P#FFFFFF na conta "..account, player, 255, 255, 255, true) if (plr) then outputChatBox("#000000[#FFD700 V.I.P#000000 ]#FFFFFF Foi adicionado "..hours.." Horas #FFD700 V.I.P em sua #FF0000CONTA", plr, 255, 255, 255, true) end end end end addCommandHandler("addvip", addDonatorToDB) function removeOfflineVIP(player, cmd, account) if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end if account then aclGroupRemoveObject (aclGetGroup("VIP"), "user."..account) end if (account) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (donate[account]) then donate[account] = nil end if (allTimeDonate[account]) then allTimeDonate[account] = nil end dbExec(con, "DELETE FROM donators WHERE account=?", tostring(account)) outputDebugString(getPlayerName(player).. " removed account "..account.." from database") end end addCommandHandler("removevip", removeOfflineVIP) function makeDonateTick() for ind, d in pairs(donate) do if (ind and getAccount(ind)) then if (getAccountPlayer(getAccount(ind))) then if (donate[ind] and donate[ind] < 1 and donate[ind] ~= 0) then aclGroupRemoveObject (aclGetGroup("VIP"), "user."..ind) donate[ind] = nil allTimeDonate[ind] = nil dbExec(con, "DELETE FROM donators WHERE account=?", tostring(ind)) outputDebugString("Remove account "..ind.." from database because time ran out", root, 255, 255, 0) elseif (donate[ind] and donate[ind] > 1 and donate[ind] ~= 0) then donate[ind] = donate[ind] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[ind]), tostring(ind)) outputDebugString("Account "..ind.." VIP Time set to "..donate[ind].." Hours") elseif (donate[ind]) then outputDebugString("Account "..ind.." has infinite VIP hours") end end end end end setTimer(makeDonateTick, 3600000 , 0) function getVipsTable(player) --if (exports.CEDadmin:doesPlayerHaveAccess(player, "viewVipGUI")) then if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end triggerClientEvent(player, "donate.showDonateMembers", player, allTimeDonate) end addCommandHandler("showvip", getVipsTable) function donaterLoggedIn() dbQuery(loadUsers, con, "SELECT * FROM donators") end addEventHandler("onPlayerLogin", root, donaterLoggedIn) function getMyVIP(plr) if (not isPlayerDonator(plr)) then return end local hours = isPlayerDonator(plr) local minutes = math.floor(hours / 60) if (tonumber(hours) == 0) then hours = "infinite" minutes = "nil" end outputChatBox("#000000[#FFD700 V.I.P#000000 ]#FFFFFF Voce tem #FF0000"..hours.." #FFFFFFHoras e #FF0000"..minutes.."#FFFFFF Minutos de #FFD700 V.I.P#FFFFFF em sua conta", plr, 255, 255, 255, true) end addCommandHandler("viptime", getMyVIP) function setCorrectVIPData() for ind, plr in pairs(getElementsByType("player")) do setElementData(plr, "vipTime", donate[getAccountName(getPlayerAccount(plr))]) end end setTimer(setCorrectVIPData, 1000, 0)
-
Eae pessoal beleza ? hoje eu vim aqui com um tutorial simples de como colocar cor no chatbox ou tirar , bom o outputChatBox e uma funçao de um script que ao digitar um comando ou acontecer alguma coisa aparece no chat oque voce quer por exemplo eu crio um script que ao eu digitar /chat aparece no chat o player digitou /chat , bom eu tenho quase certeza que voces ja baixaram ou ja viram algum script que tem outputChatBox que ao colocar ao colocar uma cor em codigo HAX( cores que começam em #xxxx ) nao pega a cor e aparece o codigo nao a cor que voce queria para resolver isso e simples quase todos os outputChatBox sao assim outputChatBox ( " Mensagem que ira aparecer no chat " , root , 255, 255, 255 ) E ao tentar colocar uma cor HAX nao ficar a cor que voce quer e por que acontece isso ? Por que no final do outputChatBox tem esses tres 255 que e uma cor em RGB esses tres 255 sao a cor branca em RGB Ta e como coloco a cor em codigo HAX ? E super simples e so voce colocar depois desses tres 255 true , entao a funçao ficara dessa maneira outputChatBox ( " Mensagem que ira aparecer no chat " , root , 255, 255, 255, true) Pronto agora voce pode por mas de uma cor em sua mensagem com os codigos HAX Aqui um site com codigos em cores HAX http://www.flextool.com.br/tabela_cores.html Espero ter ajudado algumas pessoas
-
No arquivo fr_client.lua, substitua a funçao toggleFRWindow por esta local forbiddenDimensions = {1,2,3} -- dimensões proibidas function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else for k, v in ipairs(forbiddenDimensions) do if v == getElementDimension(localPlayer) then return end end showCursor(true) showAllWindows() end end Feito por Banex so colei oque ele tinha feito em outro post
-
No arquivo fr_client.lua, substitua a funçao toggleFRWindow por esta local forbiddenDimensions = {1,2,3} -- dimensões proibidas function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else for k, v in ipairs(forbiddenDimensions) do if v == getElementDimension(localPlayer) then return end end showCursor(true) showAllWindows() end end
-
Ta eu consegui que adicione e remova o vip com o comando mas nao sei se o tempo de vip quando acabar vai sair da acl sozinho e eu queria colocar o tempo de vip em um painel vip que eu to fazendo pode me ajudar aqui esta o codigo editado ------------------------------------------------------------------------------------ -- RIGHTS: All rights reserved by developers -- PURPOSE: Donate stuff server -- DEVELOPERS: Sebbe (Smart) ------------------------------------------------------------------------------------ local donate = {} local allTimeDonate = {} local con = dbConnect("sqlite", "db/donate.db") dbExec(con, "CREATE TABLE IF NOT EXISTS donators (account TEXT, time TEXT)") function loadUsers(query) local data = dbPoll(query, 0) if (data) then for ind, d in ipairs(data) do allTimeDonate[d.account] = d.time if (d.account and getAccount(d.account) and getAccountPlayer(getAccount(d.account))) then donate[d.account] = tonumber(d.time) end end end end dbQuery(loadUsers, con, "SELECT * FROM donators") function isPlayerDonator(player) local account = getAccountName(getPlayerAccount(player)) return donate[account] end function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if account then local account = aclGroupAddObject (aclGetGroup("VIP"), "user."..account) end if (account and hours) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " added "..hours.." VIP hours to "..account) outputChatBox("Added "..hours.." VIP hours to "..account, player, 255, 150, 0) if (plr) then outputChatBox(getPlayerName(player).." added "..hours.." VIP hours to your account ("..account..")", plr, 0, 2500, 0) end end end end addCommandHandler("addvip", addDonatorToDB) function removeOfflineVIP(player, cmd, account) if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end if account then aclGroupRemoveObject (aclGetGroup("VIP"), "user."..account) end if (account) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (donate[account]) then donate[account] = nil end if (allTimeDonate[account]) then allTimeDonate[account] = nil end dbExec(con, "DELETE FROM donators WHERE account=?", tostring(account)) outputDebugString(getPlayerName(player).. " removed account "..account.." from database") end end addCommandHandler("removevip", removeOfflineVIP) function makeDonateTick() for ind, d in pairs(donate) do if (ind and getAccount(ind)) then if (getAccountPlayer(getAccount(ind))) then if (donate[ind] and donate[ind] < 1 and donate[ind] ~= 0) then donate[ind] = nil allTimeDonate[ind] = nil dbExec(con, "DELETE FROM donators WHERE account=?", tostring(ind)) outputDebugString("Remove account "..ind.." from database because time ran out", root, 255, 255, 0) elseif (donate[ind] and donate[ind] > 1 and donate[ind] ~= 0) then donate[ind] = donate[ind] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[ind]), tostring(ind)) outputDebugString("Account "..ind.." VIP Time set to "..donate[ind].." Hours") elseif (donate[ind]) then outputDebugString("Account "..ind.." has infinite VIP hours") end end end end end setTimer(makeDonateTick, 3600000 , 0) function getVipsTable(player) --if (exports.CEDadmin:doesPlayerHaveAccess(player, "viewVipGUI")) then if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end triggerClientEvent(player, "donate.showDonateMembers", player, allTimeDonate) end addCommandHandler("showvip", getVipsTable) function donaterLoggedIn() dbQuery(loadUsers, con, "SELECT * FROM donators") end addEventHandler("onPlayerLogin", root, donaterLoggedIn) function getMyVIP(plr) if (not isPlayerDonator(plr)) then return end local hours = isPlayerDonator(plr) local minutes = math.floor(hours / 60) if (tonumber(hours) == 0) then hours = "infinite" minutes = "nil" end outputChatBox("You have "..hours.." VIP Hours ("..minutes.." minutes) remaining on this account ("..getAccountName(getPlayerAccount(plr))..")", plr, 0, 2500, 0) end addCommandHandler("viptime", getMyVIP) function setCorrectVIPData() for ind, plr in pairs(getElementsByType("player")) do setElementData(plr, "vipTime", donate[getAccountName(getPlayerAccount(plr))]) end end setTimer(setCorrectVIPData, 1000, 0)
-
Por que nao esta pegando function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if (account and hours) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if accountName then aclGroupAddObject (aclGetGroup("VIP"), "user."..accountName) end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " added "..hours.." VIP hours to "..account) outputChatBox("Added "..hours.." VIP hours to "..account, player, 255, 150, 0) if (plr) then outputChatBox(getPlayerName(player).." added "..hours.." VIP hours to your account ("..account..")", plr, 0, 2500, 0) end end end end addCommandHandler("addvip", addDonatorToDB)
-
Mano eu nao to entendendo nada desse codecademy e esquesito queria aprender lua nao python mesmo la tendo variaveis essas coisas mano nao tendi nada
-
Pessoal alguem pode me falar se esses dois codigos que eu axei na net de dar donator para servers race por comando e com tempo pode ser editado para quando digitar o comando de dar donator ir pra acl vip e colocar no painel vip o tempo que o jogador tem de vip Client Side ------------------------------------------------------------------------------------ -- RIGHTS: All rights reserved by developers -- PURPOSE: Donate part client -- DEVELOPERS: Sebbe (Smart) ------------------------------------------------------------------------------------ local sx, sy = guiGetScreenSize() function makeGUI() vipGUI = guiCreateWindow((sx / 2) - (694 / 2), (sy / 2) - (526 / 2), 694, 526, "VIPs", false) guiWindowSetSizable(vipGUI , false) guiSetAlpha(vipGUI , 1.00) guiSetVisible(vipGUI, false) nameEdit = guiCreateEdit(9, 22, 152, 30, "", false, vipGUI) list = guiCreateGridList(9, 61, 670, 408, false, vipGUI) guiSetEnabled(nameEdit, false) guiGridListAddColumn(list, "Account", 0.7) guiGridListAddColumn(list, "Time", 0.1) closeBttn = guiCreateButton(11, 483, 668, 33, "Close This Window", false, vipGUI) addEventHandler("onClientGUIClick", closeBttn, function() guiSetVisible(vipGUI, false) showCursor(false) end, false) end addEventHandler("onClientResourceStart", resourceRoot, makeGUI) function showDonateMembers(d) guiSetVisible(vipGUI, true) showCursor(true) guiGridListClear(list) local online = 0 local online = 0 for ind, data in pairs(d) do online = online + 1 local row = guiGridListAddRow(list) local nTime = data - 1 if (nTime > 1) then data = nTime end guiGridListSetItemText(list, row, 1, tostring(ind), false, false) guiGridListSetItemText(list, row, 2, tostring(data), false, false) end guiSetText(nameEdit, "VIP Online: "..online) end addEvent("donate.showDonateMembers", true) addEventHandler("donate.showDonateMembers", root, showDonateMembers) ServerSide ------------------------------------------------------------------------------------ -- RIGHTS: All rights reserved by developers -- PURPOSE: Donate stuff server -- DEVELOPERS: Sebbe (Smart) ------------------------------------------------------------------------------------ local donate = {} local allTimeDonate = {} local con = dbConnect("sqlite", "db/donate.db") dbExec(con, "CREATE TABLE IF NOT EXISTS donators (account TEXT, time TEXT)") function loadUsers(query) local data = dbPoll(query, 0) if (data) then for ind, d in ipairs(data) do allTimeDonate[d.account] = d.time if (d.account and getAccount(d.account) and getAccountPlayer(getAccount(d.account))) then donate[d.account] = tonumber(d.time) end end end end dbQuery(loadUsers, con, "SELECT * FROM donators") function isPlayerDonator(player) local account = getAccountName(getPlayerAccount(player)) return donate[account] end function addDonatorToDB(player, cmd, account, hours) if (not (hasObjectPermissionTo(player, "function.banPlayer", false))) then return end if (account and hours) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (not tonumber(hours) or tonumber(hours) < 0) then outputChatBox(tostring(hours).." is an invalid hour specific", player, 2500, 0, 0) return end local plr = getAccountPlayer(getAccount(account)) if (not allTimeDonate[getAccount(account)]) then dbExec(con, "INSERT INTO donators (account, time) VALUES (?, ?)", tostring(account), tostring(hours)) donate[account] = tonumber(hours) if (tonumber(hours) == 0) then hours = "infinite" end outputDebugString(getPlayerName(player).. " added "..hours.." VIP hours to "..account) outputChatBox("Added "..hours.." VIP hours to "..account, player, 255, 150, 0) if (plr) then outputChatBox(getPlayerName(player).." added "..hours.." VIP hours to your account ("..account..")", plr, 0, 2500, 0) end end end end addCommandHandler("addvip", addDonatorToDB) function removeOfflineVIP(player, cmd, account) if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end if (account) then if (not getAccount(account)) then outputChatBox("No account with "..account.." as username", player, 2500, 0, 0) return end if (donate[account]) then donate[account] = nil end if (allTimeDonate[account]) then allTimeDonate[account] = nil end dbExec(con, "DELETE FROM donators WHERE account=?", tostring(account)) outputDebugString(getPlayerName(player).. " removed account "..account.." from database") end end addCommandHandler("removevip", removeOfflineVIP) function makeDonateTick() for ind, d in pairs(donate) do if (ind and getAccount(ind)) then if (getAccountPlayer(getAccount(ind))) then if (donate[ind] and donate[ind] < 1 and donate[ind] ~= 0) then donate[ind] = nil allTimeDonate[ind] = nil dbExec(con, "DELETE FROM donators WHERE account=?", tostring(ind)) outputDebugString("Remove account "..ind.." from database because time ran out", root, 255, 255, 0) elseif (donate[ind] and donate[ind] > 1 and donate[ind] ~= 0) then donate[ind] = donate[ind] - 1 dbExec(con, "UPDATE donators SET time=? WHERE account=?", tostring(donate[ind]), tostring(ind)) outputDebugString("Account "..ind.." VIP Time set to "..donate[ind].." Hours") elseif (donate[ind]) then outputDebugString("Account "..ind.." has infinite VIP hours") end end end end end setTimer(makeDonateTick, 3600000 , 0) function getVipsTable(player) --if (exports.CEDadmin:doesPlayerHaveAccess(player, "viewVipGUI")) then if (not (hasObjectPermissionTo(player, "function.kickPlayer", false))) then return end triggerClientEvent(player, "donate.showDonateMembers", player, allTimeDonate) end addCommandHandler("showvip", getVipsTable) function donaterLoggedIn() dbQuery(loadUsers, con, "SELECT * FROM donators") end addEventHandler("onPlayerLogin", root, donaterLoggedIn) function getMyVIP(plr) if (not isPlayerDonator(plr)) then return end local hours = isPlayerDonator(plr) local minutes = math.floor(hours / 60) if (tonumber(hours) == 0) then hours = "infinite" minutes = "nil" end outputChatBox("You have "..hours.." VIP Hours ("..minutes.." minutes) remaining on this account ("..getAccountName(getPlayerAccount(plr))..")", plr, 0, 2500, 0) end addCommandHandler("viptime", getMyVIP) function setCorrectVIPData() for ind, plr in pairs(getElementsByType("player")) do setElementData(plr, "vipTime", donate[getAccountName(getPlayerAccount(plr))]) end end setTimer(setCorrectVIPData, 1000, 0)
-
Cara fui nesse codecademy esta em ingles traduzi a pagina mas tipo nao me esta ajudando e esquisito
