Wysłany: 2016-02-11, 20:36
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4261 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
Stw?rz marker (chyba wiesz jak ) i wklej ten kod co Ci wys?a?em i b?dzie lata? ^^ .
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-11, 20:40
TheGuruPolska
Wiek: 36 Na forum: 3767 dni Posty: 65
Nick w MP: TheGuru
Piwa : 47
Naucz si? dodawa? EVENTY:
addEventHandler("[NAZWA EVENTU]",[AGUMENTY/OPERATORZY],[NAZWA FUNKCJI]
Przyk?ad:
Strona serwera:
Kod: local jakismarker = createMakrer(3,0,3,"corona",255,255,0,255)
addEventHandler("onMarkerHit",jakismarker,funkcjaxdxd)
function funkcjaxdxd(hitElement)
triggerClientEvent(hitElement,"pokazOknoxd",hitElement)
end
Strona Clienta:
Kod: local okno = guiCreate....... itd tworzymy gui.....
addEvent("pokazOknoxd",true)
addEventHandler("pokazOknoxd",localPlayer,pokazgui)
function pokazgui()
guiSetVisible(okno,true)
showCursor(true)
end
I wystarczy.
Po stronie Clienta NIEDODAJESZ thePlayer ani player ani source. Zawsze jest LocalPlayer.
Masz poprawione:
Usu? wszystko i wklej to
Kod: local screenW, screenH = guiGetScreenSize()
okno = guiCreateWindow((screenW - 545) / 2, (screenH - 315) / 2, 545, 315, "Bilety", false)
guiWindowSetSizable(okno, false)
btt1 = guiCreateButton(68, 104, 161, 89, "Bilet do Los Santos - 750z?", false, okno)
guiSetProperty(btt1, "NormalTextColour", "FFAAAAAA")
btt2 = guiCreateButton(304, 104, 161, 89, "Bilet do Las Venturas - 800z?", false, okno)
guiSetProperty(btt2, "NormalTextColour", "FFAAAAAA")
btt3 = guiCreateButton(493, 279, 42, 26, "X", false, okno)
guiSetVisible(okno,false)
lsfm = createMarker (xx,xx,xx,"cylinder",xx,xx,xx)
function panell ()
showCursor(true)
guiSetVisible(okno,true)
end
addEventHandler("onClientMarkerHit",lsfm,panell)
addEventHandler("onClientGUIClick", btt1,
function()
takePlayerMoney(getLocalPlayer(), 750)
end)
addEventHandler("onClientGUIClick", btt3,
function()
guiSetVisible(okno,false)
showCursor(false)
end)
Nie by?o nawias?w w getLocalPlayer
Edit: Polecam zagl?da? do wiki.mtasa.com
Masz tam opisane jak u?ywa? funkcji oraz przyk?ady. Masz tam dos?ownie wszystko, wystrczy umie? czyta?.
[ Dodano : 2016-02-11, 20:48 ]
S-side:
Kod: local marker = createMarker(x,y,z,"cylinder",r,g,b,a)
addEventHandler("onMarkerHit",marker,
function(hitElement)
triggerClientEvent(hitElement,"pokazokno",hitElement)
end)
C-side:
Kod: local screenW, screenH = guiGetScreenSize()
local okno = guiCreateWindow((screenW - 545) / 2, (screenH - 315) / 2, 545, 315, "Bilety", false)
guiWindowSetSizable(okno, false)
btt1 = guiCreateButton(68, 104, 161, 89, "Bilet do Los Santos - 750z?", false, okno)
guiSetProperty(btt1, "NormalTextColour", "FFAAAAAA")
btt2 = guiCreateButton(304, 104, 161, 89, "Bilet do Las Venturas - 800z?", false, okno)
guiSetProperty(btt2, "NormalTextColour", "FFAAAAAA")
btt3 = guiCreateButton(493, 279, 42, 26, "X", false, okno)
guiSetVisible(okno,false)
addEvent("pokazokno",true)
addEventHandler("pokazokno",localPlayer,
function()
guiSetVisible(okno,true)
showCursor(true)
end)
addEventHandler("onClientGUIClick",btt1,
function()
if getPlayerMoney(localPlayer) >= 750 then
takePlayerMoney(localPlayer,750)
end
end)
addEventHandler("onClientGUIClick",btt2,
function()
if getPlayerMoney(localPlayer) >= 800 then
takePlayerMoney(localPlayer,800)
end
end)
addEventHandler("onClientGUIClick",btt3,
function()
guiSetVisible(okno,false)
showCursor(false)
end)
[ Dodano : 2016-02-11, 20:53 ]
Aha i jeszcze jedno. To co tworzysz po C-side jest widoczne tylko dla jednego gracza.
Je?li chcesz, ?eby wszytko by?o zsynchronizowane, to tw?rz funkcje po stronie Serwra, np markery.
Wysłany: 2016-02-11, 21:12
Axmell
E-Commerce
Wiek: 24 Na forum: 3810 dni Posty: 279
Nick w MP: %Axmell
Piwa : 224
TheGuruPolska , jak m?g?byc poprawic zeby kase zabiera?o by?oby git, dzi?ki za pomoc.
Wysłany: 2016-02-11, 22:19
Emm
***** ***
Wiek: 32 Na forum: 3880 dni Posty: 3191
Nick w MP: Emm
Piwa : 6162
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
"Axmell" napisał/a :TheGuruPolska , jak m?g?byc poprawic zeby kase zabiera?o by?oby git, dzi?ki za pomoc.
Aby zabiera?o kask?,
Podpis
Użytkownik : 20.10.2015r
GTAO Member : 06.03.2016r
Support-Team : 20.01.2016r
Moderator : 30.03.2016r
Mod-Team : 08.10.2016r
Vice Admin : 04.05.2018r
Administrator : 03.05.2022r
[you]
! Koniecznie zapoznaj się z
regulaminem forum .
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również
regulaminy działów , w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez
Administrację , przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w
tym dziale .
Najważniejsze informacje od
Administracji możesz przeczytać
tutaj oraz
tutaj .
Wysłany: 2016-02-11, 22:34
TheGuruPolska
Wiek: 36 Na forum: 3767 dni Posty: 65
Nick w MP: TheGuru
Piwa : 47
Jak masz takePlayerMoney(localPlayer,750) oraz takePlayerMoney(localPlayer,800) zamie? to na takePlayerMoney(750) i takePlayerMoney(800). Tak samo z getPlayerMoney(localPlayer) na getPlayerMoney(). Sorki za g?upi b??d.
Wysłany: 2016-02-12, 18:27
Axmell
E-Commerce
Wiek: 24 Na forum: 3810 dni Posty: 279
Nick w MP: %Axmell
Piwa : 224
local screenW , screenH = guiGetScreenSize ()
okno = guiCreateWindow (( screenW - 545 ) / 2 , ( screenH - 315 ) / 2 , 545 , 315 , "Bilety" , false )
guiWindowSetSizable ( okno , false )
btt1 = guiCreateButton ( 68 , 104 , 161 , 89 , "Bilet do Los Santos - 750z?" , false , okno )
guiSetProperty ( btt1 , "NormalTextColour" , "FFAAAAAA" )
btt2 = guiCreateButton ( 304 , 104 , 161 , 89 , "Bilet do Las Venturas - 800z?" , false , okno )
guiSetProperty ( btt2 , "NormalTextColour" , "FFAAAAAA" )
btt3 = guiCreateButton ( 493 , 279 , 42 , 26 , "X" , false , okno )
guiSetVisible ( okno , false )
lsfm = createMarker (- 1421.480078125 ,- 287.3623046875 , 13.1484375 , "cylinder" , 1.5 , 255 , 255 , 22 )
function panell ()
showCursor ( true )
guiSetVisible ( okno , true )
end
addEventHandler ( "onClientMarkerHit" , getRootElement (), panell )
addEventHandler ( "onClientGUIClick" , btt1 ,
function()
takePlayerMoney ( 750 )
setElementPosition ( source , 1683.4462890625 , - 2288.7822265625 , 13.511651039124 )
outputChatBox ( "Kupi?e? bilet do Los Santos za 750z?" , 255 , 255 , 22 )
guiSetVisible ( okno , false )
showCursor ( false )
end )
addEventHandler ( "onClientGUIClick" , btt2 ,
function()
takePlayerMoney ( 800 )
guiSetVisible ( okno , false )
showCursor ( false )
outputChatBox ( "Kupi?e? bilet do Las Venturas za 800z?" , 255 , 255 , 22 )
end )
addEventHandler ( "onClientGUIClick" , btt3 ,
function()
guiSetVisible ( okno , false )
showCursor ( false )
end )
Problem jest taki ?e ka?dy widzi GUI. Co doda??
Wysłany: 2016-02-12, 18:30
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4261 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
addEventHandler ( "onClientMarkerHit" , resourceRoot , panell )
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-12, 18:34
Axmell
E-Commerce
Wiek: 24 Na forum: 3810 dni Posty: 279
Nick w MP: %Axmell
Piwa : 224
Wicek7 , da?em w resourceRoot o "()" za du?o xD, dzi?ki, a jeszcze co dopisa? do setElementPosition ( x , y , z ) ?
Wysłany: 2016-02-12, 18:37
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4261 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
setElementPosition ( localPlayer , x , y , z )
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-12, 18:40
Axmell
E-Commerce
Wiek: 24 Na forum: 3810 dni Posty: 279
Nick w MP: %Axmell
Piwa : 224
Wicek7 , DZI?KI
[ Dodano : 2016-02-12, 18:46 ]
A co dopisa? gdy player nie ma 800$ to go nie tepa?
Wysłany: 2016-02-12, 19:04
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4261 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
local kasa = getPlayerMoney ( localPlayer )
if kasa >= 800 then
reszta_kodu
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-12, 19:10
Axmell
E-Commerce
Wiek: 24 Na forum: 3810 dni Posty: 279
Nick w MP: %Axmell
Piwa : 224
addEventHandler ( "onClientGUIClick" , btt2 ,
function()
local kasa = getPlayerMoney ( localPlayer )
if kasa >= 800 then
takePlayerMoney ( 800 )
setElementPosition ( localPlayer , 1695.4951171875 , 1447.4736328125 , 10.762579917908 )
guiSetVisible ( okno , false )
showCursor ( false )
outputChatBox ( "Kupi?e? bilet do Las Venturas za 800z?" , 255 , 255 , 22 )
end ) tak
Wysłany: 2016-02-12, 19:11
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4261 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
Dodaj jednego enda wi?cej.
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-12, 21:08
Emm
***** ***
Wiek: 32 Na forum: 3880 dni Posty: 3191
Nick w MP: Emm
Piwa : 6162
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Takie co?:
addEventHandler ( "onClientGUIClick" , btt2 ,
function()
local kasa = getPlayerMoney ( localPlayer )
if kasa >= 800 then
takePlayerMoney ( 800 )
setElementPosition ( localPlayer , 1695.4951171875 , 1447.4736328125 , 10.762579917908 )
guiSetVisible ( okno , false )
showCursor ( false )
outputChatBox ( "Kupi?e? bilet do Las Venturas za 800z?" , 255 , 255 , 22 )
else
outputChatBox ( "Nie sta? Ci? na bilet do Las Venturas!" , 255 , 255 , 22 )
end
end )
Podpis
Użytkownik : 20.10.2015r
GTAO Member : 06.03.2016r
Support-Team : 20.01.2016r
Moderator : 30.03.2016r
Mod-Team : 08.10.2016r
Vice Admin : 04.05.2018r
Administrator : 03.05.2022r
[you]
! Koniecznie zapoznaj się z
regulaminem forum .
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również
regulaminy działów , w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez
Administrację , przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w
tym dziale .
Najważniejsze informacje od
Administracji możesz przeczytać
tutaj oraz
tutaj .
Tagi: panelek
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: