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

Wysłany: 2018-08-03, 17:46


Rumper

Majster od pysa






Wiek: 15
Na forum: 3457 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Witam,posiadam taki problem ?e chcia?bym aby po wej?ciu w marker pojawia?o si? gui
niestety pr?bowa?em na r??ne sposoby i mi jako? nie wychodzi.
local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca Street-View\nZAROBEK:\nOD 75PLN-150PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.74, 957.88, 45.45)


local zone = createColSphere(-1986.58, 955.03, 45.54,3 )
createBlip(-1984.40, 953.92, 45.45, 46,2,0,0,0,0,0,275)
local m1 = createMarker(-1990.74, 957.88, 45.45-1, "cylinder", 1.5, 35, 142, 35)
vehs = {}
local code = "StreetView"
veh_obj = {}

function removePreviousVehicles(plr)
    for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
        local sby = getElementData(v, "zrespilGracz")
        if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
            destroyElement(v)
        end
    end
end

addEventHandler("onClientRender", root,
    function siema()
        dxDrawRectangle(387, 70, 524, 405, tocolor(48, 34, 35, 255), false)
    end
)

addEventHandler("onMarkerHit", m1, function(el, md)  
    if getElementData(el, "vehicle_job_owner2") then
        outputChatBox("Wyst?pi? b??d #6969, zg?o? si? do CEO!", el)
        return
    end

    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    if getElementData(el,"player:job") then return end
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("*Parking zaj?ty czekaj a? wyjedzie!",el) return end
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(400, -1986.58, 955.03, 45.54, 360.0, 0.0, 179.3)
    setElementFrozen(el,true)
    setElementData(bus, "vehicle_job_owner2", el)
    setElementData(bus, "vehicle:fuel", 100000)
    setElementData(bus, "vehicle:mileage", math.random(50000,80000))
    setVehicleHandling(bus, "maxVelocity", 80.0)
    setElementData(el,"player:job",code)
   setTimer(warpPedIntoVehicle,200,1,el,bus)
    toggleControl(el,"enter_exit",false)
     setTimer(toggleControl,2000,1,el, "enter_exit",true)
    setTimer(setElementFrozen,2000,1,el, false)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

    vehs[el] = bus
    veh_obj[bus] = createObject(3031,0,0,0)
    attachElements(veh_obj[bus],bus,0.3,-0.9,1.6,0,0,90)
 end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
    local pojazd = getPedOccupiedVehicle(client)
    if pojazd then
        destroyElement(pojazd)
    end
end)

addEventHandler("onPlayerVehicleExit",resourceRoot,function()
destroyElement(source)
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
     if vehs[client] then
          if isElement(vehs[client]) then destroyElement(vehs[client]) end
     end
end)

addEventHandler("onElementDestroy",resourceRoot,function()
  if getElementType(source) == "vehicle" then
    if veh_obj[source] then destroyElement(veh_obj[source]); veh_obj[source] = nil end
  end
end)

addEvent("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) end
    end
end)

Za pomoc daje :piwo: [/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-03, 18:51


maciek3286

LUA Developer






Wiek: 26
Na forum: 5342 dni
Posty: 230
Nick w MP: maciek00

Piwa: 3211

Respekt: 101,5
Respekt: 101,5

Mieszasz eventy. Pokaza?e? kod z c-side czy s-side? Bo na za??czonym kodzie u?ywasz event?w do obu stron.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-03, 19:28


Rumper

Majster od pysa






Wiek: 15
Na forum: 3457 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
s-side

Podpis
Elo benc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-03, 19:44


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Lolelo, onClientRender dzia?a tylko po stronie klienta a ty tworzysz po stronie serwera...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-03, 22:11


Adis.exe

LUA Developer






Wiek: 24
Na forum: 3639 dni
Posty: 292
Nick w MP: Adiś.exe

Piwa: 996

Respekt: 110,3
Respekt: 110,3

U?yj onClientRender po c-side


Więcej informacji znajdziesz w Wikipedii MTA:

https://wiki.multitheftauto.com/wiki/OnClientRender


a potem zr?b Eventa i zr?b triggera po sside


Więcej informacji znajdziesz w Wikipedii MTA:

https://wiki.multitheftauto.com/wiki/TriggerClientEvent


Czyli co? takiego mniej wiecej :

--C-SIDE
addEvent("show:gui", true)
addEventHandler("show:gui", root, function()
     addEventHandler("onClientRender", root, jakistamrender)
end)

--S-SIDE
--*tam gdzie chcesz wy?wietli? okno*--
triggerClientEvent(thePlayer, "show:gui", thePlayer)


Nie wiem czy nie da sie jeszcze czasem na eldatach lub zmiennych typu boolean

Podpis

KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828

Użytkownik: 05.11.2016
GTAO Member: 20.02.2019
Support-Team: 25.07.2018
Support-Team: 19.01.2019
Test Mod: 08.02.2019

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-04, 10:23


Rumper

Majster od pysa






Wiek: 15
Na forum: 3457 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Nadal nie dzia?a

Podpis
Elo benc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-04, 10:51


Nexisten

Moderator






Wiek: 22
Na forum: 4249 dni
Posty: 552
Nick w MP: Nexisten

Piwa: 1486

Respekt: 287,3
Respekt: 287,3Respekt: 287,3Respekt: 287,3

To podaj b??dy z DB3, nie mamy magicznej kuli.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-04, 11:52


Rumper

Majster od pysa






Wiek: 15
Na forum: 3457 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
WARING: praca/svs.lua:29: Bad argument @ 'triggerClientEvent' [Expected string at argument 1,got nil]

Podpis
Elo benc
Postaw piwo autorowi tego posta
 

 
Tagi: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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