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

Wysłany: 2018-05-26, 19:22


guciopl5







Wiek: 23
Na forum: 3287 dni
Posty: 86
Nick w MP: Whit3

Piwa: 8

Respekt: 45,3

siemka m?cze sie z tym ju? godzinke .. dopiero sie ucze LUA i chce zrobi? takie cos ze jezeli gracz wejdzie w marker pokazuje mu gui w kt?rym bedzie m?gl np kupi? co? powiedzmy hamburger - i aby po zakupie bra?o mu pieniadze i dodawa?o HP jedyne co uda?o mi sie osiagn?c to zrobienie gui z podpisami ...

1. stworzy? marker ( m?j nie dzia?a )
2. ustawic aby za kupno zabiera?o pieniadze
3. i dodawa?o hp ..
4, oraz zrobic tak aby gui pokazywa?o sie po wejsciu w marker a nie odrazu po odpaleniu skryptu

pomo?e kto? ?

tutaj ss tego co mi wysz?o

https://imgur.com/a/mXpkZwh


a tutaj kod

local GUI_START = createMarker (-212.72344970703, 979.70648193359, 19.329460144043, "cylinder", 1, 255, 255, 255)

    local Panel = guiCreateWindow(600, 300, 336, 207, "Automat z napojami", false)
    guiWindowSetSizable(Panel, false)

     local AddKamizelka = guiCreateButton(9, 31, 137, 67, "Cola +5 HP ", false, Panel)
     local AddUSPs = guiCreateButton(207, 36, 119, 62, "Lipton + 7 HP", false, Panel)
     local AddM4A1S = guiCreateButton(9, 121, 137, 76, "mountain dew + 10 HP ", false, Panel)
     local AddAK47 = guiCreateButton(203, 116, 123, 81, "red bull + 12 HP", false, Panel)  

     

function Open_panel ()
      guiSetVisible(Panel, true)
     showCursor (true)
end
addEventHandler ("onClientMarkerHit", GUI_START, Open_panel)

function Close_panel ()
     guiSetVisible (Panel, false)
     showCursor (false)
end
addEventHandler ("onClientMarkerLeave", GUI_START, Close_panel) 


je?eli kto? m?g? by zrobi? to i da? gotowy kod by? bym wdzieczny oraz stawiam Piwko i respekt

Komentarz Barcioo dodany 2018-05-26, 21:27Dodaje tag Lua [.lua]kod[./lua]
Ostatnio zmieniony przez Barcioo 2018-05-26, 21:26, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:05


awfesa







Wiek: 29
Na forum: 4846 dni
Posty: 563

Piwa: 223

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

Kod najlepiej dawa? w tagu [lua.][/lua.] (bez kropek)

Nie sprawdza?em wi?c mo?e co? by? nie tak i polecam zrobi? jeszcze jeden button do wy??czania gui, bo jak mamy pokazany kursor to nie mo?na chodzi? postaci?.

Trzeba jeszcze uzupe?ni? do ma si? wykona? gdy gracz kliknie w button.


local GUI_START = createMarker (-212.72344970703, 979.70648193359, 19.329460144043, "cylinder", 1, 255, 255, 255) 

local Panel = guiCreateWindow(600, 300, 336, 207, "Automat z napojami", false) 
guiWindowSetSizable(Panel, false) 

local AddKamizelka = guiCreateButton(9, 31, 137, 67, "Cola +5 HP ", false, Panel) 
local AddUSPs = guiCreateButton(207, 36, 119, 62, "Lipton + 7 HP", false, Panel) 
local AddM4A1S = guiCreateButton(9, 121, 137, 76, "mountain dew + 10 HP ", false, Panel) 
local AddAK47 = guiCreateButton(203, 116, 123, 81, "red bull + 12 HP", false, Panel) 
guiSetVisible(Panel, false)

addEventHandler("onClientGUIClick",AddKamizelka,
function()
    -- co ma si? dzia? gdy gracz kliknie Cola +5 HP
end,false)

addEventHandler("onClientGUIClick",AddUSPs,
function()
    -- co ma si? dzia? gdy gracz kliknie Lipton + 7 HP
end,false)

addEventHandler("onClientGUIClick",AddM4A1S,
function()
    -- co ma si? dzia? gdy gracz kliknie mountain dew + 10 HP   
end,false)

addEventHandler("onClientGUIClick",AddAK47,
function()
    -- co ma si? dzia? gdy gracz kliknie Cola red bull + 12 HP   
end,false)




function Open_panel () 
    guiSetVisible(Panel, true) 
    showCursor (true) 
end 
addEventHandler ("onClientMarkerHit", GUI_START, Open_panel) 

function Close_panel () 
    guiSetVisible (Panel, false) 
    showCursor (false) 
end 
addEventHandler ("onClientMarkerLeave", GUI_START, Close_panel) 


Podpis

Cokolwiek robicie w swoim życiu, nie będzie to legendarne,
jeżeli wasi przyjaciele nie będą mogli tego zobaczyć.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:07


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

do tego musisz wykona? trigger do serwera, aby pobra? graczowi pieni?dze (pieni?dze pobrane po cside nie synchronizuj? si?).

Podpis
Pomogłem Ci
? Może zostawiłbyś za to piwko, lub respekt? Dzięki!
Mój projekt:
?
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:12


jagoreq







Wiek: 24
Na forum: 3362 dni
Posty: 221
Nick w MP: dwd

Piwa: 18

Respekt: 66,3

Ostrzeżeń: 20%
Tutaj nie rozdajemy gotowc?w.

1. https://wiki.multitheftauto.com/wiki/PL/createMarker
2. i 3. eventHandler onClientGuiClick + takePlayerMoney oraz setElementHealth
4. Zmienna na false (np. local panel = false) i daj to pod onClientRender, je?eli panel == true to pokazuje gui, a je?eli panel == false to nie pokazuje. Jak kto? wejdzie w marker to panel = true, a je?eli wyjdzie to panel = false.

Sorki inaczej nie umiem wyt?umaczy?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:12


guciopl5







Wiek: 23
Na forum: 3287 dni
Posty: 86
Nick w MP: Whit3

Piwa: 8

Respekt: 45,3

[quote="awfesa"][/quote] teraz nie pokazuje ani gui ani markera

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:14


awfesa







Wiek: 29
Na forum: 4846 dni
Posty: 563

Piwa: 223

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

wpisz /debugscript 3 i poka? jaki b??dy ci wy?wietla podczas startu skryptu


Odpali?em swoje "zakurzone" MTA i u mnie normalnie pokazuje si? marker i po wej?ciu w niego otwiera si? gui

Podpis

Cokolwiek robicie w swoim życiu, nie będzie to legendarne,
jeżeli wasi przyjaciele nie będą mogli tego zobaczyć.
Ostatnio zmieniony przez awfesa 2018-05-26, 21:25, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:24


guciopl5







Wiek: 23
Na forum: 3287 dni
Posty: 86
Nick w MP: Whit3

Piwa: 8

Respekt: 45,3

chwilke cos mi sie popsu?o nie w?acza tego ,, zrobie reinstal mta

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:25


jagoreq







Wiek: 24
Na forum: 3362 dni
Posty: 221
Nick w MP: dwd

Piwa: 18

Respekt: 66,3

Ostrzeżeń: 20%
Markera tam nie ma bo poda?e? z?e koordynaty i marker robi si? w Fort Carson.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:52


Barcioo

Kiedyś to było ST






Wiek: 26
Na forum: 4189 dni
Posty: 458
Nick w MP: Bartek.

Piwa: 1892

Respekt: 460
Respekt: 460

guciopl5, Polecam jak robisz gui to w??czy? reative masz tu przyk?adowy kod kt?ry zrobi?em na szybko


markeradd= createMarker (x,y,z, "cylinder", 1, 255, 255, 255) 

Panel = guiCreateWindow(600, 300, 336, 207, "Automat z napojami", false) 
guiWindowSetSizable(Panel, false) 
button= {}

 button.AddKamizelka = guiCreateButton(9, 31, 137, 67, "Cola +5 HP ", false) 
button.AddUSPs = guiCreateButton(207, 36, 119, 62, "Lipton + 7 HP", false) 
button.AddM4A1S = guiCreateButton(9, 121, 137, 76, "mountain dew + 10 HP ", false) 
button.AddAK47 = guiCreateButton(203, 116, 123, 81, "red bull + 12 HP", false) 
guiSetVisible(Panel, false)
guiSetVisible(button.AddKamizelka, false)
guiSetVisible(button.AddUSPs, false)
guiSetVisible(button.AddM4A1S,false)
guiSetVisible(button.AddAK47,false)




addEventHandler("onClientMarkerHit",markeradd,function(he,md)
    --if he == localPlayer and getElementType(he) == "player" then else return end -- je?li ?eby by?o bez pojazdu 
    guiSetVisible(Panel, true)
guiSetVisible(button.AddKamizelka, true)
guiSetVisible(button.AddUSPs, true)
guiSetVisible(button.AddM4A1S,true)
guiSetVisible(button.AddAK47,true)
showCursor(true,false)
end)


addEventHandler("onClientMarkerLeave",markeradd,function(he,md)
guiSetVisible(Panel, false)
guiSetVisible(button.AddKamizelka, false)
guiSetVisible(button.AddUSPs, false)
guiSetVisible(button.AddM4A1S,false)
guiSetVisible(button.AddAK47,false)

end)



addEventHandler("onClientGUIClick",root,function ()
   if button.AddKamizelka == true then 
     setElementHealth ( localPlayer, getElementHealth(localPlayer) + 7 ) 
     triggerServerEvent ("Cash", localPlayer, "take", 50)
   elseif button.AddUSPs == true then 
    setElementHealth ( localPlayer, getElementHealth(localPlayer) + 5 ) 
    elseif button.AddM4A1S == true then 
      -- i tu reszte funkcja hp + hajs
  end
end)



-- to funkcje dajesz po stronie serwera 
addEvent("Cash", true)
addEventHandler("Cash", root, function(interakcja, ilosc)
if tostring(interakcja) and tonumber(ilosc) then
    if interakcja == "take" then
        takePlayerMoney(client,ilosc)
    elseif interakcja == "give" then
        givePlayerMoney(client,ilosc)
    end
end
end)


Podpis
Kanał Youtube;
A tu zapraszam
, pomogłem Ci? Wynagrodź mnie :piwo: :)


SUPPORT TEAM- 2016-09-03 do 2018-05-25
Test Mod- 2018-05-25
1k dni na Forum - 2018-01-28


GG: 62111935
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:56


guciopl5







Wiek: 23
Na forum: 3287 dni
Posty: 86
Nick w MP: Whit3

Piwa: 8

Respekt: 45,3

https://imgur.com/a/xcLL6H5 tylko to sie pokaza?o w debugscript 3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 21:59


Barcioo

Kiedyś to było ST






Wiek: 26
Na forum: 4189 dni
Posty: 458
Nick w MP: Bartek.

Piwa: 1892

Respekt: 460
Respekt: 460

guciopl5, je?li mo?esz pokaza? event kt?ry
ju? wiem


addEventHandler("onClientGUIClick",root,function ()
   if source == button.AddKamizelka  then 
     setElementHealth ( localPlayer, getElementHealth(localPlayer) + 7 ) 
     triggerServerEvent ("Cash", localPlayer, "take", 50)
   elseif source == button.AddUSPs then 
    setElementHealth ( localPlayer, getElementHealth(localPlayer) + 5 ) 
    elseif source ==  button.AddM4A1S  then 
      -- i tu reszte funkcja hp + hajs
  end
end)


Podpis
Kanał Youtube;
A tu zapraszam
, pomogłem Ci? Wynagrodź mnie :piwo: :)


SUPPORT TEAM- 2016-09-03 do 2018-05-25
Test Mod- 2018-05-25
1k dni na Forum - 2018-01-28


GG: 62111935
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 22:02


guciopl5







Wiek: 23
Na forum: 3287 dni
Posty: 86
Nick w MP: Whit3

Piwa: 8

Respekt: 45,3


local marker = createMarker ( 1929.5485839844 ,-1772.4442138672,13.546875-1 , "cylinder" , 0.8,255,255,0)


local Panel = guiCreateWindow(600, 300, 336, 207, "Automat z napojami", true) 
guiWindowSetSizable(Panel, true) 

local AddKamizelka = guiCreateButton(9, 31, 137, 67, "Cola +5 HP ", false, Panel) 
local AddUSPs = guiCreateButton(207, 36, 119, 62, "Lipton + 7 HP", false, Panel) 
local AddM4A1S = guiCreateButton(9, 121, 137, 76, "mountain dew + 10 HP ", false, Panel) 
local AddAK47 = guiCreateButton(203, 116, 123, 81, "red bull + 12 HP", false, Panel) 
guiSetVisible(Panel, false)

addEventHandler("onClientGUIClick",AddKamizelka,
function()

    -- co ma si? dzia? gdy gracz kliknie Cola +5 HP
end,false)

addEventHandler("onClientGUIClick",AddUSPs,
function()
    -- co ma si? dzia? gdy gracz kliknie Lipton + 7 HP
end,false)

addEventHandler("onClientGUIClick",AddM4A1S,
function()
    -- co ma si? dzia? gdy gracz kliknie mountain dew + 10 HP   
end,false)

addEventHandler("onClientGUIClick",AddAK47,
function()
    -- co ma si? dzia? gdy gracz kliknie Cola red bull + 12 HP   
end,false)




function Open_panel () 
    guiSetVisible(Panel, true) 
    showCursor (true) 
end 
addEventHandler ("onClientMarkerHit", GUI_START, Open_panel) 

function Close_panel () 
    guiSetVisible (Panel, false) 
    showCursor (false) 
end 
addEventHandler ("onClientMarkerLeave", GUI_START, Close_panel) 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 22:04


Barcioo

Kiedyś to było ST






Wiek: 26
Na forum: 4189 dni
Posty: 458
Nick w MP: Bartek.

Piwa: 1892

Respekt: 460
Respekt: 460

guciopl5, zobacz ten kod co ci da?em

Podpis
Kanał Youtube;
A tu zapraszam
, pomogłem Ci? Wynagrodź mnie :piwo: :)


SUPPORT TEAM- 2016-09-03 do 2018-05-25
Test Mod- 2018-05-25
1k dni na Forum - 2018-01-28


GG: 62111935
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 22:08


guciopl5







Wiek: 23
Na forum: 3287 dni
Posty: 86
Nick w MP: Whit3

Piwa: 8

Respekt: 45,3

nie wy?wietla mi gui

[ Dodano: 2018-05-26, 22:14 ]
zmieni?em teraz na co? takiego

local marker = createMarker ( 1929.5485839844 ,-1772.4442138672,13.546875-1 , "cylinder" , 0.8,255,255,0)


local Panel = guiCreateWindow(600, 300, 336, 207, "Automat z napojami", true) 
guiWindowSetSizable(Panel, true) 

local AddKamizelka = guiCreateButton(9, 31, 137, 67, "Cola +5 HP ", false, Panel) 
local AddUSPs = guiCreateButton(207, 36, 119, 62, "Lipton + 7 HP", false, Panel) 
local AddM4A1S = guiCreateButton(9, 121, 137, 76, "mountain dew + 10 HP ", false, Panel) 
local AddAK47 = guiCreateButton(203, 116, 123, 81, "red bull + 12 HP", false, Panel) 
guiSetVisible(Panel, false)

addEventHandler("onClientGUIClick",root,function ()
   if source == button.AddKamizelka  then 
     setElementHealth ( localPlayer, getElementHealth(localPlayer) + 5 ) 
     triggerServerEvent ("Cash", localPlayer, "take", 50)
   elseif source == button.AddUSPs then 
    setElementHealth ( localPlayer, getElementHealth(localPlayer) + 7 ) 
     triggerServerEvent ("Cash", localPlayer, "take", 50)
    elseif source ==  button.AddM4A1S  then 
    setElementHealth ( localPlayer, getElementHealth(localPlayer) + 10 ) 
     triggerServerEvent ("Cash", localPlayer, "take", 50)
    elseif source ==  button.AddAK47  then 
    setElementHealth ( localPlayer, getElementHealth(localPlayer) + 12 ) 
     triggerServerEvent ("Cash", localPlayer, "take", 50)

  end


function Open_panel () 
    guiSetVisible(Panel, true) 
    showCursor (true) 
end 
addEventHandler ("onClientMarkerHit", GUI_START, Open_panel) 

function Close_panel () 
    guiSetVisible (Panel, false) 
    showCursor (false) 
end 
addEventHandler ("onClientMarkerLeave", GUI_START, Close_panel) 
end)


[ Dodano: 2018-05-26, 22:14 ]
a jest przypisane ?e po wejsciu w marker ma wyswietlac gui ?\

Komentarz Barcioo dodany 2018-05-26, 22:09ustawiłeś x,y,z
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-26, 22:19


Barcioo

Kiedyś to było ST






Wiek: 26
Na forum: 4189 dni
Posty: 458
Nick w MP: Bartek.

Piwa: 1892

Respekt: 460
Respekt: 460

usu? button. je?li ca?ego kodu nie korzysta?e? z ca?ego mojego i local usu?

Podpis
Kanał Youtube;
A tu zapraszam
, pomogłem Ci? Wynagrodź mnie :piwo: :)


SUPPORT TEAM- 2016-09-03 do 2018-05-25
Test Mod- 2018-05-25
1k dni na Forum - 2018-01-28


GG: 62111935
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