RenanPG
Members-
Posts
186 -
Joined
Everything posted by RenanPG
-
Acabei de testar e funciona, seta 23:59 no painel admin para ver.
-
Não sei se existe uma função para pegar dia de semana, mas da pra fazer uma gambiarra tipo essa pra atualizar o dia conforme o horário do getTime: local dias = { [0] = "Domingo"; [1] = "Segunda"; [2] = "Terça"; [3] = "Quarta"; [4] = "Quinta"; [5] = "Sexta"; [6] = "Sábado" } local dia = 0 setTimer(function() local h, m = getTime() if(h == 0 and m == 0) then if(dia == 6) then dia = 0 else dia = dia + 1 end end end, 1000, 0) addEventHandler( "onClientRender", root, function () dxDrawText( dias[dia], 1045, 606, 1105, 624, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) end )
-
@John Smith As arezu said, when you have something invalid in the code it would break the execution of the main script, and it would stop in the part the error occurs.
-
I would recommend using pcall to ignore code errors. function onResourceStart() local file = fileOpen("editable.lua") if(file) then pcall(loadstring( fileRead(file, fileGetSize(file)) ) ) fileClose(file) end end addEventHandler("onResourceStart", root, onResourceStart)
-
Can I get all created GUI elements in my server?
RenanPG replied to Stanley Sathler's topic in Scripting
As far as i know you can loop through the predefined variable guiRoot, but you'll need a recursion to get all elements, because exists children of children GUIs. guiRoot > Window > Button (an example of a gui tree) -
Como passar argumentos para o callback do eventHandler?
RenanPG replied to Stanley Sathler's topic in Programação em Lua
@StanleySathler Eh só fazer um override da função original, tipo assim: local _addEventHandler = addEventHandler -- variavel com a função nativa function addEventHandler(...) -- função editada -- aqui faz a lógica que vc quiser return _addEventHandler(...) end -
Is there a way to protect html files ? for example encrypting or avoid client cache ?
-
Tente usar esta função abaixo ao invés do getPlayerName(). https://wiki.multitheftauto.com/wiki/Ge ... artialName
-
function playerTest (p) return p:test() end
-
[ RESOLVIDO ] Como Bloquear Todos os mods em uma area verde
RenanPG replied to MrDante's topic in Programação em Lua
O que seria exatamente esses mods? -
Ajuda com um servidor linux
RenanPG replied to Ryuzaki's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
Achei isso no google, ai tem algumas coisas que poderá ajudar vocês -
The main problem is not your "coding style", at least you should pass the arguments correctly.
-
Coloque isso na linha 8. outputChatBox("O " .. getPlayerName(source) .. "#00ff00 Está Revistando o Jogador" .. getPlayerName(thePlayer))
-
OVH não suporta cores em java, porisso da lag.
-
Você também pode usar o setElementHealth(theElement, 0) como uma alternativa ao killPed no lado cliente, fica mais simples do que enviar ao servidor. source geralmente é o elemento que sofreu o evento dentro do addEventHandler(). getLocalPlayer() retorna o player do client.
-
Não corrige mano, xeon não aprende.
-
o que ta errado filho? Head deveria ser o id. if (attacter and weapon == 69 and bodypart == Head) then
-
@XeoN- Seu código ainda tem erros, não acho que seja necessário chamar o roots para isso.
-
killPed é server side apenas. -- for _, v in ipairs ( { "pro", "std", "poor" } ) do setWeaponProperty ( "sniper", v, "damage", 9999 ) end Como não? é so cria -__- function killPed( p) return setElementHealth(p,0) end
-
O id da arma está incorreto, pegue os ids necessários aqui: https://wiki.multitheftauto.com/wiki/Weapon.
-
Eu quero que mate em qualquer parte do corpo nao so na cabeça (client-side) local weapons = {20, 40} -- id da arma function onClientPedDamage(_, weapon) if(getElementType(source) == "player") then if(weapons[weapon]) then return killPed(source) end end end addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage)
-
Perfect example.
-
I'm not sure if I understood your question, but you can try one of these control checkers. if(getControlState("handbrake")) then end if(getControlState("brake_reverse")) then end