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

Wysłany: 2020-05-05, 19:27


DaVeCS

Mapper






Wiek: 31
Na forum: 3386 dni
Posty: 193
Nick w MP: DaVe

Piwa: 59

Respekt: 70,5

Witam ot?? mam problem z panelem logowania. Gdy wybieram spawn ka?dy poza "Tw?j Dom" to jest dobrze, za? gdy wybiore w?a?nie "Tw?j Dom" to nic si? nie dzieje opr?cz b??du w debugscript

B??d https://imgur.com/a/dtunt4s

Kod dotycz?cy b??du:
-- CompatibilityLua-5.1
function split(strpat)
   local t = {}  -- NOTE: use {0in Lua-5.0
   local fpat "(.-)" .. pat
   local last_end 1
   local secap str:find(fpat1)
   while do
      if ~= or cap ~= "" then
     table.insert(t,cap)
      end
      last_end e+1
      secap str:find(fpatlast_end)
   end
   if last_end <= #str then
      cap str:sub(last_end)
      table.insert(tcap)
   end
   return t
end


6 linijka to: local s, e, cap = str:find(fpat, 1)

[ Dodano: 2020-05-05, 19:31 ]
Dodam ?e jak nie mam kupionego domku to respi w miejscu spawnu tam gdzie ustawi?em.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-05, 19:37


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie musisz definiowa? funkcji split, gdy? jest ona ju? wbudowana w MTA.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-05, 19:43


DaVeCS

Mapper






Wiek: 31
Na forum: 3386 dni
Posty: 193
Nick w MP: DaVe

Piwa: 59

Respekt: 70,5

Czyli poprostu mam j? usun???

[ Dodano: 2020-05-05, 19:45 ]
My?l? ?e to nie jest to, poniewa? wyb?r spawnu "Tw?j Dom" dalej nie reaguje.

Kod od wyboru Spawnu:
--[[
    ResourceOURGme v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

local sx,sy guiGetScreenSize()
local px,py = (sx/1920),(sy/1080)
local data={ showed=nilbutton={}, info=nilmisc=nil,tick=getTickCount()}
local font=dxCreateFont("font.ttf"12)
local font1 dxCreateFont"font1.ttf"15)
local font12 dxCreateFont"font1.ttf"10)
local font123 dxCreateFont"font1.ttf"14)
local cameraXcameraY 6002400

local screenWscreenH guiGetScreenSize()
function isMouseIn123(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end


local animsbuiltins = {}, {"Linear""InQuad""OutQuad""InOutQuad""OutInQuad""InElastic""OutElastic""InOutElastic""OutInElastic""InBack""OutBack""InOutBack""OutInBack""InBounce""OutBounce""InOutBounce""OutInBounce""SineCurve""CosineCurve"}

function table.find(tv)
    for ka in ipairs(t) do
        if == v then
            return k
        end
    end
    return false
end
a 255
function animate(fteasingdurationonChangeonEnd)
    assert(type(f) == "number""Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
    assert(type(t) == "number""Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
    assert(type(easing) == "string" or (type(easing) == "number" and (easing >= or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
    assert(type(duration) == "number""Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
    assert(type(onChange) == "function""Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
    table.insert(anims, {from fto teasing table.find(builtinseasing) and easing or builtins[easing], duration durationstart getTickCount( ), onChange onChangeonEnd onEnd})
    return #anims
end

function destroyAnimation(a)
    if anims[athen
        table.remove(animsa)
    end
end

addEventHandler("onClientRender"root, function( )
    local now getTickCount( )
    for k,v in ipairs(anims) do
        v.onChange(interpolateBetween(v.from00v.to00, (now v.start) / v.durationv.easing))
        if now >= v.start+v.duration then
            if type(v.onEnd) == "function" then
                v.onEnd( )
            end
            table.remove(animsk)
        end
    end
end)
choosed 0

function renderZoneBox()
    local progress=math.sin(getTickCount()/450)*4
local r=interpolateBetween(255,255,255,20,250,0,(getTickCount()-tick)/2000,"SineCurve")
cameraXcameraY cameraX 0.1cameraY 0.1
setCameraMatrix(cameraXcameraY500cameraX 1cameraY 10)
dxDrawImage(screenW 0.0000screenH 0.0000screenW 1.0000screenH 1.0000":im-logowanie/misc/69.png"000tocolor(255255255255), false)
    dxDrawImage(screenW 0.3703screenH 0.1935screenW 0.2755screenH 0.0852":im-logowanie/misc/logo_1.png"000tocolor(255255255ALPHA1), false)

    dxDrawImage(screenW 0.6240screenH 0.2074screenW 0.0464screenH 0.0463":im-logowanie/misc/icon.png"000tocolor(255255255,ALPHA1), false)

    if choosed == 1 then 
        dxDrawText("SPAWN LOS SANTOS"screenW 0.4297screenH 0.3574screenW 0.6005screenH 0.4130tocolor(255255255r), 1.00font"center""center"falsefalsefalsefalsefalse)

    dxDrawImage(screenW 0.3911screenH 0.3574screenW 0.0323screenH 0.0556":im-logowanie/misc/wyb.png"000tocolor(255255255255), false)
    else 
        dxDrawText("SPAWN LOS SANTOS"screenW 0.4297screenH 0.3574screenW 0.6005screenH 0.4130tocolor(140140140a), 1.00font"center""center"falsefalsefalsefalsefalse)

        dxDrawImage(screenW 0.3911screenH 0.3574screenW 0.0323screenH 0.0556":im-logowanie/misc/niewyb.png"000tocolor(255255255a), false)
    end
        if choosed == 2 then 
            dxDrawText("PRZECHO LOS SANTOS"screenW 0.4297screenH 0.4296screenW 0.6005screenH 0.4852tocolor(255255255r), 1.00font"center""center"falsefalsefalsefalsefalse)

        dxDrawImage(screenW 0.3911screenH 0.4333screenW 0.0323screenH 0.0556":im-logowanie/misc/wyb.png"000tocolor(255255255255), false)
    else 
        dxDrawText("PRZECHO LOS SANTOS"screenW 0.4297screenH 0.4296screenW 0.6005screenH 0.4852tocolor(140140140a), 1.00font"center""center"falsefalsefalsefalsefalse)

        dxDrawImage(screenW 0.3911screenH 0.4333screenW 0.0323screenH 0.0556":im-logowanie/misc/niewyb.png"000tocolor(255255255a), false)
    end

    if choosed == 3 then 
        dxDrawText("TW?J DOM"screenW 0.4297screenH 0.5083screenW 0.6005screenH 0.5639tocolor(255255255r), 1.00,font"center""center"falsefalsefalsefalsefalse)

        dxDrawImage(screenW 0.3911screenH 0.5083screenW 0.0323screenH 0.0556":im-logowanie/misc/wyb.png"000tocolor(255255255255), false)
    else 
        dxDrawText("TW?J DOM"screenW 0.4297screenH 0.5083screenW 0.6005screenH 0.5639tocolor(140140140a), 1.00,font"center""center"falsefalsefalsefalsefalse)

        dxDrawImage(screenW 0.3911screenH 0.5083screenW 0.0323screenH 0.0556":im-logowanie/misc/niewyb.png"000tocolor(255255255a), false)
    end
    if info then
    dxDrawText(infoscreenW 0.4406screenH 0.2880screenW 0.5766screenH 0.3269tocolor(255255255a), 1.00"default""center""center"falsefalsefalsefalsefalse)
    else 
        dxDrawText("Kliknij k??ko obok wybranego przez Ciebie spawnu"screenW 0.4406screenH 0.2880screenW 0.5766screenH 0.3269tocolor(255255255a), 1.00font123"center""center"falsefalsefalsefalsefalse)
    end
    if not isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398then 
        dxDrawImage(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398":im-logowanie/misc/button.png"000tocolor(255255255a), false)
    dxDrawText("Wybierz"screenW 0.4177screenH 0.6176screenW 0.5745screenH 0.6444tocolor(255255255a), 1.00font12"center""center"falsefalsefalsefalsefalse)
    else 
        dxDrawImage(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398":im-logowanie/misc/button.png"000tocolor(255255255a), false)
        dxDrawText("Wybierz"screenW 0.4177screenH 0.6176screenW 0.5745screenH 0.6444tocolor(16114211a), 1.00font12"center""center"falsefalsefalsefalsefalse)
    end
end


addEventHandler("onClientClick"root, function(btn,state)
    if getElementData(localPlayer"player:online"then return end
    if getElementData(localPlayer,"panel:logowania"then return end

    if btn=="left" and state=="down" then
        if isMouseIn123(screenW 0.3943screenH 0.3667screenW 0.0240screenH 0.0370then 
            data.tick=getTickCount()+1000
            choosed 1 end
        if isMouseIn123(screenW 0.3943screenH 0.4426screenW 0.0240screenH 0.0370then choosed 2 end 
        if isMouseIn123(screenW 0.3943screenH 0.5176screenW 0.0240screenH 0.0370then choosed 3
        end
        if isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398) and choosed == 1 then  -- sf SPAWN
         setElementData(localPlayer,"player:spawn",{1654.12,-1661.48,22.52})
         closeZones()
        end
        if isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398) and choosed == 2 then  -- przecho SF
            setElementData(localPlayer,"player:spawn",{760.42,-1361.90,13.52+0.1})
            closeZones()
           end
           if isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398) and choosed == 3 then  -- dom
            local domek=getElementData(localPlayer,"player:house")
            if not domek then
            setElementData(localPlayer,"player:spawn",{1654.12,-1661.48,22.52+0.1})
            outputChatBox("* Nie posiadasz domku, lub straci? wa?no??.")
            closeZones()
           end
        end

           if isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398) and choosed == 0 then  -- nic
            info "Najpierw wybierz spawn!"
            return
           end
         --[[if isMouseIn123(screenW 0.4089screenH 0.5370screenW 0.1979screenH 0.0306) and data.showed then -- LV
         setElementData(localPlayer,"player:spawn",{2013.321246.0710.82+0.1})
         closeZones()
        end
         if isMouseIn123(screenW 0.4089screenH 0.5981screenW 0.1979screenH 0.0306) and data.showed then
        local domek=getElementData(localPlayer,"player:house")
        if not domek then
        setElementData(localPlayer,"player:spawn",{389.59, -1524.3332.27+0.1})
        outputChatBox("* Nie posiadasz domku, lub straci? wa?no??.")
        end]]--
    end
end)

function closeZones()
    showChat(true)
    showCursor(false)
    fadeCamera(false)
    setElementAlpha(localPlayer,255)
    --setElementData(localPlayer,"player:logged")
    stopSound(data.misc)
    showPlayerHudComponent("radar",false)
    showPlayerHudComponent("crosshair",false)
    showPlayerHudComponent("weapon",false)
    showPlayerHudComponent("radar",true)
    showPlayerHudComponent("health",false)
    showPlayerHudComponent("breath",false)
    --showPlayerHudComponent("tab",false)
    showPlayerHudComponent("clock",false)
    showPlayerHudComponent("ammo",false)
    data.showed=false
    -- Usuwamy elementy
    triggerServerEvent("core:spawnPlayer"localPlayer)
    setTimer(triggerEvent2501"gui:start"localPlayer)
    removeEventHandler("onClientRender"rootrenderZoneBox)
    setElementData(localPlayer"zalogowany"true)
end

function showZones(misc)
    data.misc=misc
    data.showed=true

    showChat(false)
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    addEventHandler("onClientRender"rootrenderZoneBox) 
    animate(0255"Linear"1000, function(valuevalue end)
end


[ Dodano: 2020-05-05, 19:47 ]
za? jak wgra?em inny panel logowania to jak klikn??em by mnie zrespi?o w domu to zrespi?o mnie w innych kordach ni? blip domu

[ Dodano: 2020-05-05, 20:03 ]
teraz wy?wietla mi taki b??d: https://imgur.com/a/0VFZCYs

[ Dodano: 2020-05-05, 20:04 ]
B??d ten dotyczy tego:

addEvent "SprawdzDom"true )
function SprawdzDom gracz )
    local dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
    for __,v in ipairs(dbdomy) do
        local uid=tonumber(getElementData(gracz,"player:sid"))
        local r=v.ownerid
        v.drzwi=split(v.drzwi,",")
        for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
        if r then if == uid then 
        setElementData(gracz,"player:house",true)
        tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
        setElementData(gracz,"player:spawn",tak)
        end end
    end
        for __,v in ipairs(dbdomy) do
        local uid=tonumber(getElementData(gracz,"player:sid"))
        v.drzwi=split(v.drzwi,",")
        for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
        setElementData(gracz,"player:house",true)
        tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
        setElementData(gracz,"player:spawn",tak)
        end
    end
addEventHandler "SprawdzDom"rootSprawdzDom )


a dok?adniej tej linijki: for ii,vv in ipairs(v.drzwi) do v.drzwi[ii]=tonumber(vv) end

[ Dodano: 2020-05-05, 20:45 ]
u mnie tak wygl?da funkcja na respienie w domu:
if isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398) and choosed == 3 then  -- dom
            local domek=getElementData(localPlayer,"player:house")
            outputChatBox("test")
            if not domek then
            setElementData(localPlayer,"player:spawn",{1654.12,-1661.48,22.52+0.1})
            outputChatBox("* Nie posiadasz domku, lub straci? wa?no??.")
            closeZones()
           end
        end


[ Dodano: 2020-05-06, 07:34 ]
Dok?adnie chodzi o t? funkcj?
if isMouseIn123(screenW 0.4297screenH 0.6093screenW 0.1365screenH 0.0398) and choosed == 3 then  -- dom
            local domek=getElementData(localPlayer,"player:house")
            outputChatBox("test")
            if not domek then
            setElementData(localPlayer,"player:spawn",{1654.12,-1661.48,22.52+0.1})
            outputChatBox("* Nie posiadasz domku, lub straci? wa?no??.")
            closeZones()
           end
        end
gdy klikam guzik to nic si? nie dzieje poza wy?wietleniem napisu TEST

Postaw piwo autorowi tego posta
 

 
Tagi: wybór :: spawnu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Wybór spawnu Odpowiedz do tematu

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