Jump to content

ماب الفري روم


Recommended Posts

# وانا جالس ادور في الفري روم لقيت كود الماب واحس انه كامل

بس ابي اعرف وش ناقصه عشان يشتغل

لاني جربته مااشتغل

كان يطلعلي مشاكل كثير في الديبوق رغم اني مسوي كل شي صح !

الديبوق يقولي في اخر سطر في السيرفر# عندك مشكله

كلنت :

g_Me = getLocalPlayer() 
g_MapSide = (screenHeight * 0.85) 
  
  
    local wnd = mapwnd 
    local mapControl = getControl(wnd, 'map') 
    for elem,player in pairs(g_PlayerData) do 
        if not player.gui.mapBlip then 
            player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == g_Me and 'localplayerblip.png' or 'playerblip.png', false, mapControl) 
            player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name, false, mapControl) 
            local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow) 
            guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false) 
            guiSetFont(player.gui.mapLabelShadow, 'default-bold-small') 
            guiLabelSetColor(player.gui.mapLabelShadow, 255, 255, 255) 
            player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name, false, mapControl) 
            guiSetFont(player.gui.mapLabel, 'default-bold-small') 
            guiLabelSetColor(player.gui.mapLabel, 0, 0, 0) 
            for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do 
                addEventHandler('onClientGUIDoubleClick', player.gui[name], 
                    function() 
                        triggerServerEvent ( "warpMe", elem)         
                        guiSetVisible(mapwnd,false) 
                    end, 
                    false 
                ) 
            end 
        end 
        local x, y = getElementPosition(elem) 
        x = math.floor((x + 3000) * g_MapSide / 6000) - 4 
        y = math.floor((3000 - y) * g_MapSide / 6000) - 4 
        guiSetPosition(player.gui.mapBlip, x, y, false) 
        guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false) 
        guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false) 
    end 

سيرفر :

         
function spawnMe2(x, y, z) 
    if not x then 
        x, y, z = getElementPosition(source) 
    end 
    if isPedTerminated(source) then 
        repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288)) 
    else 
        spawnPlayer(source, x, y, z, 0, getPedSkin(source)) 
    end 
    setCameraTarget(source, source) 
    setCameraInterior(source, getElementInterior(source)) 
end 
  
addEvent("warpMe",true) 
addEventHandler("warpMe",root, 
function() 
    if isPedDead(source) then 
        spawnMe2() 
    end) 

Link to comment

تعريف control وحقاته في اف 1

Code : #

function getControlData(...) 
    local lookIn 
    local currentData 
    local args = { ... } 
    if type(args[1]) == 'string' then 
        currentData = _G[args[1]] 
    else 
        currentData = args[1] 
    end 
     
    for i=2,#args do 
        if args[i] == '..' then 
            currentData = currentData.parent 
        else 
            lookIn = currentData.controls or currentData.tabs 
            if not lookIn then 
                return false 
            end 
            currentData = false 
            for j,control in pairs(lookIn) do 
                if control.id == args[i] then 
                    currentData = control 
                    break 
                end 
            end 
            if not currentData then 
                return false 
            end 
        end 
    end 
    return currentData 
end 
  
function getControl(...) 
    if type(({...})[1]) == 'userdata' then 
        -- if a control element was passed 
        return ({...})[1] 
    end 
     
    local data = getControlData(...) 
    if not data then 
        return false 
    end 
    return data.element 
end 
  
function getControlText(...) 
    return guiGetText(getControl(...)) 
end 
  
function getControlNumber(...) 
    return tonumber(guiGetText(getControl(...))) 
end 
  
function getControlNumbers(...) 
    -- getControlNumbers(..., controlnames) 
    -- ... = path to parent window 
    -- controlnames: array of control names 
    -- returns a list value1, value2, ... with the numbers entered in the specified controls 
    local args = {...} 
    local controlnames = table.remove(args) 
    local result = {} 
    for i,name in ipairs(controlnames) do 
        result[i] = getControlNumber(unpack(args), name) 
    end 
    return unpack(result) 
end 

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