Wysłany: 2018-03-31, 14:41
fapster
Pseudol
Wiek: 22 Na forum: 4066 dni Posty: 67
Nick w MP: MopSKY
Piwa : 272
posiadam skrypt dzieki ktoremu mozna montowac swiatla, lecz gdy montuje to zabiera 3x wiecej pieniedzy niz podane w skrypcie, prosi?bym serdecznie o pomoc
Kod: local isVehicles=nil
local isColored={
-- Nazwa koloru, {r,g,b koloru}, cena
{"Light White", {255,255,255}, 1500},
{"Xenon Red", {255,0,0}, 10000},
{"Xenon Blue", {0,45,110}, 8000},
{"Xenon Yellow", {255,255,0}, 6000},
{"Xenon Green", {0,255,0}, 8500},
{"Xenon Blue x2", {48,213,200}, 8500},
{"Xenon Pink", {255,52,225}, 10000},
}
local wn={}
wn.window=guiCreateWindow(0.18, 0.19, 0.64, 0.62, "", true)
wn.grid=guiCreateGridList(0.03, 0.07, 0.62, 0.89, true, wn.window)
guiGridListAddColumn(wn.grid, "Kolor", 0.5)
guiGridListAddColumn(wn.grid, "Koszt", 0.5)
wn.btn_submit=guiCreateButton(0.67, 0.08, 0.31, 0.33, "Zamontuj", true, wn.window)
wn.btn_close=guiCreateButton(0.67, 0.63, 0.31, 0.33, "Zamknij", true, wn.window)
guiSetVisible(wn.window, false)
addEventHandler("onClientMarkerHit", resourceRoot, function(el,md)
if not md or el~=localPlayer then return end
local cs=getElementData(source, "marker:cuboid")
if not cs then return end
local job=getElementData(source,"marker:duty")
local ljob=getElementData(el,"player:duty")
if job ~= ljob then
outputChatBox("* Nie jeste? zatrudniony jako tuner.", 255, 0, 0)
return
end
local vehicles=getElementsWithinColShape(cs,"vehicle")
if #vehicles < 1 then
outputChatBox("* Na stanowisku monta?u nie ma ?adnego pojazdu.", 255, 0, 0)
return
end
if #vehicles > 1 then
outputChatBox("* Na stanowisku monta?u jest zbyt du?o pojazd?w.", 255, 0, 0)
return
end
if getElementHealth(vehicles[1]) < 900 then
outputChatBox("* Pojazd jest zbyt uszkodzony aby zamontowa? ?wiat?a.", 255, 0, 0)
return
end
isVehicles=vehicles[1]
showCursor(true,false)
guiGridListClear(wn.grid)
guiSetVisible(wn.window, true)
for i,v in ipairs(isColored) do
local row=guiGridListAddRow(wn.grid)
guiGridListSetItemText(wn.grid, row, 1, v[1], false, false)
guiGridListSetItemData(wn.grid, row, 1, v[2], false, false)
guiGridListSetItemColor(wn.grid, row, 1, v[2][1], v[2][2], v[2][3])
guiGridListSetItemData(wn.grid, row, 1, v[2], false, false)
guiGridListSetItemText(wn.grid, row, 2, v[3].." Eur", false, false)
guiGridListSetItemData(wn.grid, row, 2, v[3], false, false)
end
end)
addEventHandler("onClientMarkerLeave", resourceRoot, function(el,md)
if el~=localPlayer then return end
isVehicles=nil
showCursor(false)
guiSetVisible(wn.window, false)
end)
addEventHandler("onClientGUIClick", wn.btn_submit, function()
if not isVehicles then return end
selectedRow=guiGridListGetSelectedItem(wn.grid) or -1
if selectedRow < 0 then return end
local color=guiGridListGetItemData(wn.grid, selectedRow, 1)
local cost=tonumber(guiGridListGetItemData(wn.grid, selectedRow, 2))
if not cost then return end
if cost > getPlayerMoney(localPlayer) then
outputChatBox("* Nie posiadasz tyle got?wki.", 255, 0, 0)
return
end
triggerServerEvent("takePlayerMoney", localPlayer, cost)
triggerServerEvent("montazElementu", root, isVehicles, "swiatla", {color[1], color[2], color[3]}, cost)
end)
Wysłany: 2018-03-31, 14:43
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
Umie?? kod w znacznikach [lua] [ /lua]
Poka? kod ze strony clienta gdy? tam znajduje si? dalszy ci?g kodu od cen monta?u
Wysłany: 2018-03-31, 14:52
fapster
Pseudol
Wiek: 22 Na forum: 4066 dni Posty: 67
Nick w MP: MopSKY
Piwa : 272
Wysłany: 2018-03-31, 14:53
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
Pomyli?o mi si?. Mia?o by? od servera.
Wysłany: 2018-03-31, 14:54
fapster
Pseudol
Wiek: 22 Na forum: 4066 dni Posty: 67
Nick w MP: MopSKY
Piwa : 272
local stanowiskaSwiatla = {
stanowiskoDoherty ={
mpos ={ 2143.47 , - 2194.67 , 13.55 - 0.3 }, -- marker
cpos ={ 2136.86 , - 2186.06 , 13.55 , 3.20 }, -- cuboid
faction_id = tuner - ls , -- ( id ) frakcja kt ? ra b ? dzie mia ? a dost ? p
text = "Monta? ?wiate?"
},
}
for i , v in pairs ( stanowiskaSwiatla ) do
v . cuboid = createColCuboid ( unpack ( v . cpos ))
v . marker = createMarker ( v . mpos [ 1 ], v . mpos [ 2 ], v . mpos [ 3 ]- 0.60 , "cylinder" , 1.2 , 0 , 0 , 255 , 100 )
setElementData ( v . marker , "sn_faction" , v . faction_id )
setElementData ( v . marker , "sn_cs" , v . cuboid )
t = createElement ( "text" )
setElementData ( t , "name" , v . text )
setElementPosition ( t , v . mpos [ 1 ], v . mpos [ 2 ], v . mpos [ 3 ])
end
Wysłany: 2018-03-31, 15:00
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
W ogrpg-naprawapojazdow\c_naprawa.lua masz ustawienia dotycz?ce tych koszt?w.
if getElementData ( localPlayer , "player:duty" ) == "PSP" or getElementData ( localPlayer , "player:duty" ) == "SAPD" or getElementData ( localPlayer , "player:duty" ) == "SAMA" or getElementData ( localPlayer , "player:duty" ) == "SARH" then
triggerServerEvent ( "takePlayerMoney" , localPlayer , 0 )
outputChatBox ( '* Naprawiles wszystkie elementy w pojezdzie.' )
playSoundFrontEnd ( 46 )
triggerServerEvent ( "montazElementu" , root , isVehicles , "naprawa" , "all" , 0 )
else
triggerServerEvent ( "takePlayerMoney" , localPlayer , 200 )
outputChatBox ( '* Naprawiles wszystkie elementy w pojezdzie.' )
playSoundFrontEnd ( 46 )
triggerServerEvent ( "montazElementu" , root , isVehicles , "naprawa" , "all" , 0 )
setTimer (function()
refreshGUI ()
end , 200 , 2 )
end
end )
Wysłany: 2018-03-31, 15:15
fapster
Pseudol
Wiek: 22 Na forum: 4066 dni Posty: 67
Nick w MP: MopSKY
Piwa : 272
mam jeszcze jeden problem dotyczacy naprawy pojazd?w, gdy wchodze w marker nie pojawia sie gui , mam skin, prace itp
c_naprawa
--[[
Resource : OURGame
Developers : Split < split . programista @ gmail . com >
Copyright < split . programista @ gmail . com > 2015 - 2016
You have no right to use this code without my permission .
]]
local doFixed ={
{ "Silnik" , 1 , fn =function( veh ) if getElementHealth ( veh )>= 2040 then return true end ; return false end },
{ "Maska" , 2 , fn =function( veh ) if getVehicleDoorState ( veh , 0 )== 0 then return true end ; return false end },
{ "Baga?nik" , 3 , fn =function( veh ) if getVehicleDoorState ( veh , 1 )== 0 then return true end ; return false end },
{ "Drzwi lewy prz?d" , 4 , fn =function( veh ) if getVehicleDoorState ( veh , 2 )== 0 then return true end ; return false end },
{ "Drzwi prawy prz?d" , 5 , fn =function( veh ) if getVehicleDoorState ( veh , 3 )== 0 then return true end ; return false end },
{ "Drzwi lewy ty?" , 6 , fn =function( veh ) if getVehicleDoorState ( veh , 4 )== 0 then return true end ; return false end },
{ "Drzwi prawy ty?" , 7 , fn =function( veh ) if getVehicleDoorState ( veh , 5 )== 0 then return true end ; return false end },
{ "Szyba przednia" , 8 , fn =function( veh ) if getVehiclePanelState ( veh , 4 )== 0 then return true end ; return false end },
{ "Zderzak przedni" , 9 , fn =function( veh ) if getVehiclePanelState ( veh , 5 )== 0 then return true end ; return false end },
{ "Zderzak tylni" , 10 , fn =function( veh ) if getVehiclePanelState ( veh , 6 )== 0 then return true end ; return false end },
{ "?wiat?o lewe przednie" , 11 , fn =function( veh ) if getVehicleLightState ( veh , 0 )== 0 then return true end ; return false end },
{ "?wiat?a prawe przednie" , 12 , fn =function( veh ) if getVehicleLightState ( veh , 1 )== 0 then return true end ; return false end },
{ "?wiat?a lewe tylnie" , 13 , fn =function( veh ) if getVehicleLightState ( veh , 2 )== 0 then return true end ; return false end },
{ "?wiat?a prawe tylnie" , 14 , fn =function( veh ) if getVehicleLightState ( veh , 3 )== 0 then return true end ; return false end },
}
local doCosts ={ 50 , 20 , 20 , 15 , 15 , 15 , 15 , 40 , 10 , 10 , 20 , 20 , 20 , 20 }
local wm ={}
local isVehicles = nil
wm . window = guiCreateWindow ( 0.18 , 0.21 , 0.64 , 0.52 , "" , true )
guiWindowSetSizable ( wm . window , false )
guiSetVisible ( wm . window , false )
guiSetAlpha ( wm . window , 1.00 )
wm . gridlist = guiCreateGridList ( 0.01 , 0.07 , 0.97 , 0.75 , true , wm . window )
guiGridListAddColumn ( wm . gridlist , "Nazwa" , 0.5 )
guiGridListAddColumn ( wm . gridlist , "Koszt" , 0.5 )
guiGridListAddRow ( wm . gridlist )
wm . fixall = guiCreateButton ( 0.75 , 0.85 , 0.24 , 0.11 , "Napraw wszystko (1000 PLN)" , true , wm . window )
local function refreshGUI ()
if not isVehicles then return end
guiGridListClear ( wm . gridlist )
for i , v in pairs ( doFixed ) do
if v . fn ( isVehicles )== false then
local row = guiGridListAddRow ( wm . gridlist )
guiGridListSetItemText ( wm . gridlist , row , 1 , v [ 1 ], false , false )
guiGridListSetItemData ( wm . gridlist , row , 1 , i )
guiGridListSetItemText ( wm . gridlist , row , 2 , doCosts [ i ].. " PLN" , false , false )
guiGridListSetItemData ( wm . gridlist , row , 2 , doCosts [ i ])
end
end
end
local vehicles = getElementsWithinColShape ( cs , "vehicle" )
if #vehicles < 1 then
outputChatBox ( "* Na stanowisku monta?u nie ma ?adnego pojazdu." , 255 , 0 , 0 )
return
end
if #vehicles > 1 then
outputChatBox ( "* Na stanowisku monta?u jest zbyt du?o pojazd?w." , 255 , 0 , 0 )
return
end
--[[if getElementHealth ( vehicles [ 1 ]) > 990 then
outputChatBox ( "* Pojazd na stanowisku naprawczym jest sprawny." )
return
end ]]
showCursor ( true , false )
guiSetVisible ( wm . window , true )
isVehicles = vehicles [ 1 ]
guiGridListClear ( wm . gridlist )
for i , v in pairs ( doFixed ) do
if v . fn ( isVehicles )== false then
local row = guiGridListAddRow ( wm . gridlist )
guiGridListSetItemText ( wm . gridlist , row , 1 , v [ 1 ], false , false )
guiGridListSetItemData ( wm . gridlist , row , 1 , i )
guiGridListSetItemText ( wm . gridlist , row , 2 , doCosts [ i ].. " PLN" , false , false )
guiGridListSetItemData ( wm . gridlist , row , 2 , doCosts [ i ])
end
end
end )
addEventHandler ( "onClientMarkerLeave" , resourceRoot , function( el , md )
if el ~= localPlayer then return end
guiSetVisible ( wm . window , false )
isVehicles = nil
showCursor ( false )
end )
addEventHandler ( "onClientGUIClick" , wm . fixparts , function()
if not isVehicles or not isElement ( isVehicles ) then return end
selectedRow = guiGridListGetSelectedItem ( wm . gridlist ) or - 1
if selectedRow < 0 then return end
local cost = guiGridListGetItemData ( wm . gridlist , selectedRow , 2 )
if cost > getPlayerMoney ( localPlayer ) then
outputChatBox ( "* Nie masz tyle got?wki!" )
return
end
local part = guiGridListGetItemData ( wm . gridlist , selectedRow , 1 )
outputChatBox ( '* Naprawiles ' .. tostring ( getPartName ( doFixed , part )))
triggerServerEvent ( "takePlayerMoney" , localPlayer , cost )
triggerServerEvent ( "montazElementu" , root , isVehicles , "naprawa" , part , cost )
setTimer (function()
refreshGUI ()
end , 200 , 1 )
end )
addEventHandler ( "onClientGUIClick" , wm . fixall , function()
if not isVehicles or not isElement ( isVehicles ) then return end
if 200 > getPlayerMoney ( localPlayer ) then
outputChatBox ( "* Nie masz tyle got?wki!" )
return
end
local elementyDoNaprawy = 0
for i , v in pairs ( doFixed ) do
if v . fn ( isVehicles )== false then
elementyDoNaprawy = elementyDoNaprawy + 1
end
end
if elementyDoNaprawy == 0 then
outputChatBox ( '* Pojazd jest juz naprawiony.' )
return
end
triggerServerEvent ( "takePlayerMoney" , localPlayer , 200 )
outputChatBox ( '* Naprawiles wszystkie elementy w pojezdzie.' )
playSoundFrontEnd ( 46 )
triggerServerEvent ( "montazElementu" , root , isVehicles , "naprawa" , "all" , 0 )
setTimer (function()
refreshGUI ()
end , 200 , 2 )
end
end )
-- utils
function getPartName ( t , key )
for i , v in pairs ( t ) do
if v [ 2 ]== key then
return v [ 1 ]
end
end
end
fileDelete ( 'c_naprawa.lua' )
s_naprawa
--[[
Resource : OURGame
Developers : Split < split . programista @ gmail . com >
Copyright < split . programista @ gmail . com > 2015 - 2016
You have no right to use this code without my permission .
]]
stanowiskaNaprawcze = {
stanowiskoDoherty ={
mpos ={ 2154.89 , - 2188.14 , 13.55 }, -- marker
neyo ={ 2143.92 , - 2177.10 , 13.55 , 4 }, -- cuboid
text = "Naprawa pojazdu"
},
stanowiskoDoherty2 ={
mpos ={ 2151.53 , - 2191.93 , 13.55 }, -- marker
neyo ={ 2142.10 , - 2182.58 , 13.55 , 4 }, -- cuboid
text = "Naprawa pojazdu"
},
stanowiskoDoherty3 ={
mpos ={- 2050.36 , 175.59 , 28.85 }, -- marker
neyo ={- 2047.93 , 178.73 , 28.85 , 4 }, -- cuboid
text = "Naprawa pojazdu"
},
stanowiskoDoherty4 ={
mpos ={- 2050.13 , 167.12 , 28.84 }, -- marker
neyo ={- 2276.65 , - 133.46 , 35.32 , 4 }, -- cuboid
text = "Naprawa pojazdu"
},
stanowiskoDoherty5 ={
mpos ={- 2280.23 , - 129.39 , 35.32 }, -- marker
neyo ={- 2277.86 , - 131.76 , 35.32 , 4 }, -- cuboid
text = "Naprawa pojazdu"
},
}
for i , v in pairs ( stanowiskaNaprawcze ) do
v . cuboid = createColSphere ( v . neyo [ 1 ], v . neyo [ 2 ], v . neyo [ 3 ], v . neyo [ 4 ])
v . marker = createMarker ( v . mpos [ 1 ], v . mpos [ 2 ], v . mpos [ 3 ]- 1 , "cylinder" , 1.5 , 50 , 90 , 200 , 75 )
setElementData ( v . marker , "snn_faction" , v . faction_id )
setElementData ( v . marker , "snn_cs" , v . cuboid )
t = createElement ( "text" )
setElementData ( t , "name" , v . text )
setElementPosition ( t , v . mpos [ 1 ], v . mpos [ 2 ], v . mpos [ 3 ])
end
Wysłany: 2018-03-31, 15:22
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
B??dy w /debugscript 3 podczas wchodzenia?
Wysłany: 2018-03-31, 15:27
fapster
Pseudol
Wiek: 22 Na forum: 4066 dni Posty: 67
Nick w MP: MopSKY
Piwa : 272
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: