Wysłany: 2015-02-07, 18:30
Shogo12345
LuA
Wiek: 31 Na forum: 4182 dni Posty: 48
Nick w MP: Artux
Piwa : 504
Witam mam skrypt na urzad i mam skrypt na liste prac wchodze do urz?du potem do markera i wyswietla mi sie gui z lista prac,problem tkwi w tym ze nw jak dodac prace np mechanik,lakiernik
Za pomoc
Kod
--[[
Lista prac dorywczych
@ copyright 2013 - 2014 Split < split @ go - life . pl >
@ author Split < split @ go - life . pl >
@ version 1.0 beta
Nie masz prawa u ?? ywac tego kodu bez mojej zgody .
Napisz do mnie by ?& #8225; mo??e si?™ zgodz?™ na u??ycie kodu.
]]--
sx , sy = guiGetScreenSize ()
local listaprac = createMarker ( 358.24 , 179.71 , 1008.38 , "cylinder" , 1.5 , 0 , 0 , 0 , 0 , 0 )
setElementData ( listaprac , "urzad_miejsca" , 0 )
setElementDimension ( listaprac , 1636 )
setElementInterior ( listaprac , 3 )
pd_okno = guiCreateWindow ( 208 / 1280 * sx , 164 / 720 * sy , 886 / 1280 * sx , 403 / 720 * sy , "Lista prac dorywczych" , false )
guiWindowSetSizable ( pd_okno , false )
guiSetVisible ( pd_okno , false )
pd_gridlist = guiCreateGridList ( 10 / 1280 * sx , 29 / 720 * sy , 429 / 1280 * sx , 364 / 720 * sy , false , pd_okno )
pd_gridid = guiGridListAddColumn ( pd_gridlist , "ID" , 0.2 )
pd_gridpp = guiGridListAddColumn ( pd_gridlist , "Nazwa" , 0.2 )
pd_gridrep = guiGridListAddColumn ( pd_gridlist , "Reputacja" , 0.2 )
pd_gridfaction = guiGridListAddColumn ( pd_gridlist , "ID Frakcji" , 0.2 )
pd_gridmiejsca = guiGridListAddColumn ( pd_gridlist , "Miejsca" , 0.2 )
pd_wybierz = guiCreateButton ( 464 / 1280 * sx , 29 / 720 * sy , 398 / 1280 * sx , 135 / 720 * sy , "Zatrudnij si?™" , false , pd_okno )
pd_warning = guiCreateLabel ( 463 / 1280 * sx , 200 / 720 * sy , 399 / 1280 * sx , 16 / 720 * sy , "" , false , pd_okno )
guiLabelSetHorizontalAlign ( pd_warning , "center" , false )
guiLabelSetColor ( pd_warning , 245 , 0 , 0 )
pd_zwolnij = guiCreateButton ( 464 / 1280 * sx , 258 / 720 * sy , 398 / 1280 * sx , 135 / 720 * sy , "Zwolnij si?™" , false , pd_okno )
addEventHandler ( "onClientMarkerHit" , listaprac , function( el , md )
if el ~= localPlayer then return end
if guiGetVisible ( pd_okno ) == false then
showCursor ( true , false )
guiSetVisible ( pd_okno , true )
guiGridListClear ( pd_gridlist )
triggerServerEvent ( "onUrzadDataRequest" , root , el )
end
end )
addEventHandler ( "onClientMarkerLeave" , listaprac , function( el , md )
if el ~= localPlayer then return end
if guiGetVisible ( pd_okno ) == true then
showCursor ( false )
guiSetVisible ( pd_okno , false )
end
end )
addEvent ( "onUrzadDataReceived" , true )
addEventHandler ( "onUrzadDataReceived" , resourceRoot , function( result )
for i , v in ipairs ( result ) do
row = guiGridListAddRow ( pd_gridlist )
guiGridListSetItemText ( pd_gridlist , row , pd_gridid , v . id , false , false )
guiGridListSetItemData ( pd_gridlist , row , 1 , v . id )
guiGridListSetItemText ( pd_gridlist , row , pd_gridpp , v . nazwa , false , false )
guiGridListSetItemText ( pd_gridlist , row , pd_gridrep , v . reputacja , false , false )
guiGridListSetItemText ( pd_gridlist , row , pd_gridfaction , v . id_frakcji , false , false )
guiGridListSetItemText ( pd_gridlist , row , pd_gridmiejsca , "" .. v . miejsca .. "/15" , false , false )
guiGridListSetItemData ( pd_gridlist , row , 5 , v . miejsca )
end
end )
addEventHandler ( "onClientGUIClick" , pd_wybierz , function()
selectedRow = guiGridListGetSelectedItem ( pd_gridlist )
if selectedRow < 0 then return end
faction1 = getElementData ( localPlayer , "gracz_frakcja" )
reputation1 = getElementData ( localPlayer , "gracz_punkty" )
miejsca1 = guiGridListGetItemText ( pd_gridlist , selectedRow , pd_gridmiejsca )
reputation2 = guiGridListGetItemText ( pd_gridlist , selectedRow , pd_gridrep )
faction = guiGridListGetItemText ( pd_gridlist , selectedRow , pd_gridfaction )
miejsca2 = guiGridListGetItemData ( pd_gridlist , selectedRow , 5 )
id = guiGridListGetItemData ( pd_gridlist , selectedRow , 1 )
if 1 < faction1 then
guiSetText ( pd_warning , "Ju?? jeste?› w jakie?› frakcji." )
setTimer ( guiSetText , 2000 , 1 , pd_warning , "" )
return
end
if tonumber ( reputation1 ) < tonumber ( reputation2 ) then
guiSetText ( pd_warning , "Masz zby niskie GP aby rozpocz?…?‡ tu prac?™." )
setTimer ( guiSetText , 2000 , 1 , pd_warning , "" )
return
end
if miejsca1 == 15 then
guiSetText ( pd_warning , "W tej pracy nie ma wolnych miejsc." )
return
end
showCursor ( false )
guiSetVisible ( pd_okno , false )
outputChatBox ( "* Otrzymujesz prac?™ sta?‚?… kt??r?… wybra?‚e?›." )
setElementData ( localPlayer , "gracz_frakcja" , tonumber ( faction ))
triggerServerEvent ( "onUrzadDataUpdate" , root , localPlayer , true , id )
end )
addEventHandler ( "onClientGUIClick" , pd_zwolnij , function()
showCursor ( false )
guiSetVisible ( pd_okno , false )
outputChatBox ( "* Zwolni?‚e?› sie z pracy." )
setElementData ( localPlayer , "gracz_frakcja" , 0 )
triggerServerEvent ( "onUrzadDataUpdate" , localPlayer , false , id )
end )
Wysłany: 2015-02-07, 18:45
PanPrezes
Wiek: 32 Na forum: 4555 dni Posty: 63
Nick w MP: PanPrezes
Piwa : 979
Witaj, wystarczy?o doda? local listaPrac = {
{ 0 , "Lakiernik" , 100 , 3 },
{ 1 , "Mechanik" , 82 , 1 },
} poka?e ci jak ma to wygl?da? prosz?
--[[
Lista prac dorywczych
@ copyright 2013 - 2014 Split < split @ go - life . pl >
@ author Split < split @ go - life . pl >
@ version 1.0 beta
Nie masz prawa u ? ywac tego kodu bez mojej zgody .
Napisz do mnie by ? mo ? e si ? zgodz ? na u ? ycie kodu .
]]--
sx , sy = guiGetScreenSize ()
-- id , nazwa , od reputacji , id frakcji
local listaPrac = {
{ 0 , "Lakiernik" , 100 , 3 },
{ 1 , "Mechanik" , 82 , 1 },
}
local listaprac = createMarker ( 358.24 , 179.71 , 1008.38 , "cylinder" , 1.5 , 0 , 0 , 0 , 0 , 0 )
setElementDimension ( listaprac , 1636 )
setElementInterior ( listaprac , 3 )
pd_okno = guiCreateWindow ( 208 / 1280 * sx , 164 / 720 * sy , 886 / 1280 * sx , 403 / 720 * sy , "Lista prac dorywczych" , false )
guiWindowSetSizable ( pd_okno , false )
guiSetVisible ( pd_okno , false )
pd_gridlist = guiCreateGridList ( 10 / 1280 * sx , 29 / 720 * sy , 429 / 1280 * sx , 364 / 720 * sy , false , pd_okno )
pd_gridid = guiGridListAddColumn ( pd_gridlist , "ID" , 0.2 )
pd_gridname = guiGridListAddColumn ( pd_gridlist , "Nazwa" , 0.4 )
pd_gridreputation = guiGridListAddColumn ( pd_gridlist , "Reputacja" , 0.2 )
pd_factionid = guiGridListAddColumn ( pd_gridlist , "ID Frakcji" , 0.2 )
pd_wybierz = guiCreateButton ( 464 / 1280 * sx , 29 / 720 * sy , 398 / 1280 * sx , 135 / 720 * sy , "Zatrudnij si?" , false , pd_okno )
pd_warning = guiCreateLabel ( 463 / 1280 * sx , 200 / 720 * sy , 399 / 1280 * sx , 16 / 720 * sy , "" , false , pd_okno )
guiLabelSetHorizontalAlign ( pd_warning , "center" , false )
guiLabelSetColor ( pd_warning , 245 , 0 , 0 )
pd_zwolnij = guiCreateButton ( 464 / 1280 * sx , 258 / 720 * sy , 398 / 1280 * sx , 135 / 720 * sy , "Zwolnij si?" , false , pd_okno )
addEventHandler ( "onClientMarkerHit" , listaprac , function( el , md )
if el ~= localPlayer then return end
if guiGetVisible ( pd_okno ) == false then
showCursor ( true , false )
guiSetVisible ( pd_okno , true )
guiGridListClear ( pd_gridlist )
for i , v in ipairs ( listaPrac ) do
row = guiGridListAddRow ( pd_gridlist )
guiGridListSetItemText ( pd_gridlist , row , pd_gridid , v [ 1 ], false , false )
guiGridListSetItemText ( pd_gridlist , row , pd_gridname , v [ 2 ], false , false )
guiGridListSetItemText ( pd_gridlist , row , pd_gridreputation , v [ 3 ], false , false )
guiGridListSetItemText ( pd_gridlist , row , pd_factionid , v [ 4 ], false , false )
end
end
end )
addEventHandler ( "onClientMarkerLeave" , listaprac , function( el , md )
if el ~= localPlayer then return end
if guiGetVisible ( pd_okno ) == true then
showCursor ( false )
guiSetVisible ( pd_okno , false )
end
end )
addEventHandler ( "onClientGUIClick" , pd_wybierz , function()
dane = guiGridListGetSelectedItem ( pd_gridlist )
repu = getElementData ( localPlayer , "gracz_punkty" )
id = guiGridListGetItemText ( pd_gridlist , dane , pd_gridid )
frakcja = guiGridListGetItemText ( pd_gridlist , dane , pd_factionid )
reputacja = guiGridListGetItemText ( pd_gridlist , dane , pd_gridreputation )
if dane < 0 then return end
if tonumber ( 1 ) < getElementData ( localPlayer , "gracz_frakcja" ) then
guiSetText ( pd_warning , "Ju? jeste? w jakie? frakcji." )
return
end
if repu < tonumber ( reputacja ) then
guiSetText ( pd_warning , "Masz zbyt niskie GP aby rozpocz?? tu prac?." )
return
end
showCursor ( false )
guiSetVisible ( pd_okno , false )
outputChatBox ( "* Otrzymujesz sta?? prac?, t? kt?r? wybra?e?." )
setElementData ( localPlayer , "gracz_frakcja" , tonumber ( frakcja ))
end )
addEventHandler ( "onClientGUIClick" , pd_zwolnij , function()
if getElementData ( localPlayer , "gracz_frakcja" ) then
showCursor ( false )
guiSetVisible ( pd_okno , false )
outputChatBox ( "* Zwolni?e? si? z pracy." )
setElementData ( localPlayer , "gracz_frakcja" , 0 )
end
end ) Prosz? pomog?em daj piwo
a jeszcze takie propo pytanie czy ty masz zezwolenie na u?ywanie kodu?
Wysłany: 2015-02-07, 18:53
Shogo12345
LuA
Wiek: 31 Na forum: 4182 dni Posty: 48
Nick w MP: Artux
Piwa : 504
Dzieki ,tak mam
Tagi: lista :: prac :: [urzad]
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: