Leaderboard
Popular Content
Showing content with the highest reputation on 27/01/19 in all areas
-
2 points
-
2 points
-
Não esquece de usar a função getPlayerFromPartialName ela não é nativa. function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end2 points
-
2 points
-
addEventHandler + group elements I noticed that some people like to add 10000000000000000 addEventHandlers for each element, while you probably only need 1 addEventHandler. Using ONE addEventHandler on a group of elements? Answer: local group = createElement("groupMyCutePeds") -- Create a custom element and save it in to the variable <group>. -- Create 3 peds. local ped1 = createPed(120, 5540.6654, 1020.55122, 1240.545) local ped2 = createPed(120, 5541.6654, 1021.55122, 1240.545) local ped3 = createPed(120, 5542.6654, 1022.55122, 1240.545) -- Set the parent of the 3 peds. setElementParent(ped1, group) setElementParent(ped2, group) setElementParent(ped3, group) -- Add an addEventHandler and use the <group> as <attachedTo> element. addEventHandler("onPedWasted", group, -- "onPedWasted" = serverside. "onClientPedWasted" = clientside. function () outputChatBox("One of my cute peds just died. ;'( No exceptions!") end) Code is untested, but the method is tested. Syntax for functions in example createElement syntax element createElement ( string elementType, [ string elementID = nil ] ) setElementParent syntax bool setElementParent ( element theElement, element parent ) addEventHandler syntax bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [ bool getPropagated = true, string priority = "normal" ] ) DO NOT disable getPropagated getPropagated: A boolean representing whether the handler will be triggered if the event was propagated down or up the element tree (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to false will only be triggered if source == this). If you disable this, children of the <group> element are not included. Make use of the element tree Element tree For applying addEventHandlers to elements created by the resource: Use: resourceRoot / getResourceRootElement For applying addEventHandlers to elements created by scripts of the resource: Use: getResourceDynamicElementRoot For applying addEventHandlers to elements created by maps of the resource: Use: getResourceMapRootElement I hope your code will be without... print(10^10^10^10) -- Print here: https://www.lua.org/cgi-bin/demo ...addEventHandlers in the future.1 point
-
1 point
-
1 point
-
@Peti 1. + 3. To answer this, you need to understand the difference between client and serverside: The server is a computer. Which RUNS serverside. The Clients are multiple computer connected to the server. Which RUNS clientside. The internet and the network is in between. (ping is the delay which separates those two types of computers) In case of a local-server the ping 0, but both sides are still separated. And that will give the result as @Patrick2562 said. 2. You make peds created by clientside/serverside shoot at clientside. The reason why it can't be done serverside is because MTA doesn't support it yet.1 point
-
1. If you create the ped on client side, the ped only visible for the client. But you create it on server side, the ped visible for everybody. 2. Both 3. Server.1 point
-
1 point
-
1 point
-
1 point
-
Esqueceu do feedback de escape. Que avisa ao usuário que o comando não funcionou por falta de permissão. function DAR_XP_AIRNEWSCR ( source, cmd, pname, Quantidade ) outputChatBox ("01", source) if pname and tonumber(Quantidade) then outputChatBox ("02", source) local cliente = getPlayerFromPartialName(pname) if isElement(cliente) then outputChatBox ("03", source) if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin"))) then outputChatBox ("04", source) setElementData ( cliente, "Level", Quantidade ) exports.Scripts_Dxmessages:outputDx(source, "Você Setou o Level do(a) Jogador(a) "..getPlayerName(cliente).."#ffffff para "..Quantidade.." com Sucesso!", "success") exports.Scripts_Dxmessages:outputDx(cliente, "O(A) Admin "..getPlayerName(source).."#ffffff Setou seu Level para "..Quantidade.." com Sucesso!", "success") else outputChatBox ("Acesso negado.", source, 255, 0, 0) end else outputChatBox ("05", source) exports.Scripts_Dxmessages:outputDx(source, "O Jogador Não Foi Encontrado", "error") end end end addCommandHandler ( "level", DAR_XP_AIRNEWSCR )1 point
-
Creio que ele esteja apenas testando um comando para dar level, os scripts de trabalho é que darão automaticamente.1 point
-
Então descobrimos o problema. Você não está com a data "Console_AirNewSCR"1 point
-
1 point
-
if getElementData ( source, "Console_AirNewSCR" ) == "Sim" then Então o erro deve estar nessa linha.1 point
-
Então mano. Tente o comando /level Lucas 50 Realmente não existe nenhum jogador com nick admin1 point
-
Teste com seu nick, a função não funciona com o cargo da ACL. E mostre o que sai no chat com o código de depuração que o Lord postou.1 point
-
Qual o nick dos jogadores atualmente online no servidor? (Olhe na tabela do TAB)1 point
-
Tá, é o seguinte. Recomendo que vc debugue seu código para ver onde ele está lendo e onde não está lendo. Faça isso na sua função: function DAR_XP_AIRNEWSCR ( source, cmd, pname, Quantidade ) outputChatBox ("01", source) if pname and tonumber(Quantidade) then outputChatBox ("02", source) local cliente = getPlayerFromPartialName(pname) if isElement(cliente) then outputChatBox ("03", source) if getElementData ( source, "Console_AirNewSCR" ) == "Sim" then outputChatBox ("04", source) setElementData ( cliente, "Level", Quantidade ) exports.Scripts_Dxmessages:outputDx(source, "Você Setou o Level do(a) Jogador(a) "..getPlayerName(cliente).."#ffffff para "..Quantidade.." com Sucesso!", "success") exports.Scripts_Dxmessages:outputDx(cliente, "O(A) Admin "..getPlayerName(source).."#ffffff Setou seu Level para "..Quantidade.." com Sucesso!", "success") end else outputChatBox ("05", source) exports.Scripts_Dxmessages:outputDx(source, "O Jogador Não Foi Encontrado", "error") end end end addCommandHandler ( "level", DAR_XP_AIRNEWSCR ) Me diga quais números aparecem no chat ao usar o comando.1 point
-
1 point
-
Se você usa sistema de EXP pra upar de level, aconselho usar pra setar EXP o meu é assim, eu seto experiencia ao invés de level.1 point
-
Entendi. Vou botar esse perfil dele nos créditos também.1 point
-
Que é mais conhecido como CrystalMV. Esse perfil no site de resources do MTA também é dele. Quanto ao usuário JesseOngame, ele recebeu uma punição de 1 semana sem postar por ignorar diversos avisos (no último tópico tentei dar mais uma chance, mas ele insistiu em criar outros tópicos).1 point
-
1 point
-
local chat_range=100 function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onPlayerChatHandler( message, messageType ) if (messageType == 0) then cancelEvent() local px,py,pz=getElementPosition(source) local nick=getPlayerName(source) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#BEBEBELocal* #FFFAFA"..nick..": #DCDCDC"..message,v,30,30,200,true) end end end end addEventHandler( "onPlayerChat", root, onPlayerChatHandler ) Mais fácil assim @danblemes11 point
-
1 point
-
1 point
-
this is just like bacon, AWESOME. I was missing some group system in LUA. Hey, if I was going to call the group in a diff resource I should use getElementsByType or retrieve it with getElementById? and how is the right way to remove a element from a group? local charGroup = createElement('groupCharacter', 'character_group') setElementParent(charGroup, getElementById('account_group')) addEvent('server_onCharacterLogin', function() setElementParent(source, charGroup) end) addEvent('server_onCharacterLogout', function() setElementParent(source, nil) end) My code seems correct?1 point
-
Tools for building buildings and interiors. For example, to be able to put a wall and stretch it (the wall models will spawn exactly one after another) etc.1 point
-
- place random object from category, example random tree, random rock, random bush etc. with option random rotation - move multiple objects at once - support for water, colzones, occolusion zones, custom models - save in various methods, as .map, .lua, .sql, compress file ( example: dont set interior=0 if by default interior = 0, dont set posX = 123.0000005 ) - simple permission system, example provilages to: edit, create, destroy, save, load, map settings - upgrade remove world object, now, some object are impossible to remove ( if you click but nothing you clicked, then script find nearest 10 world objects and show you in list ) - import map to current map which able to marge multiple maps into one, and export part of map into separated files ( example you can export all object which in colshape )1 point
-
0 points