Jump to content

maia.lua

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by maia.lua

  1. Atualmente estou tentando desenvolver um script para setar o status de arma para 1000 assim que o player entrar no jogo, contudo, eu não consigo. Acredito que não há nenhum erro no meu script ou apenas não consigo ver o erro. Este é o código: function SetStats(thePlayer) setPedStat(thePlayer, 78, 1000) end addEventHandler("onPlayerJoin", root, SetStats)
  2. Eu entendo o que você disse e até já tinha pensado nisso, contudo, não sei como posso executar isso na prática. Poderia me ajudar? Este é o código: local jugadores = {} local lplayer = getLocalPlayer() local info = {} local sx,sy = guiGetScreenSize() function crearArma(jug,arma) local model = obtenerObjeto(arma) local slot = getSlotFromWeapon(arma) jugadores[jug][slot] = createObject(model,0,0,0) setElementCollisionsEnabled(jugadores[jug][slot],false) end function destruirArma(jug,slot) destroyElement(jugadores[jug][slot]) jugadores[jug][slot] = nil end addEventHandler("onClientResourceStart",getResourceRootElement(),function() for k,v in ipairs(getElementsByType("player",root,true)) do jugadores[v] = {} info[v] = {true,isPedInVehicle(v)} end end,false) addEventHandler("onClientPlayerQuit",root,function() if jugadores[source] and source ~= lplayer then for k,v in pairs(jugadores[source]) do destroyElement(v) end jugadores[source] = nil info[source] = nil end end) addEventHandler("onClientElementStreamIn",root,function() if getElementType(source) == "player" and source ~= lplayer then jugadores[source] = {} info[source] = {true,isPedInVehicle(source)} end end) addEventHandler("onClientElementStreamOut",root,function() if jugadores[source] and source ~= lplayer then for k,v in pairs(jugadores[source]) do destroyElement(v) end jugadores[source] = nil info[source] = nil end end) addEventHandler("onClientPlayerSpawn",root,function() if jugadores[source] then info[source][1] = true end end) addEventHandler("onClientPlayerWasted",root,function() if jugadores[source] then for k,v in pairs(jugadores[source]) do destruirArma(source,k) end info[source][1] = false end end) addEventHandler("onClientPlayerVehicleEnter",root,function() if jugadores[source] then for k,v in pairs(jugadores[source]) do destruirArma(source,k) end info[source][2] = true end end) addEventHandler("onClientPlayerVehicleExit",root,function() if jugadores[source] then info[source][2] = false end end) addEventHandler("onClientPreRender",root,function() for k,v in pairs(jugadores) do local x,y,z = getPedBonePosition(k,3) local rot = math.rad(90-getPedRotation(k)) local i = 15 local wep = getPedWeaponSlot(k) local ox,oy = math.cos(rot)*0.22,-math.sin(rot)*0.22 local alpha = getElementAlpha(k) for q,w in pairs(v) do if q == wep then destruirArma(k,q) else setElementRotation(w,0,70,getPedRotation(k)+90) setElementAlpha(w,alpha) if q==2 then local px,py,pz = getPedBonePosition(k,51) local qx,qy = math.sin(rot)*0.11,math.cos(rot)*0.11 setElementPosition(w,px+qx,py+qy,pz) elseif q==4 then local px,py,pz = getPedBonePosition(k,41) local qx,qy = math.sin(rot)*0.06,math.cos(rot)*0.06 setElementPosition(w,px-qx,py-qy,pz) else setElementPosition(w,x+ox,y+oy,z-0.2) setElementRotation(w,-17,-(50+i),getPedRotation(k)) i=i+15 end end end if info[k][1] and not info[k][2] then for i=1,7 do local arma = getPedWeapon(k,i) if arma~=wep and arma>0 and not jugadores[k] then crearArma(k,arma) end end end end end) function obtenerObjeto(arma) local m if arma > 1 and arma < 9 then m = 331 + arma elseif arma == 9 then m = 341 elseif arma == 15 then m = 326 elseif (arma > 21 and arma < 30) or (arma > 32 and arma < 39) or (arma > 40 and arma < 44) then m = 324 + arma elseif arma > 29 and arma < 32 then m = 325 + arma elseif arma == 32 then m = 372 end return m end
  3. Olá, boa noite, eu queria saber se você poderia me ajudar em um script. Seguinte, eu possuo um script que a arma fica no jogador quando ele possui uma arma, mas, quando a arma não está mais no inventário do jogador, ela continua no corpo dele, o que eu poderia fazer?
  4. i need this code, you have?
  5. Ah, e o jogo crasha após um tempo por conta do marker.
  6. Este Marker está dando erro nas linhas 63 e 64, mais precisamente nos dois "dxDrawMaterialLine3D". Em ambos, o argumento 7 está dando NIL, alguém poderia ajudar? anim_tick = getTickCount() local maxDist = 30 local renderCache = {} setTimer( function() renderCache = {} local px,py,pz = getElementPosition(localPlayer) for k, v in pairs(radarMarkers) do local id, img, marker, r, g, b, cicle, rc, gc, bc = unpack(v) if marker and isElement(marker) then local x,y,z = getElementPosition(marker) local dist = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if dist <= maxDist then local x, y, z = getElementPosition(marker) local sx, sy = getScreenFromWorldPosition(x, y, z) if sx and sy then setElementData(marker, "marker:custom", id) if getElementData(marker, "marker:custom") == id then renderCache[k] = v renderCache[k]["id"] = id renderCache[k]["img"] = dxCreateTexture(img) renderCache[k]["imgcicle"] = dxCreateTexture(cicle) renderCache[k]["colorimg"] = {r, g, b} renderCache[k]["colorcicle"] = {rc, gc, bc} end end end end end end, 500, 0) addEventHandler("onClientResourceStart", resourceRoot, function() for k,v in pairs(getElementsByType("marker", _, true)) do if getElementData(v, "marker:custom") then getMarkerCustom() end end end ) function getMarkerCustom() local progress = ((getTickCount() - anim_tick) / 3000) local Op1, Op2 = interpolateBetween(0.4, 1.4, 0, 0.7, 1.7, 0, progress, "SineCurve") local Op3, Op4, Op5 = interpolateBetween(0.8, 0.8, 1.6, 1.0, 1.0, 2.1, progress, "SineCurve") local px, py, pz, l1, l2, l3 local px, py, pz = getCameraMatrix() for _, marker in ipairs(getElementsByType 'marker') do if getElementData(marker, "marker:custom") then setMarkerColor(marker, 0, 0, 0, 0) local l1, l2, l3 = getElementPosition(marker) local dist = math.sqrt((px + l1) ^ 0 + (py + l2) ^ 0 + (pz + l3) ^ 0) local r, g, b = getMarkerColor(marker) if dist < 20 then if isLineOfSightClear(px, py, pz, l1, l2, l3, false, false, false, true, false, false, false, localPlayer) then local x,y = getScreenFromWorldPosition(l1, l2, l3) if x then for name, data in pairs(renderCache) do local id, img, marker2, r, g, b, cicle = unpack(data) if getElementData(marker, "marker:custom") == id then dxDrawMaterialLine3D (l1, l2, l3 + Op1 + 0.4, l1, l2, l3 + Op2 + 0.4, data["img"], 1, tocolor(data["colorimg"][1], data["colorimg"][2], data["colorimg"][3], 255)) dxDrawMaterialLine3D (l1, l2 - Op3 + 0.3, l3 + 0.03, l1, l2 + Op4 - 0.3, l3 + 0.03, data["imgcicle"], Op5 - 0.7, tocolor(data["colorcicle"][1], data["colorcicle"][2], data["colorcicle"][3], 255), 0, 0, -1730900) end end end end end end end end addEventHandler("onClientRender", root, getMarkerCustom)
×
×
  • Create New...