local screenW, screenH = guiGetScreenSize( )
-- safditems
GUIEditor = {
button = {},
window = {}
}
GUIEditor.window[1] = guiCreateWindow(0.39, 0.01, 0.22, 0.14, "Przedmioty w poje?dzie", true)
guiWindowSetSizable(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(0.07, 0.16, 0.85, 0.24, "Torba R1", true, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[2] = guiCreateButton(0.07, 0.41, 0.85, 0.24, "Nosze", true, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[3] = guiCreateButton(0.07, 0.65, 0.85, 0.24, "Deska Ortopedyczna", true, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA")
guiSetVisible(GUIEditor.window[1],false)
function isPlayerInFraction(plr,fractionname,checkduty)
if getElementData(plr,"temp:fraction") and getElementData(plr,"temp:fraction")==fractionname then
if not checkduty then
return true
else
if getElementData(plr,"temp:fractionduty") then
return true
end
end
end
return false
end
function canTakeItems()
for key, value in ipairs(getElementsByType( "colshape", resourceRoot ) ) do
if getElementData(value,"col:lsmcitems") then
if isElementWithinColShape( localPlayer, value ) then
if not isPedInVehicle( localPlayer ) then
if isPlayerInFraction(localPlayer,"Panstwowa Straz Pozarna",true) then
return true
end
end
end
end
end
return false
end
addEventHandler("onClientRender",root,function ()
if canTakeItems() then
if (not guiGetVisible(GUIEditor.window[1])) and (not getElementData(localPlayer,"lsmc:taking")) then
showCursor(true,false)
guiSetVisible(GUIEditor.window[1],true)
end
else
if guiGetVisible(GUIEditor.window[1]) or getElementData(localPlayer,"lsmc:taking") then
showCursor(false)
guiSetVisible(GUIEditor.window[1],false)
end
end
end)
addEventHandler("onClientGUIClick",resourceRoot,function ()
if source ~= GUIEditor.window[1] then
triggerServerEvent("onTryTakeLSMCItem",root,guiGetText(source))
end
end)