Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 15/11/19 in Posts

  1. Machine guns against aircraft have the disadvantage that their range can not exceed 300 meters, which means that ships would be defenseless against air targets above 300m flight height. Sure, this would be no big deal since most people are flying low, but i think its better to keep it that way and i dont think it makes much sense to change it anyway because there are almost no players using ships at all. About the update, i found some small things that still need work before i can upload it. But dont expect much. I needed to disable water reflections because me and @XaskeL could not fix the issues yet.
    1 point
  2. Figuring out how tables work in Lua was... Rather challenging, but did manage to figure out the very basics. For those who read this thread in hoping of an example of tables, this is what my final code turned out to be and now everything works as it was intended: local Element={} -- The simplest form of declaring a table, I decided not to get fancy with it function ClientResourceStart(resource) PED=createPed(271,-1641.0,-2248.0,31.5,0.0) -- 1st Test Ped Element[PED]={Name="Zach"} -- Giving 1st Test Ped a Name in the table setPedArmor(PED,100.0) PED=createPed(241,-1639.0,-2248.0,31.5,0.0) -- 2nd Test Ped Element[PED]={Name="Bill"} PED=createPed(158,-1643.0,-2248.0,31.5,0.0) -- 3rd Test Ped Element[PED]={Name="Mary"} setTimer(Seconds,1000,0) -- Will run the Seconds Function every second to check if player is in Range and has a LOS end function Seconds() local f1,f2,f3=getCameraMatrix() -- Another loop for players, currently only testing with Peds though for l,t in ipairs(getElementsByType("ped"))do local f4,f5,f6=getElementPosition(t) if(getDistanceBetweenPoints3D(f1,f2,f3,f4,f5,f6)<=25.0)then if(isLineOfSightClear(f4,f5,f6+2,f1,f2,f3))then local f7,f8=getScreenFromWorldPosition(f4,f5,f6+1) if(f7)and(f8)and(not Element[t]["Visible"])then -- Checks to make sure this Ped isn't already marked with "Visible" Element[t]["Visible"]=true -- Adds a new entry to the table, Visible Element[t]["ID"]="NPC" -- Adds yet another new entry to the table end elseif(Element[t]["Visible"])then -- Ped no longer in L.O.S. Element[t]["Visible"]=nil -- Removes the entry from the table Element[t]["ID"]=nil -- Removes the entry from the table end elseif(Element[t]["Visible"])then -- Ped no longer in Range Element[t]["Visible"]=nil -- Removes the entry from the table Element[t]["ID"]=nil -- Removes the entry from the table end end end 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(Element)do if(Element[l]["Visible"])then -- Checks if the element in this loop has "Visible" marked (Or exist even) DrawDXTextOnElement(l,"(#A0A0A0"..Element[l]["ID"].."#808080) #C0C0C0"..Element[l]["Name"].."",0.95,25.0,128,128,128,255,1.3) -- ^ The line above displays the Peds ID and Name above the head ^ DrawDXBoxOnElement(l,102,7,1.01,25.0,0,0,0,75)-- Black Outline Box for Health DrawDXBoxOnElement(l,100,5,1.009,25.0,64,0,0,75)-- Damage Box for Health DrawDXBoxOnElement(l,getElementHealth(l),5,1.009,25.0,255,0,0)-- Amount Box for Health if(getPedArmor(l)>0)then -- If no armor, don't bother showing an empty armor bar... DrawDXBoxOnElement(l,102,7,1.06,25.0,0,0,0,75)-- Black Outline Box for Armor DrawDXBoxOnElement(l,100,5,1.059,25.0,64,64,64,75)-- Damage Box for Armor DrawDXBoxOnElement(l,getPedArmor(l),5,1.059,25.0,255,255,255)-- Amount Box for Armor end DrawDXTextOnElement(l,"LOCAL: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",1.12,25.0,255,255,255,255,1.3) -- Just a positioning test, this needs updating end end end Thanx again IIYama Everything in this thread has now been resolved XD
    1 point
  3. Leia os argumentos de setElementData: theElement, key, value, synchronize (opcional) setElementData(source, "oneshot", true) Assim deve funcionar ^
    1 point
×
×
  • Create New...