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

Wysłany: 2020-01-15, 21:39


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam posiadam logowanie i gdy si? loguje , pozniej mam wybieranie spawnu
mam ustawione 3 : Spawn FC, Spawn BB, Urz?d . Gdy klikne na obojetnie kt?ry wywala mnie tylko do FC a nie np. Pod urz?d lub do BB, a b??du w DB3 brak
c_zone.lua

local login = {}

local dist 100
local angler 0
rXrY 00

local foncik dxCreateFont("assets/bold.ttf"15)
local foncik2 dxCreateFont("assets/normal.ttf"22)
local foncik1 dxCreateFont("assets/bold.ttf"11)
local sx,sy guiGetScreenSize() -- pobieramy rozdzielczo?? gracza kt?ry widzi gui
local px,py = (sx/1366),(sy/768) -- dzielimy rozdzielczo?? gracza kt?ry widzi gui przez rozdzielczo?? na kt?rej by?o robione
local screenWscreenH guiGetScreenSize()
local data={ showed=nilbutton={}, info=nilmisc=nil, }

function math.round(numberdecimalsmethod)
    decimals decimals or 0
    local factor 10 decimals
    if (method == "ceil" or method == "floor"then return math[method](number factor) / factor
    else return tonumber(("%."..decimals.."f"):format(number)) end
end

function getPointFromDistanceRotation(xydistangler)
    local a math.rad(90 angler)
    local dx math.cos(a) * dist;
    local dy math.sin(a) * dist;
    return x+dxy+dy;
end

function isMouseIn(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 dist 100
local angler 0

login.required_resources = {
     fog exports["dxFog"]
   }
   
   login.positions = {
       bg = {
           0,
           0,
           1366*px,
           768*py,
       },
       logo = {
           515*px,
           70*py,
           375*px, 
           195*py,
       },
       lights = {
           0,
           0,
           1366*px,
           768*py,
       },
       spawn = {
           0,
           0,
           1366*px,
           768*py,
       }
   }
   login.textures = {
       bg dxCreateTexture("assets/background.png"),
       logo dxCreateTexture("assets/logo.png"),
       lights dxCreateTexture("assets/lights.png"),
       spawn dxCreateTexture("assets/spawn/spawn.png"),
       onebutton dxCreateTexture("assets/spawn/1button.png"),
       twobutton dxCreateTexture("assets/spawn/2button.png"),
       threebutton dxCreateTexture("assets/spawn/3button.png")
   }



function renderZoneBox()
    dxDrawImage(login.positions.bg.xlogin.positions.bg.ylogin.positions.bg.wlogin.positions.bg.hlogin.textures.bg)
    login.required_resources.fog:renderFogRectangle()
    dxDrawText("Wybierz miejsce spawnu"532*px285*py873*px327*pytocolor(255255255120), 1.00foncik2"center""center"falsefalsefalsefalsefalse)
    dxDrawImage(login.positions.spawn.xlogin.positions.spawn.ylogin.positions.spawn.wlogin.positions.spawn.hlogin.textures.spawn)

    if isMouseIn(425*px76*py157*px39*pythen
        dxDrawImage(001366*px768*pylogin.textures.onebutton)
    end

    if isMouseIn(605*px76*py157*px39*pythen
        dxDrawImage(001366*px768*pylogin.textures.twobutton)
    end
    
    if isMouseIn(784*px76*py157*px39*pythen
        dxDrawImage(001366*px768*pylogin.textures.rbutton)
    end
    dxDrawText("Spawn FC"429*px85*py582*px115*pytocolor(255255255120), 1.00foncik1"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Spawn BB"604*px85*py757*px115*pytocolor(255255255120), 1.00foncik1"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Urzad"784*px85*py937*px115*pytocolor(255255255120), 1.00foncik1"center""center"falsefalsefalsefalsefalse)

    local x,y=getPointFromDistanceRotation(-296.201088.70distangler)
    setCameraMatrix(x,y,44.25+0.9,-296.201088.7044.25+0.9)
    angler=(angler+0.1)
end

addEventHandler("onClientClick"root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(429*px85*py582*px115*py) and data.showed then
         setElementData(localPlayer,"player:spawn",{-205.691212.2019.89}) -- 1 button
         triggerEvent("onClientAddNotification"localPlayer"Pomy?lnie si? zrespi?e?/a?.""info"true6500)
         closeZones()
        end
        if isMouseIn(604*px85*py757*px115*py) and data.showed then
        setElementData(localPlayer,"player:spawn",{207.63, -63.861.58}) -- 2button
        triggerEvent("onClientAddNotification"localPlayer"Pomy?lnie si? zrespi?e?/a?.""info"true6500)
        closeZones()
        end
        if isMouseIn(784*px85*py937*px115*py) and data.showed then
        setElementData(localPlayer,"player:spawn",{-59.141176.2019.63}) -- 3button
        triggerEvent("onClientAddNotification"localPlayer"Pomy?lnie si? zrespi?e?/a?.""info"true6500)
        closeZones()
        end
end
end)

function closeZones()
    showChat(true)
    showCursor(false)
    fadeCamera(false)
    setElementAlpha(localPlayer,255)
    stopSound(data.misc)
    showPlayerHudComponent("all",false)
    showPlayerHudComponent("radar",true)
    data.showed=false
    setElementData(localPlayer,"player:logged",true)
    triggerServerEvent("core:spawnPlayer"localPlayer)
    removeEventHandler("onClientRender"rootrenderblur)
    removeEventHandler("onClientRender"rootrenderZoneBox)
end

function showZones(misc)
    data.misc=misc
    data.showed=true
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    showChat(false)
    addEventHandler("onClientRender"rootrenderZoneBoxend

function filedelet ()
if fileExists("c_zone.lua"then
   fileDelete("c_zone.lua")
 end
end
addEventHandler("onClientResourceStart"getResourceRootElement(getThisResource()), filedelet)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-15, 21:53


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nic dziwnego, nigdzie tutaj w kodzie nie ustalasz pozycji gracza ani go nie spawnujesz.
Albo nie wys?a?e? ca?ego kodu, albo u?yj jednej z poni?szych funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

spawnPlayer


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Przeanalizuj dok?adnie sw?j kod.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-15, 22:58


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

To przypadkiem nie to ?
 if btn=="left" and state=="down" then
        if isMouseIn(429*px85*py582*px115*py) and data.showed then
         setElementData(localPlayer,"player:spawn",{-205.691212.2019.89}) -- 1 button
         triggerEvent("onClientAddNotification"localPlayer"Pomy?lnie si? zrespi?e?/a?.""info"true6500)
         closeZones()
        end
        if isMouseIn(604*px85*py757*px115*py) and data.showed then
        setElementData(localPlayer,"player:spawn",{207.63, -63.861.58}) -- 2button
        triggerEvent("onClientAddNotification"localPlayer"Pomy?lnie si? zrespi?e?/a?.""info"true6500)
        closeZones()
        end
        if isMouseIn(784*px85*py937*px115*py) and data.showed then
        setElementData(localPlayer,"player:spawn",{-59.141176.2019.63}) -- 3button
        triggerEvent("onClientAddNotification"localPlayer"Pomy?lnie si? zrespi?e?/a?.""infno"true6500)
        closeZones()
        end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-16, 06:36


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No i gdzie masz te funkcje, kt?re wymieni?em w po?cie wcze?niej?
Dlatego m?wi?, przeanalizuj kod. Zobacz co robisz closeZone, jakie eventy triggeruje itd.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-16, 16:06


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

No jest w closeZone :
    triggerServerEvent("core:spawnPlayer"localPlayer)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-16, 18:11


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No to wklej funkcje z tego eventu. To jest tylko trigger. Radz? poczyta?

Więcej informacji znajdziesz w Wikipedii MTA:

triggerServerEvent


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-16, 20:15


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

I tak nie kumam :<

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-16, 20:32


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No co tu du?o m?wi?, musisz wklei? tre?? funkcji, kt?ra jest wykorzystywana w tym evencie ("core:spawnPlayer").

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-17, 18:25


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Tylko ze mam 2 inne logowanie i tez tego nie ma a jakos mnie tepa w dane miejsca :( ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-18, 11:00


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No to szukaj w ca?ym gamemodzie funkcji "spawnPlayer" albo "setElementPosition" bo jako? musi Ci? gdzie? respi?. No chyba, ?e tego w og?le nie masz to dodaj sobie event z klienta do serwera po zalogowaniu i wtedy tam spawnuj gracza.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-18, 11:57


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Tylko ze inne logowania dzialaja :( ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-18, 12:44


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No i co z tego, to musisz naprawi? ten co nie dzia?a. Albo u?yj tych co dzia?aj? i je przer?b graficznie czy co tam chcesz.

Postaw piwo autorowi tego posta
 

 
Tagi: ten :: sam :: resp
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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