Salve, sou novo no fórum e em lua também,
o que quero fazer é deixar o ped imortal e incapaz de atirar, trocar de arma etc, por alguns segundos.
Mas acontece que invés de somente o ped ficar incapaz de atirar, todos os jogadores ficam também, mas o DX acima do ped fica só pra ele, alguem da um help ai? peço perdão se estiver dificil de entender oq quero fazer, vou fazer algumas observações nas linhas pra ver se facilita
Client-side:
local rapt = dxCreateFont('files/rapt.ttf', 18, false);
addEventHandler ( "onClientPlayerDamage",root,
function ()
if getElementAlpha(source) == 100 then --- quando ele usar o tele, vai ficar com esse alpha, usei isso pra deixar ele imortal, funcionou de boa
cancelEvent()
end
end
)
addEventHandler( 'onClientRender', root,
function( )
for _, player in ipairs( getElementsByType( 'player') ) do
if isElementOnScreen( player ) and getElementAlpha(player) == 100 and not getElementData(player,"ModoPassivo") then
local cx, cy, cz, x, y, z, dist
local x, y, z = getElementPosition( player );
local cx, cy, cz = getCameraMatrix( );
dist = math.sqrt( ( cx - x ) ^ 2 + ( cy - y ) ^ 2 + ( cz - z ) ^ 2 )
if dist < 30.0 then
if isLineOfSightClear( cx, cy, cz, x, y, z, true, false, false, true, false, false, false,localPlayer ) then
local sx, sy, sz = getPedBonePosition( player, 6 )
local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.75 )
if x then
dxDrawImage(x-53, y-35, 105, 21, "files/dx1.png", 0, 0, 0, tocolor(0, 0, 0, 100), false) --- dx funfou de boa
dxDrawText("Proteção Spawn", x, y-50, x, y, tocolor(205, 205, 205, 255), 0.52, rapt, "center", "center") ---
toggleControl ( "fire", false )
toggleControl ( "aim_weapon", false )
toggleControl ( "next_weapon", false ) --- aqui tá o problema, era pra essas funçoes serem aplicadas só pro ped local :(
toggleControl ( "previous_weapon", false )
toggleControl ( "vehicle_fire", false )
end
end
end
end
end
end
);
Server-side:
function removerprotecao (source)
setElementAlpha(source, 255)
end
addEventHandler("onPlayerCommand",root,
function(command)
if (command == "praia") then
if not getPedOccupiedVehicle(source) then
setElementAlpha(source, 100)
setElementPosition ( source, 328.2568359375, -1779.7213134766, 5.5062503814697 )
onClientCrapBox(source, "tele", getPlayerName(source).." #c2c2c2foi para a Praia (#1E90FF/praia#c2c2c2).")
setTimer ( removerprotecao, 3300, 1, source)
else
exports.Infobox:addBox(source, 'Saia do veículo para utilizar este comando.', 'error')
end
end
end)
de coração, se alguém poder me ajudar ficarei muito grato