MTASA TÜRK
Türkiye'nin En Güncel MTA Platformu


[YARDIM] Sniper Nişangah

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı ardaabo

  • Acemi Üye
  • *
    • İleti: 131
: 18 Şubat 2021, 11:43:54
Merhaba, DayZ sunucumda belirli sniper silahlarına nişangah yaptım fakat, sorunum şu. Bazı sniperlar tek mermili sıktığında crosshair açık halde reload yapıyor. Ben bunu reload yaparken crosshair kapatmasını istiyorum. Yardımcı olarak birisi var mı

Kod
local textures = {}; 
local cross = false

local function render_crosshair()
local screenw,screenh = guiGetScreenSize ();
local s = screenw * 0.5;
local u,v = (screenw - s)*0.5, (screenh - s)*0.5;
local black = tocolor (0, 0, 0, 255);
dxDrawRectangle (0, 0, screenw, v, black);
dxDrawRectangle (0, 0, u, screenh, black);
dxDrawRectangle (0, screenh, screenw, -v, black);
dxDrawRectangle (screenw, screenh, -u, -screenh, black);
dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["crosshair_background"]);
if cross == "DMR" then
    dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["cross_dmr"]);
elseif cross == "AS50" then
    dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["cross_as50"]);
elseif cross == "VSS" then
    dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["cross_vss"]);
elseif cross == "VSSK" then
    dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["cross_vss"]);
elseif cross == "M107" then
    dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["cross_as50"]);
elseif cross == "M2000 CheyTac" then
    dxDrawImage (u, v, screenw-2*u, screenh-2*v, textures ["cross_as50"]);
end
end;


local function on_weapon_aimed (key, state)
local weapon_sniper_rifle = 34;
if getPedWeapon (getLocalPlayer ()) == weapon_sniper_rifle then
if state == "down" then
cross = getElementData(getLocalPlayer(),"currentweapon_1")
setPlayerHudComponentVisible ("crosshair", false);
addEventHandler ("onClientHUDRender", getRootElement (), render_crosshair);
else
cross = false
removeEventHandler ("onClientHUDRender", getRootElement (), render_crosshair);
end;
end;
end;

addEventHandler ("onClientResourceStart", getResourceRootElement (getThisResource ()),
function ()
textures ["crosshair_background"] = dxCreateTexture ("images/crosshairs/crossBackground1.png", "argb", true, "wrap")
textures ["cross_dmr"] = dxCreateTexture ("images/crosshairs/aim_dmr.png", "argb", true, "wrap");
textures ["cross_as50"] = dxCreateTexture ("images/crosshairs/aim_as50.png", "argb", true, "wrap");
textures ["cross_vss"] = dxCreateTexture ("images/crosshairs/aim_vss.png", "argb", true, "wrap");

bindKey ("aim_weapon", "both", on_weapon_aimed);
addEventHandler ("onClientPlayerWeaponSwitch", getRootElement (),
function (previousWeaponSlot)
local weaponslot_type_sniper = 6;
if previousWeaponSlot == weaponslot_type_sniper then
if not isPlayerHudComponentVisible ("crosshair") then
setPlayerHudComponentVisible ("crosshair", true);
end;
end;
end);
end);

addEventHandler ("onClientResourceStop", getResourceRootElement (getThisResource ()),
function ()
unbindKey ("aim_weapon", "both", on_weapon_aimed);
if not isPlayerHudComponentVisible ("crosshair") then
setPlayerHudComponentVisible ("crosshair", true);
end;
end);
 


MTASA TÜRK

[YARDIM] Sniper Nişangah
« : 18 Şubat 2021, 11:43:54 »