Jump to content

>شرح< smoothMoveCamera طلب


Recommended Posts

Posted

السلام عليكم لو سمحت عاوز شرح ل هذا الكود كامل

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 
Posted

اذا تبي اول مايدخل الاعب , سم

* Server Side :

addEventHandler ( 'onPlayerJoin', root, 
    function ( ) 
        triggerClientEvent ( source, 'OnPlayerEnter', source ) 
    end 
) 

* Client Side :

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 
  
addEvent ( 'OnPlayerEnter', true ) 
addEventHandler ( 'OnPlayerEnter', root, 
    function ( ) 
        smoothMoveCamera ( x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time ) 
        -- x1 = احداثيات المكان الاول 
        -- y1 = احداثيات المكان الاول 
        -- z1 = احداثيات المكان الاول 
        -- x1t = لفت الكام 
        -- y1t = لفت الكام 
        -- z1t = لفت الكام 
        -- x2 = احداثيات المكان الثاني 
        -- y2 = احداثيات المكان الثاني 
        -- z2 = احداثيات المكان الثاني 
        -- x2t = لفت الكام 
        -- y2t = لفت الكام 
        -- z2t = لفت الكام 
        -- time = وقت مشيت الكام + سرعتها 
    end 
) 
  
-- تنبيه : لفت الكام يعني وين تبي تروح الكام تتوجه وين ؟ 
Posted

عقيد معلش ممكن تقولى ليش الكود ذا مو شغال

اصدار mta 1.5

--In order to render the browser on the full screen, we need to know the dimensions. 
local screenWidth, screenHeight = guiGetScreenSize() 
  
--Let's create a new browser in remote mode. 
local window = guiCreateWindow(200, 200, 1024, 768, "Webbrowser", false) 
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) 
  
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized. 
-- After this event has been triggered, we will be able to load our URL 
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser 
addEventHandler("onClientBrowserCreated", theBrowser,  
    function() 
        -- After the browser has been initialized, we can load [url=https://www.youtube.com]www.youtube.com[/url] 
        loadBrowserURL(source, "https://www.youtube.com") 
    end 
) 

Posted

للأتستخدمه بشيء ,, يغضبه الله # اللهم بلغت فشهد ,, مالي دخل فيك @

local screenWidth, screenHeight = guiGetScreenSize() 
  
local window = guiCreateWindow(200, 200, 1024, 768, "Webbrowser", false) 
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) 
  
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser 
addEventHandler("onClientBrowserCreated", theBrowser, 
    function() 
        loadBrowserURL(source, "https://www.youtube.com") 
    end 
) 
Posted
للأتستخدمه بشيء ,, يغضبه الله # اللهم بلغت فشهد ,, مالي دخل فيك @

local screenWidth, screenHeight = guiGetScreenSize() 
  
local window = guiCreateWindow(200, 200, 1024, 768, "Webbrowser", false) 
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) 
  
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser 
addEventHandler("onClientBrowserCreated", theBrowser, 
    function() 
        loadBrowserURL(source, "https://www.youtube.com") 
    end 
) 

اول مرهـ اشوف الفنكشنات ذي والافنت ذا

1.5 شكلها مع التحديث الجديد

اشرحها ولا عليك امر

Posted
للأتستخدمه بشيء ,, يغضبه الله # اللهم بلغت فشهد ,, مالي دخل فيك @

local screenWidth, screenHeight = guiGetScreenSize() 
  
local window = guiCreateWindow(200, 200, 1024, 768, "Webbrowser", false) 
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) -- انشاء متصفح 
  
local theBrowser = guiGetBrowser(browser) -- يجيب عنصر المتصفح من guiCreateBrowser 
addEventHandler("onClientBrowserCreated", theBrowser, -- حدث تكوين متصفح # 
    function() 
        loadBrowserURL(source, "https://www.youtube.com") -- تحميل رابط محدد # مثلا قوقل او اي شي 
    end 
) 
Posted

اذا تبي اول مايدخل الاعب , سم

* Server Side :

addEventHandler ( 'onPlayerJoin', root, 
    function ( ) 
        triggerClientEvent ( source, 'OnPlayerEnter', source ) 
    end 
) 

* Client Side :

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 
  
addEvent ( 'OnPlayerEnter', true ) 
addEventHandler ( 'OnPlayerEnter', root, 
    function ( ) 
        smoothMoveCamera ( x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time ) 
        -- x1 = احداثيات المكان الاول 
        -- y1 = احداثيات المكان الاول 
        -- z1 = احداثيات المكان الاول 
        -- x1t = لفت الكام 
        -- y1t = لفت الكام 
        -- z1t = لفت الكام 
        -- x2 = احداثيات المكان الثاني 
        -- y2 = احداثيات المكان الثاني 
        -- z2 = احداثيات المكان الثاني 
        -- x2t = لفت الكام 
        -- y2t = لفت الكام 
        -- z2t = لفت الكام 
        -- time = وقت مشيت الكام + سرعتها 
    end 
) 
  
-- تنبيه : لفت الكام يعني وين تبي تروح الكام تتوجه وين ؟ 

بالكلنت onClientResourceStart حدث اذ دخل الاعب بالسيرفر يجي قبل التحميل واذ سويت له ترايقر للكلنت راح يقلك الافنت مو موجود لذا استخدم

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...