Leaderboard
Popular Content
Showing content with the highest reputation on 14/11/19 in all areas
-
The problem is that this kind of stuff doesnt allow to pass parameters to the effects, just like createEffect is missing parameters. At least with createEffect you can control the draw distance. Thats why i created a simple map editor helper script that allows to place/move/edit these effects in the map editor with all their properties.1 point
-
Não é proibido, mas também não é recomendável dar scripts de graça. Tente fazer por conta própria.1 point
-
Sim. Faça com evento onPlayerDamage. Nesse evento existe o parâmetro bodyPart. Se ele for igual a 9 (cabeça) então usa killPed e mata o source (que foi o jogador que recebeu o dano). Antes de matá-lo, verifique se ele está na arena. Pode ser com elementData.1 point
-
So there is just one state ON and OFF? Or are the more states in visibility? Like: On map showing Tag showing In order to make it easier. Set a default state: visibility = false Do your checks, if YES do: visibility = true add the ped to the table If visibility == false, remove the ped from the table. function Seconds() local f1, f2, f3= getCameraMatrix() for l,t in ipairs(getElementsByType("ped"))do local f4,f5,f6=getElementPosition(t) local visible = false -- by default the ped is not visible -- Do your checks. if(getDistanceBetweenPoints3D(f1,f2,f3,f4,f5,f6)<=25.0)then if(isLineOfSightClear(f4,f5,f6,f1,f2,f3+2))then local f7,f8=getScreenFromWorldPosition(f4,f5,f6+1) if(f7)and(f8)then -- Ped is visible visible = true -- set the state -- Add the ped to the table if not added yet. if not PlayerVisible[t] then outputChatBox("TM: #FFFFFFPoint D!",255,150,50,true)-- This point IS reached... PlayerVisible[t] = true-- Still working this... !!! end --PlayerVisible[t][id]="NPC" -- Once point Z is reached, then I'll worry about this stuff --PlayerVisible[t][name]="Bill" -- Once point Z is reached, then I'll worry about this stuff end elseif(PlayerVisible[t])then-- Ped no longer in L.O.S. outputChatBox("TM: #FFFFFFPoint 1!",255,0,0,true) end elseif(PlayerVisible[t])then-- Ped no longer in Range outputChatBox("TM: #FFFFFFPoint 2!",255,0,0,true) end -- Clear the ped from the table if not visible and in the table if not visible and PlayerVisible[t] then PlayerVisible[t] = nil end end -- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --collectgarbage() -- < REMOVE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! end And remove destroyed elements from the table. Lua does not know if an element exist or is destroyed. function ClientRender()-- This event is constantly called, it's not wise to add anything here unless you have NO other choice... You were warned! for l,t in pairs(PlayerVisible)do if isElement(t) then outputChatBox("TM: #FFFFFFPoint Z!",255,150,50,true)-- Not reaching this point... ((( With the noted changes, I now reach Point Z ))) else PlayerVisible[t] = nil -- if the element is destroyed, clear the data end end end1 point
-
This for l,t in ipairs(PlayerVisible)do will only loop through items, BUT only items that are stored as an array. {[1] = player, [2] = player, [3] = player} -- array structure -- OR {player, player, player} To solve that issue we can use pairs, instead of ipairs. This function doesn't care if items are stored as an array. {[player] = true, [player] = true, [player] = true} -- your structure So do this instead: for l,t in pairs(PlayerVisible)do1 point
-
1 point
-
if ( player_faggio1~=localPlayer) then -- player is not in faggio teleport vehicle to player setElementPosition(faggio1, x, y, z)1 point
-
Qual o limite de criação de objetos? (quantos objetos cada player pode criar no máximo?)1 point
-
Primeiramente vc deve indexar o objeto no jogador, caso contrário outro jogador vai causar conflito no objeto criado por este jogador. Se o jogador sair do servidor, deve-se destruir o objeto dele. obejto = {} -- Table vazia, onde todos os objetos serão armazenados. Não sei se 'obejto' foi escrito errado de propósito, mas mantive da forma que estava. function createObjectG (thePlayer, commandName) if (isElement (obejto[thePlayer])) then return outputConsole ("Já existe um objeto criado por você. Delete-o antes de criar outro.", thePlayer) end local x, y, z = getElementPosition (thePlayer) -- pega a posição do player que executou o comando obejto[thePlayer] = createObject (1237, x , y , z -1) -- cria o obejto na posição do player e indexa o objeto no jogador. if (obejto[thePlayer]) then -- checa se o objeto foi criado com sucesso. outputConsole ("Objeto criado com sucesso!", thePlayer) else outputConsole ("Falha ao criar o objeto!", thePlayer) end end addCommandHandler ("cb", createObjectG) function deletObjeto (thePlayer, commandName) if (isElement (obejto[thePlayer])) then -- Verifica se o objeto existe antes de tentar destruí-lo. destroyElement (obejto[thePlayer]) obejto[thePlayer] = nil -- Anula a variável do objeto destruído para liberar espaço na memória. (sempre faça isso após destruir um elemento que está numa variável global) outputConsole ("Objeto destruído com sucesso!", thePlayer) else outputConsole ("Você não tem um objeto criado!", thePlayer) end end addCommandHandler ("dob", deletObjeto) addEventHandler ("onPlayerQuit", root, function (quitType, reason, responsibleElement) if (isElement (obejto[source])) then -- Se existe um objeto criado pelo jogador que saiu do server, então: destroyElement (obejto[source]) -- Destrói esse objeto. obejto[source] = nil -- Anula a variável dele. end end)1 point
-
ياريت قبل م تقول اني اتهمه تتأكد المود مين مسويه1 point
-
السكربت مو مسروق ومو ملك لأحد إذا ذا قصدك السكربت اصلا صاحبه ناشره https://community.multitheftauto.com/index.php?p=resources&s=details&id=727 اللهم صاحب الموضوع اعتقد ترجمه للعربية1 point
-
أحييك علي المود الجميل ومشكووور ع الاهداء يعمري ء1 point
-
I am not sure what you want to achieve with it. But if you want to check if an element is in a table, then this is also very fast method. The elements have become the KEY of the table. local table = {[el1] = true, [el2] = true, [el3] = true} if table[place] then -- Yes it is in the table end Adding elements to the table by hand: table[el1] = true table[el2] = true table[el3] = true With this method, you can also make a reference to different data: local table = {[el1] = {"more data"}, [el2] = {"more data"}, [el3] = {"more data"}} local moreData = table[place]1 point
-
Aqui as funções para isso: local globalObjects = {} function createPlayerObject( player, ... ) if isElement(player) then local object = createObject( ... ) if not object then return false end if not globalObjects[player] then globalObjects[player] = {} end table.insert( globalObjects[player], object ) end end function destroyPlayerObjects( player ) if globalObjects[player] then for i=1, #globalObjects[player] do if isElement(globalObjects[player][i]) then destroyElement(globalObjects[player][i]) end end globalObjects[player] = nil end end addEventHandler("onPlayerQuit", root, function() destroyPlayerObjects( source ) end) Você vai poder verificar a quantidade atual de objects com uma verificação tipo assim: local limite = 20 if globalObjects[player] and #globalObjects[player] >= limite then return outputChatBox("Limite de objects criados!", player) end0 points
-
Adicione o comando: addCommandHandler com o comando desejado ( 'oneshot' ); Quando o jogador digitar o comando, utilize a função setElementData; Quando sair, remova essa elementData, que pode ser passando false no valor. Obs: no seu código está verificando se bodypart é 3 que é o torso, troque para 9 se quiser que seja a cabeça.0 points