Jump to content

[طلب] airstrike


Recommended Posts

سويت المود بس ظهرت مشكلتين

1- انه لما اطلق يصير انفجار بس ما تنفجر السيارة

2- وانا احرك الشاشة لفترة القي فجأة وانا احرك الشاشة القاها لفت

الكود كلينت

/center]

addEventHandler("onClientResourceStart",root,
function ()
setElementData(localPlayer,"zoom",0)
end)
 
local screenW, screenH = guiGetScreenSize()
 
local x = 215
local y = 1907.9814453125
local z = 100
local lx = 215
local ly = 1908.0686035156
local lz = 20
 
addEventHandler("onClientRender", root,
    function()
    if getElementData(localPlayer,"inAir") == true then
       dxDrawLine(screenW * 0.5175, screenH * 0.5067, screenW * 0.6637, screenH * 0.5067, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.5050, screenH * 0.2850, screenW * 0.5050, screenH * 0.4900, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.3463, screenH * 0.5067, screenW * 0.4925, screenH * 0.5067, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.5050, screenH * 0.5233, screenW * 0.5050, screenH * 0.7283, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.6637, screenH * 0.4917, screenW * 0.6637, screenH * 0.5233, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.3463, screenH * 0.4917, screenW * 0.3463, screenH * 0.5233, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.4938, screenH * 0.7283, screenW * 0.5175, screenH * 0.7283, tocolor(255, 255, 255, 255), 1, false)
        dxDrawLine(screenW * 0.4938, screenH * 0.2850, screenW * 0.5175, screenH * 0.2850, tocolor(255, 255, 255, 255), 1, false)
    end
    end
)
 
GUIEditor = {
    button = {},
    window = {}
}
GUIEditor.window[1] = guiCreateWindow(0.36, 0.35, 0.28, 0.31, "[ Airstrike Mode ]", true)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetVisible(GUIEditor.window[1], false)
guiSetAlpha(GUIEditor.window[1], 1.00)
GUIEditor.button[1] = guiCreateButton(0.09, 0.25, 0.83, 0.22, "Start Airstrike", true, GUIEditor.window[1])
guiSetFont(GUIEditor.button[1], "default-bold-small")
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF")
GUIEditor.button[2] = guiCreateButton(0.20, 0.76, 0.55, 0.19, "Close", true, GUIEditor.window[1])
guiSetFont(GUIEditor.button[2], "default-bold-small")
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
 
 
function render()
setCursorPosition(screenW/2, screenH/2)
end
 
 
addEvent("open",true)
addEventHandler("open",root,
function ()
guiSetVisible(GUIEditor.window[1], true)
showCursor(true)
end)
 
local sm = {}
sm.moov = 0
sm.object1,sm.object2 = nil,nil
 
local function removeCamHandler()
    if(sm.moov == 1)then
        sm.moov = 0
    end
end
 
local function camRender()
    if (sm.moov == 1) then
        local x1,y1,z1 = getElementPosition(sm.object1)
        local x2,y2,z2 = getElementPosition(sm.object2)
        setCameraMatrix(x1,y1,z1,x2,y2,z2)
    end
end
addEventHandler("onClientPreRender",root,camRender)
 
function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time)
    if(sm.moov == 1)then return false end
    sm.object1 = createObject(1337,x1,y1,z1)
    sm.object2 = createObject(1337,x1t,y1t,z1t)
    setElementAlpha(sm.object1,0)
    setElementAlpha(sm.object2,0)
    setObjectScale(sm.object1,0.01)
    setObjectScale(sm.object2,0.01)
    moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad")
    moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad")
    sm.moov = 1
    setTimer(removeCamHandler,time,1)
    setTimer(destroyElement,time,1,sm.object1)
    setTimer(destroyElement,time,1,sm.object2)
    return true
end
 
function move (button,press)
local x1,y1,z1,x2,y2,z2 = getCameraMatrix()
if button == "w" then
smoothMoveCamera(x1,y1,z1,x2,y2,z2,x1,y1+10,z1,x2,y2+10,z2,50)
elseif button == "s" then
smoothMoveCamera(x1,y1,z1,x2,y2,z2,x1,y1-10,z1,x2,y2-10,z2,50)
elseif button == "d" then
smoothMoveCamera(x1,y1,z1,x2,y2,z2,x1+10,y1,z1,x2+10,y2,z2,50)
elseif button == "a" then
smoothMoveCamera(x1,y1,z1,x2,y2,z2,x1-10,y1,z1,x2-10,y2,z2,50)
end
end
 
addEventHandler("onClientGUIClick",root,
function ()
if source == GUIEditor.button[1] then
setTimer(setElementData,2000,1,localPlayer,"inAir",true)
setCameraMatrix(x,y,z,lx,ly,lz)
addEventHandler("onClientRender",root,render)
guiSetVisible(GUIEditor.window[1], false)
setCursorAlpha(0)
setElementFrozen(localPlayer,true)
addEventHandler("onClientKey",root,move)
setPlayerHudComponentVisible("all",false)
elseif source == GUIEditor.button[2] then
guiSetVisible(GUIEditor.window[1], false)
showCursor(false)
end
end)
 
addEventHandler("onClientClick",root,
function(button, state, absoluteX, absoluteY, x, y, z, clickedElement)
if getElementData(localPlayer,"inAir") == true and button == "left" then
createExplosion(x,y,z,2)
end
end)
 
bindKey("Q","down",
function ()
if getElementData(localPlayer,"inAir") == true then
setElementData(localPlayer,"inAir",false)
setCameraTarget(localPlayer)
removeEventHandler("onClientRender",root,render)
guiSetVisible(GUIEditor.window[1], false)
setElementFrozen(localPlayer,false)
showCursor(false)
setCursorAlpha(255)
setPlayerHudComponentVisible("all",true)
removeEventHandler("onClientKey",root,move)
end
end)
 
bindKey("Z","down",
function ()
if getElementData(localPlayer,"inAir") == true then
if getElementData(localPlayer,"zoom") == 2 then
local x1,y1,z1,x2,y2,z2 = getCameraMatrix()
setCameraMatrix(x1,y1,100,x2,y2,z2)
setElementData(localPlayer,"zoom",0)
else
local x1,y1,z1,x2,y2,z2 = getCameraMatrix()
setCameraMatrix(x1,y1,z1-25,x2,y2,z2)
setElementData(localPlayer,"zoom",getElementData(localPlayer,"zoom")+1)
end
end
end)

Link to comment

لقيت حل لمشكلة الانفجار بس فيه مشكلة ثانية

انه انا الحين جالس احرك الكاميرا يمين من حرف ي وانا احرك فجأة القي الروتيشن حق الكاميرات غير

Link to comment

smoothMoveCamera استخدم الطريقه العاديه بدون الوظيفه

local cx, cy, cz, px, py, pz; 
  
function moveCamera() 
    setCameraMatrix ( cx or x, cy or y, cz or z, px or lx, py or ly, pz or lz ) 
end 
  
  
function move (button,press) 
    local x1,y1,z1,x2,y2,z2 = getCameraMatrix() 
        if button == "w" then 
            cx, cy, cz, px, py, pz = x1,y1+10,z1,x2,y2+10,z2 
        elseif button == "s" then 
            cx, cy, cz, px, py, pz = x1,y1-10,z1,x2,y2-10,z2 
        elseif button == "d" then 
            cx, cy, cz, px, py, pz = x1+10,y1,z1,x2+10,y2,z2 
        elseif button == "a" then 
            cx, cy, cz, px, py, pz = x1-10,y1,z1,x2-10,y2,z2 
    end 
end 

moveCamera ولا تنسى تضيف الرندر يوم يبدأ للوظيفه

Link to comment
smoothMoveCamera استخدم الطريقه العاديه بدون الوظيفه

local cx, cy, cz, px, py, pz; 
  
function moveCamera() 
    setCameraMatrix ( cx or x, cy or y, cz or z, px or lx, py or ly, pz or lz ) 
end 
  
  
function move (button,press) 
    local x1,y1,z1,x2,y2,z2 = getCameraMatrix() 
        if button == "w" then 
            cx, cy, cz, px, py, pz = x1,y1+10,z1,x2,y2+10,z2 
        elseif button == "s" then 
            cx, cy, cz, px, py, pz = x1,y1-10,z1,x2,y2-10,z2 
        elseif button == "d" then 
            cx, cy, cz, px, py, pz = x1+10,y1,z1,x2+10,y2,z2 
        elseif button == "a" then 
            cx, cy, cz, px, py, pz = x1-10,y1,z1,x2-10,y2,z2 
    end 
end 

moveCamera ولا تنسى تضيف الرندر يوم يبدأ للوظيفه

بس تحسها كذا مو Smooth

:lol:

تقدر تستعمل

onClientRender, Tables, onClientKey 

يوم يضغط زر ضيفه في الجدول

وتحقق انه في الرندر لو مثلاً زر W

موجود في الجدول يحرك الكاميرا الي الامام

Link to comment

^ ؟smoothوليه راح يحتاج الـ

smooth هو قاعد يحرك الكاميرا بزر, يعني الكاميرا ما راح تتحرك طول الوقت ما اشوف له داعي الـ

بس اللي يحتاجه كم راح يزيد او ينقص على الاحداثيات, اتوقع 10 كثيره اساساً.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...