-
Posts
105 -
Joined
-
Last visited
Everything posted by Giovany Mito
-
Ajuda - Banco de dados internal.db
Giovany Mito replied to Giovany Mito's topic in Programação em Lua
Consegui fazer uma gambiarra aqui , agora esta funcionando -
Ajuda - Banco de dados internal.db
Giovany Mito replied to Giovany Mito's topic in Programação em Lua
Agora vem esse aviso, creio que não ta chegando os valores para a função, mais nao sei como fazer agora. https://prnt.sc/sz3wl4 function setPlayerhlpp(number, amount) local receiver = getPlayerFromAccountID(id) if ( getElementType ( receiver ) == "player" ) then setElementData(receiver,"levelhelper",tonumber(number)) setAccountData(receiver, "Helper", tonumber(amount)) end end -
Ajuda - Banco de dados internal.db
Giovany Mito replied to Giovany Mito's topic in Programação em Lua
Nossa você teve esse trabalho de fazer um video pra mim ver kkkkk. Então eu to olhando meu script aqui, acho que tenho que por então o setAccountData la dentro do setPlayerhlpp, pq pelo oq aparece no script ele só salva quando o player desconecta Mais o menos assim ? function setPlayerhlpp(receiver, number, amount) if ( getElementType ( receiver ) == "player" ) then setElementData(receiver,"levelhelper",tonumber(number)) setAccountData(receiver, "Helper", tonumber(amount)) end end -
Ajuda - Banco de dados internal.db
Giovany Mito replied to Giovany Mito's topic in Programação em Lua
Entendi, eu fiz aqui, mais ele só atualiza o banco de dados quando o jogador desconecta do servidor. Pois então o player só poderia usar algum comando do servidor quando ele desconectasse e conectasse novamento. function setPlayerhlpp(receiver, number) if ( getElementType ( receiver ) == "player" ) then setElementData(receiver,"levelhelper",tonumber(number)) end end addEventHandler("onPlayerLogin", root, function() local acc = getPlayerAccount(source) local helpset = (getAccountData(acc,"Helper") or 0) local helpset = getAccountData(acc, "Helper") or 0 setElementData(source, "levelhelper", tonumber(helpset)) end) addEventHandler("onPlayerQuit", root, function() local acc = getPlayerAccount(source) local helpset = getElementData(source, "levelhelper") or 0 setAccountData(acc, "Helper", tonumber(helpset)) end) addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(source) local helpset = getAccountData(acc, "Helper") if helpset then setElementData(player, "levelhelper", tonumber(helpset)) end end end) function getPlayerhelp(thePlayer) local data = getElementData(thePlayer, "levelhelper") thePoints = tonumber(data) return thePoints end function takePlayerhelp(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"levelhelper",getElementData(thePlayer, "levelhelper")-tonumber(number)) end end -
Ajuda - Banco de dados internal.db
Giovany Mito replied to Giovany Mito's topic in Programação em Lua
Entendi, Mais Ele faz isso mesmo sem o player precisar se desconectar e conectar novamente ? -
Olá, Eu uso algun script que faz setagem de cargo para o player usando key do userdata. Mais o banco de dados só salva as informação do mesmo quando ele desloga do servidor e loga de novo, ai sim ele consegue usar os comando do cargo dele. Tem alguma maneira de fazer o banco de dados recarregar os dados na hora da setagem ?
-
Agora funcionou. Então, O script é de setar um player por level, mais o script funcionava usando o nome do player para setagem, ai queria fazer setagem usando o id fixo do player em vez do nome, mais agora deu certo muito obrigado. Desculpa minha burrice é que sou novo ainda com programação
-
function chathelper(thePlayer, cmd, ...) local conta = getAccountName (getPlayerAccount(thePlayer)) --if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 4) then local dataLevel = getAccountData (getPlayerAccount (thePlayer), "Helper") local helpers = getPlayersFromAccountData ("Helper") if (dataLevel) then -- Se o jogador possui essa data na conta, então: if (dataLevel >= 4) then if (#helpers > 0) then -- Se existe algum jogador com essa accountData, então: for i, player in ipairs (helpers) do -- Para cada jogador na lista, manda isso no chat dele: local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox(" #ffffff** #02d1e8Chat Helper - Líder #ffffff➟#02d1e8 "..name..": #FFFFFF"..message, player, 255, 255, 255, true) end end elseif (dataLevel >= 3) then if (#helpers > 0) then -- Se existe algum jogador com essa accountData, então: for i, player in ipairs (helpers) do -- Para cada jogador na lista, manda isso no chat dele: local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox(" #ffffff** #02d1e8Chat Helper - Sub-Líder #ffffff➟#02d1e8 "..name..": #FFFFFF"..message, player, 255, 255, 255, true) end end elseif (dataLevel >= 2) then if (#helpers > 0) then -- Se existe algum jogador com essa accountData, então: for i, player in ipairs (helpers) do -- Para cada jogador na lista, manda isso no chat dele: local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox(" #ffffff** #02d1e8Chat Helper - Fixo #ffffff➟#02d1e8 "..name..": #FFFFFF"..message, player, 255, 255, 255, true) end end elseif (dataLevel == 1) then if (#helpers > 0) then -- Se existe algum jogador com essa accountData, então: for i, player in ipairs (helpers) do -- Para cada jogador na lista, manda isso no chat dele: local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox(" #ffffff** #02d1e8Chat Helper - Temporário #ffffff➟#02d1e8 "..name..": #FFFFFF"..message, player, 255, 255, 255, true) end end end end end addCommandHandler("h", chathelper)
-
Um problema só ainda. Quando envia uma mensagem no chat, quem não é helper consegue ler a mensagem do chat helper. Teria que no caso por para só conseguir ler quem ta setado acima de helper 1, pq todos player nasce helper 0, como consigo fazer isso ?https://prnt.sc/sw3d2g
-
Então no caso oque eu colocaria no lugar do theplayer ?
-
if isObjectInACLGroup("user."..conta, aclGetGroup("Admin"), aclGetGroup("Moderador")) then Usa esse if no começo do seu script exemplo : function exemplo(thePlayer, cmd, ...) local conta = getAccountName (getPlayerAccount(thePlayer)) if isObjectInACLGroup("user."..conta, aclGetGroup("Admin"), aclGetGroup("Moderador")) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("Mensagem Global De Admin"..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) end end addCommandHandler("exe", exemplo)
-
Ficaria assim no caso então ? function setPlayerhlpp(getAccountFromID, number) if ( getAccounts ( getAccountFromID ) == "player" ) then setElementData(getAccounts,"levelhelper",tonumber(number)) end end
-
Duvida - Permisão de usar comando
Giovany Mito replied to Giovany Mito's topic in Programação em Lua
Resolvido !!!!! -
Deu certo muito obrigado consegui adaptar ao meu script
-
Agora vem o seguinte erro, https://prnt.sc/svty8a Sera q porque como ta puxando id tem que mudar mais algo no script. function _setPlayerhlp(thePlayer, command, id, amount) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local receiver = getAccountFromID(id) --if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 4) then if not tonumber ( amount ) then outputChatBox("ERRO:/sethlp <player> <nivel>", thePlayer, 255, 100, 100, true) return end if not (receiver) then outputChatBox("ERRO : Player OFF/Não Existe", thePlayer, 255, 100, 100, true) return end if not(tonumber ( amount ) <= -1) and not( tonumber ( amount ) >= 5 ) then setPlayerhlpp (receiver, amount) outputChatBox(" Você setou nivel "..amount.." de helper para o "..id:gsub('#%x%x%x%x%x%x', '').."!", thePlayer, 100, 255, 100, true) else outputChatBox("Você não pode setar esse nivel.", thePlayer, 255, 100, 100, true) end else outputChatBox("ERRO: Você não tem permissão para usar esse comando.", thePlayer, 255, 100, 100, true) end end addCommandHandler("sethlp",_setPlayerhlp) function getAccountFromID (id) if (tonumber (id)) then for i, acc in ipairs (getAccounts()) do if (getAccountID (acc) == tonumber (id)) then return acc end end end return false end function setPlayerhlpp(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"levelhelper",tonumber(number)) end end addEventHandler("onPlayerLogin", root, function() local acc = getPlayerAccount(source) local helpset = (getAccountData(acc,"Helper") or 0) local helpset = getAccountData(acc, "Helper") or 0 setElementData(source, "levelhelper", tonumber(helpset)) end) addEventHandler("onPlayerQuit", root, function() local acc = getPlayerAccount(source) local helpset = getElementData(source, "levelhelper") or 0 setAccountData(acc, "Helper", tonumber(helpset)) end) addEventHandler("onResourceStart", resourceRoot, function() for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(source) local helpset = getAccountData(acc, "Helper") if helpset then setElementData(player, "levelhelper", tonumber(helpset)) end end end) function getPlayerhelp(thePlayer) local data = getElementData(thePlayer, "levelhelper") thePoints = tonumber(data) return thePoints end function takePlayerhelp(thePlayer, number) if ( getElementType ( thePlayer ) == "player" ) then setElementData(thePlayer,"levelhelper",getElementData(thePlayer, "levelhelper")-tonumber(number)) end end
-
Esse script esta na internet para download NESSE LINK Creio que não seja possivel você alterar o id do player, se caso nao queira o id fixo do player você pode puxa o id temporario do server
-
No caso eu quero pegar o userid do internal para fazer a sentagem em vez de usar o nome do player ou o id temporario do servidor. https://prnt.sc/svgatm
-
Tentei fazer aqui mais recebo esse erro [2020-06-07 11:20:19] WARNING: [FW]Comandos\Server.Lua:1039: Bad argument @ 'getAccountID' [Expected account at argument 1, got number '1'] function _setPlayerhlp(thePlayer, command, id, amount) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) id = tonumber(id) local receiver = getAccountID(id) --if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 4) then if not tonumber ( amount ) then outputChatBox("ERRO:/sethlp <player> <nivel>", thePlayer, 255, 100, 100, true) return end if not (receiver) then outputChatBox("ERRO : Player OFF/Não Existe", thePlayer, 255, 100, 100, true) return end if not(tonumber ( amount ) <= -1) and not( tonumber ( amount ) >= 5 ) then setPlayerhlpp (receiver, amount) outputChatBox(" Você setou nivel "..amount.." de helper para o "..id:gsub('#%x%x%x%x%x%x', '').."!", thePlayer, 100, 255, 100, true) else outputChatBox("Você não pode setar esse nivel.", thePlayer, 255, 100, 100, true) end end end addCommandHandler("sethlp",_setPlayerhlp)
-
Estou tentando criar um chat privado para uma organização do servidor. como faço para mandar essas mensagem para os membro que esta na key Helper no script abaixo fiz ele puxar o cargo do player usando o value, agora como faço para mandar apenas para quem ta no 'key' Helper function chathelper(thePlayer, cmd, ...) local conta = getAccountName (getPlayerAccount(thePlayer)) --if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 4) then local dataLevel = getAccountData (getPlayerAccount (thePlayer), "Helper") if (dataLevel) then -- Se o jogador possui essa data na conta, então: if (dataLevel >= 4) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#ffffff[ #20d608Chat Helper - Líder #ffffff]#20d608 "..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) elseif (dataLevel >= 3) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#ffffff[ #20d608Chat Helper - Sub-Líder #ffffff]#20d608 "..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) elseif (dataLevel >= 2) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#ffffff[ #20d608Chat Helper - Fixo #ffffff]#20d608 "..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) elseif (dataLevel == 1) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#ffffff[ #20d608Chat Helper - Temporário #ffffff]#20d608 "..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) end end end addCommandHandler("ch", chathelper)
-
Eu vi que no internal todos player q entra no servidor fica com um id fixo, queria saber como faço para usar o id fixo do player em vez do id temporario de quando entra no servidor. function _setPlayerhlp(thePlayer, command, who, amount) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) --if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 4) then if not tonumber ( amount ) then outputChatBox("ERRO:/sethlp <player> <nivel>", thePlayer, 255, 100, 100, true) return end local receiver = getPlayerFromName(who) if not (receiver) then outputChatBox("ERRO : Player OFF/Não Existe", thePlayer, 255, 100, 100, true) return end if not(tonumber ( amount ) <= -1) and not( tonumber ( amount ) >= 5 ) then setPlayerhlpp (receiver, amount) outputChatBox(" Você setou nivel "..amount.." de helper para o "..who:gsub('#%x%x%x%x%x%x', '').."!", thePlayer, 100, 255, 100, true) else outputChatBox("Você não pode setar esse nivel.", thePlayer, 255, 100, 100, true) end end end addCommandHandler("sethlp",_setPlayerhlp) Nesse caso esse script seta apenas usando o nome completo do player, como faço para setar usando o id fixo do player
-
Olá, Meu script usa getAccountData para ver se o player tem permissão para usar o comando. como faço para integrar isObjectInACLGroup no script tbm ? quero que o script consulte o getAccountData e isObjectInACLGroup function globalhlp(thePlayer, cmd, ...) local conta = getAccountName (getPlayerAccount(thePlayer)) --if isObjectInACLGroup("user."..conta, aclGetGroup("Admin")) then if (getAccountData (getPlayerAccount (thePlayer), "Helper") == 4) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#ffffff[ #20d608GLOBAL HELPER #ffffff]#20d608 "..name..": #FFFFFF"..message, getRootElement(), 255, 255, 255, true) end end addCommandHandler("globalh", globalhlp)
-
vou da uma olhada la
-
O Veiculo esta salvando la na conta, mais fica 'true' mesmo se desativar e sair do sv ele continua 'true'
-
No caso a função ai ja nao esta salvando naconta ?
-
function veiculo1off (_,state, parameter) if painel == true then if ( state == "down" ) then if ( isCursorOnElement(283, 200, 43, 24)) then outputChatBox ("Saveiro G4 [OFF].") startVehMod () end end end end addEventHandler ("onClientClick", root, veiculo1off) function veiculo1on (_,state, parameter) if painel == true then if ( state == "down" ) then --283, 230, 43, 24 if ( isCursorOnElement(373, 200, 417, 225)) then outputChatBox ("Saveiro G4 [ON].") startVehMod (parameter) end end end end addEventHandler ("onClientClick", root, veiculo1on) Script client /\ Olá, Estou fazendo um script de desativar textura de veiculos skin etc... Mais estou com duvidas em como vou fazer para salvar na conta no player. Como deveria ser feito, peguei uma base do DNL de salvamento mais não conseguir fazer funcionar function saveCarMod (status) local acc = getPlayerAccount (client) if (not isGuestAccount (acc)) then setAccountData (acc, "vehMod.496", status) end end addEvent ("saveVehMod.496", true) addEventHandler ("saveVehMod.496", root, saveCarMod)