Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-07-21, 15:48


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

Witam, mam pro?b? pom?g? by kto? doda? do Panelu Logowania spawn na domku tak?e bazie organizacji?

Kod:

if getElementData(localPlayer"player:logged"then return end

local spawns = {
    {name "Los Santos"pos Vector3(1214.97, -1812.7516.59),},
    {name "Prawo Jazdy"pos Vector3(1568.04, -1893.9713.56),},
    {name "Przechowywalnia LS"pos Vector3(1296.48, -1868.8413.55),},
}

local map = {
    size 1980,
    zoom = {
        actual 3.0,
        limit = {1.33.0},
        plus 0,
    },
    moving nil,
    unit 1980/6000
}

local worldWworldH 00
local mapOffsetXmapOffsetY 00
playerMapOffsetXplayerMapOffsetY 00

map.positions = {}
map.positions.wmap.positions.733*px462*py
map.positions.xmap.positions.650*px309*py

local newPlayerXnewPlayerY nilnil

local function clickMap(buttonstatecxcy)
    if chooseSpawn then
        if button == "left" then
            if state == "down" then
                local xywmap.positions.xmap.positions.ymap.positions.wmap.positions.h
                if cx >= and cx <= and cy >= and cy <= h then
                    mapOffsetX cx map.zoom.actual playerMapOffsetX
                    mapOffsetY cy map.zoom.actual playerMapOffsetY
                    mouseCurrentPositionXmouseCurrentPositionY getCursorPosition( )
                end
            elseif state == "up" then
                map.moving nil
            end
        end
        if button == "left" and state == "down" then
            for i,v in ipairs(spawns) do
                local offsetY = (49*px) * (1)
                if mouseIn(408*px349*py offsetY232*px39*pythen
                    triggerServerEvent("logging:spawn"resourceRoot, {pos = {v.pos.xv.pos.yv.pos.z}})
                    spawnGui(nil)
                end
            end
        end
    end
end

local function keyMap(key)
    if chooseSpawn then
        if key == "mouse_wheel_down" then
            map.zoom.actual map.zoom.actual 0.1
            if (map.zoom.actual map.zoom.limit[2]) then
                map.zoom.actual map.zoom.limit[2]
            end
        elseif key == "mouse_wheel_up" then
            map.zoom.actual map.zoom.actual 0.1
            if (map.zoom.actual map.zoom.limit[1]) then
                map.zoom.actual map.zoom.limit[1]
            end
        end
    end
end

local function renderMap()
    if chooseSpawn then
        alphaSpawn interpolateBetween(00025500, (getTickCount() - tickSpawn) / 500"Linear")
        alphaSpawn2 interpolateBetween(00020000, (getTickCount() - tickSpawn) / 500"Linear")
    end
    
    local xywmap.positions.xmap.positions.ymap.positions.wmap.positions.h;

    local absxabsy 00

    if isCursorShowing() then
        local cursorXcursorY getCursorPosition()
        absx cursorX sx
        absy cursorY sy
    end

    worldWworldH=map.size*map.zoom.actualmap.size*map.zoom.actual
    local mapPXmapPY 00
    mapPXmapPY getPosInMap(absxabsy)
    mapXmapY map.positions.w/mapPXmap.positions.h/mapPY

    if getKeyState("mouse1") and not movvv then
        if( mouseCurrentPositionX ~= absx and mouseCurrentPositionX ~= absy )then
            map.moving true
        end
    
        if( map.moving )then
            playerMapOffsetX = -( absx map.zoom.actual mapOffsetX )
            playerMapOffsetY = (absy map.zoom.actual mapOffsetY)
            playerMapOffsetX math.max( -3000math.min3000playerMapOffsetX ) )
            playerMapOffsetY math.max( -3000math.min3000playerMapOffsetY ) )
        end
    else
        map.moving nil
    end

    local mapX = ( ( ( 3000 playerMapOffsetX ) * map.unit ) - ( w/) * map.zoom.actual )
    local mapY = ( ( ( 3000 playerMapOffsetY ) * map.unit ) - ( h/) * map.zoom.actual )
    local mapWidthmapHeight w*map.zoom.actualh*map.zoom.actual

    dxDrawImageSection(xywhmapXmapYmapWidthmapHeighttex["map"], 000tocolor(255255255alphaSpawn))

    if newPlayerX and newPlayerY then
        playerMapOffsetXplayerMapOffsetY interpolateBetween(playerMapOffsetXplayerMapOffsetY0newPlayerXnewPlayerY0, (getTickCount() - tick) / 750"OutQuad")
        if getTickCount() - tick 750 then
            newPlayerXnewPlayerY nilnil
            movePoint nil
            movvv nil
        end
    end

    roundedRectangle(408*px309*py232*px462*pytocolor(000alphaSpawn2), false)
    dxDrawText("Spawny"408*px309*py640*px349*pytocolor(255255255alphaSpawn), 1.00font1"center""center"falsefalsefalsefalsefalse)
    for i,v in ipairs(spawns) do
        local offsetY = (49*px) * (1)
        local data = {name v.name}
        if mouseIn(408*px349*py offsetY232*px39*py) and chooseSpawn then dxDrawRectangle(408*px349*py offsetY232*px39*pytocolor(404040alphaSpawn2), falseend
        dxDrawText(data.name408*px348*py offsetY 2640*px388*pytocolor(255255255alphaSpawn), 1.00font2"center""center"falsefalsefalsefalsefalse)

        local spawnXspawnY v.pos.xv.pos.y

        local centerXcenterY = (map.positions.+ (map.positions.2)), (map.positions.+ (map.positions.2))
        local leftFrame = (centerX map.positions.2) + (28*px 2)
        local rightFrame = (centerX map.positions.2) - (28*px 2)
        local topFrame = (centerY map.positions.2) + (28*py 2)
        local bottomFrame = (centerY map.positions.2) - (28*py 2)

        spawnXspawnY getMapFromWorldPosition(spawnXspawnY)
        centerX math.max(leftFramemath.min(rightFramespawnX))
        centerY math.max(topFramemath.min(bottomFramespawnY))
        if mouseIn(408*px349*py offsetY232*px39*py) and chooseSpawn then
            dxDrawImage(centerX 15*pxcenterY 25*py28*px28*pytex["point"], 000tocolor(25500alphaSpawn))
        else
            dxDrawImage(centerX 15*pxcenterY 25*py28*px28*pytex["point"])
        end
        if mouseIn(408*px349*py offsetY232*px39*pythen
            newPlayerXnewPlayerY v.pos.xv.pos.y
            tick getTickCount()
            movePoint true
            movvv true
        end
    end
end

function spawnGui(bool)
    if bool then
        createTextures()
        dxSetTextureEdge(tex["map"], "border"tocolor(0000))
        chooseSpawn true
        tickSpawn getTickCount()
        font1 dxCreateFont("files/fonts/font.ttf"12)
        font2 dxCreateFont("files/fonts/font.ttf"10)
        addEventHandler("onClientRender"rootrenderMap)
        addEventHandler("onClientClick"rootclickMap)
        addEventHandler("onClientKey"rootkeyMap)
    else
        showCursor(false)
        showChat(true)
        fadeCamera(true)
        removeEventHandler("onClientRender"rootrenderMap)
        removeEventHandler("onClientClick"rootclickMap)
        removeEventHandler("onClientKey"rootkeyMap)
        if font1 and font2 then destroyElement(font1destroyElement(font2end
        chooseSpawn nil
        tickBg getTickCount()
        panel nil
        if intro then stopSound(introintro nil end
        destroyTextures()
    end
end

--[[]]--
function getPositionFromElementOffset(elementoffXoffYoffZ)
    local m getElementMatrix(element)
    local x offX m[1][1] + offY m[2][1] + offZ m[3][1] + m[4][1]
    local y offX m[1][2] + offY m[2][2] + offZ m[3][2] + m[4][2]
    local z offX m[1][3] + offY m[2][3] + offZ m[3][3] + m[4][3]
    return xyz
end

function getPosInMapmapXmapY )
    local xywmap.positions.xmap.positions.ymap.positions.wmap.positions.h
    local worldX playerMapOffsetX+( ( mapX-( x+w/2) ) / map.zoom.actual ) / map.unit
    local worldY playerMapOffsetY-( ( mapY-( y+h/) ) / map.zoom.actual ) / map.unit
    
    return worldXworldY
end

function getMapFromWorldPosition(worldXworldY)
    local centerXcenterY = (map.positions.+ (map.positions.2)), (map.positions.+ (map.positions.2))
    local mapLeftFrame centerX - ((playerMapOffsetX worldX) / map.zoom.actual map.unit)
    local mapRightFrame centerX + ((worldX playerMapOffsetX) / map.zoom.actual map.unit)
    local mapTopFrame centerY - ((worldY playerMapOffsetY) / map.zoom.actual map.unit)
    local mapBottomFrame centerY + ((playerMapOffsetY worldY) / map.zoom.actual map.unit)

    centerX math.max(mapLeftFramemath.min(mapRightFramecenterX))
    centerY math.max(mapTopFramemath.min(mapBottomFramecenterY))

    return centerXcenterY
end

function getWorldFromMapPosition(mapXmapY)
    local worldX playerMapOffsetX + ((mapX * ((map.positions.map.zoom.actual) * 2)) - (map.positions.map.zoom.actual))
    local worldY playerMapOffsetY + ((mapY * ((map.positions.map.zoom.actual) * 2)) - (map.positions.map.zoom.actual)) * -1

    return worldXworldY
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-21, 16:09


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110

Ja wzi??em kawa?ek kodu z paczki PYSa i jedynie bawi?em si? z domkami, nie mia?em pomys?u jakby tu ugry?? spawn organizacji, jak co? mnie najdzie to dodam :)

(Zamie? tylko pocz?tek kodu)

EDIT: Dodaj? zmian? w kodzie, wraz z pomys?em na spawn organizacji :D


function spawnorg()
local q=exports["pystories-db"]:dbGet("SLEECT * FROM ogrpg_organizations WHERE xyz=? AND sid=?",xyz,code)
    if and #q > 0 then
        pos Vector3(q[1].xyz),
        outputChatBox("* Wybrano spawn Organizacyjny."255255255)
    else
        outputChatBox("* Nie posiadasz Organizacji lub nie ma ona ustawionego spawnu."255255255)
        pos Vector3(1214.97, -1812.7516.59),
        return
    end
end



function spawndom()
local domek=getElementData(localPlayer,"player:house")
    if not domek then
        pos Vector3(1214.97, -1812.7516.59),
        outputChatBox("* Nie posiadasz domku lub straci? wa?no??."255255255)
    end
end

local spawns = {
    {name "Los Santos"pos Vector3(1214.97, -1812.7516.59),},
    {name "Prawo Jazdy"pos Vector3(1568.04, -1893.9713.56),},
    {name "Przechowywalnia LS"pos Vector3(1296.48, -1868.8413.55),},
    {name "Domek"pos Vector3(spawndom()),},
    {name "Spawn Organizacji"pos Vector3(spawnorg()),},
}

(Je?li ci wyskoczy b??d usu? przecinek przy Vector3, po spawndom, bo nie jestem pewien co do tego.)

Mam nadzieje ?e co? tam zadzia?a :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-21, 16:34


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

To nie ten dzia?, od tego masz dzia? o pro?by o przerobienie skryptu, tu si? podpowiada jak to zrobi?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-21, 16:50


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

VVirmex, tw?j kod po cz??ci dzia?a poniewa? respi aczkolwiek na podanych kordach.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-21, 18:34


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110

"TheSebaPL" napisał/a:

VVirmex, tw?j kod po cz??ci dzia?a poniewa? respi aczkolwiek na podanych kordach.


Bo nie jestem pewien po pierwsze jaki masz system domk?w a po drugie nie zmieni?e? sobie export?w z bazy danych najprawdopodobniej, chyba ?e zmieni?e?.

Podpis
Kontakt:
Discord: fluffy.rbx
Wiadomość PW Forum [Odpiszę wtedy, kiedy będę mógł]

Support Team: 26.08.2020 do 04.05.2021 [*]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-21, 18:49


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

VVirmex, system domk?w mam z psrpg czyli pystories.

Postaw piwo autorowi tego posta
 

 
Tagi: resp :: domku
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Resp domku Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku