isa_Khamdan Posted July 21, 2013 Share Posted July 21, 2013 Is it possible to block the use of F1 button inside a safe area? Link to comment
Castillo Posted July 21, 2013 Share Posted July 21, 2013 Only by editing the freeroam script. Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 Only by editing the freeroam script. and how can I do that? Link to comment
Castillo Posted July 21, 2013 Share Posted July 21, 2013 Well, you could make a check inside the function that shows the freeroam panel, to see if the player is in the safe zone or not, then don't show the panel. Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 Well, you could make a check inside the function that shows the freeroam panel, to see if the player is in the safe zone or not, then don't show the panel. links for examples please? Link to comment
Wei Posted July 21, 2013 Share Posted July 21, 2013 fr_client.lua: -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else -- add restriction here showCursor(true) showAllWindows() end end Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 fr_client.lua: -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else -- add restriction here showCursor(true) showAllWindows() end end Ok I found where do I put the codes but can you give me an example for the code cuz I am still new in coding Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 (edited) safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else showCursor(true) showAllWindows() else if safecol then if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() addEventHandler( "onColShapeHit", safecol, enterZone ) addEventHandler( "onPlayerJoin", safecol, enterZone ) function leaveZone(leavePlayer) if safecol then showCursor(true) showAllWindows() colorPicker.closeSelect() end end addEventHandler( "onColShapeLeave", safecol, leaveZone ) like this? Edited July 21, 2013 by Guest Link to comment
Wei Posted July 21, 2013 Share Posted July 21, 2013 safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else if (isElementWithinColShape(localPlayer, safecol)) then showCursor(true) showAllWindows() end end end Try that Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else if (isElementWithinColShape(localPlayer, safecol)) then showCursor(true) showAllWindows() end end end Try that Hmm , I think this will only make freeroam works inside the safe area? Link to comment
Wei Posted July 21, 2013 Share Posted July 21, 2013 safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else if (not isElementWithinColShape(localPlayer, safecol)) then showCursor(true) showAllWindows() end end end Sorry my bad, I didn't you you want to block it inside area... Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 not working players still can open the freeroam inside the safe area Link to comment
Wei Posted July 21, 2013 Share Posted July 21, 2013 safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) -- Line 1600 function toggleFRWindow() if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else if (isElementWithinColShape(localPlayer, safecol)) then showCursor(true) showAllWindows() end end end Try that That code worked for me... Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 then why it didn't work for me Link to comment
isa_Khamdan Posted July 21, 2013 Author Share Posted July 21, 2013 safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) these should be in the top of the script right? Link to comment
Castillo Posted July 21, 2013 Share Posted July 21, 2013 Post the content of fr_client.lua, the file you edited. Link to comment
isa_Khamdan Posted July 22, 2013 Author Share Posted July 22, 2013 (edited) Deleted Edited July 30, 2013 by Guest Link to comment
isa_Khamdan Posted July 22, 2013 Author Share Posted July 22, 2013 Else I have an error on the line 1362 , 1364 , 1365 can you fix them for me please? Link to comment
iMr.3a[Z]eF Posted July 22, 2013 Share Posted July 22, 2013 local safecol = createColCuboid ( -4114.1, -2998.8, 379.5, 70, 70, 70 ) local safeZone = createMarker ( 2244.20752, 498.09100, 11.70, "cylinder", 150, 0, 255, 0, 0 ) function guiCreateWindow(x2, y2, width2, height2, titleBarText2, relative2) local mainBackground = guiCreateStaticImage(x2, y2, width2, height2, "Nexus.png", relative2) local mainBackgroundLabel = guiCreateLabel(0, 0, 0, 0, titleBarText2, false, mainBackground2) guiSetEnabled(mainBackgroundLabel, false) return mainBackground end CONTROL_MARGIN_RIGHT = 25 LINE_MARGIN = 1 LINE_HEIGHT = 1 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Me = getLocalPlayer() server = createServerCallInterface() function skinInit() setControlNumber(wndSkin, "skinid", getElementModel(g_Me)) end function showSkinID(leaf) if leaf.id then setControlNumber(wndSkin, "skinid", leaf.id) end end function applySkin() local skinID = getControlNumber(wndSkin, "skinid") if skinID then server.setMySkin(skinID) fadeCamera(true) end end wndSkin = {"wnd"; text = "Skins", width = 250, x = -20, y = 0.3, controls = { {"lst"; id = "قائمة الشخصيات", width = 230, height = 290, columns = { {text = "إختيار الشخصيه", attr = "name"}}, rows = {xml = "skins.xml", attrs = {"id", "name"}}, onitemclick = showSkinID, onitemdoubleclick = applySkin}, {"txt"; id = "skinid", text = "", width = 50}, {"btn"; id = "موافق", onclick = applySkin}, {"btn"; id = "إغلاق", closeswindow = true}}, oncreate = skinInit} function setSkinCommand(cmd, skin) if tonumber(skin) then server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) end end addCommandHandler("setskin", setSkinCommand) addCommandHandler("ss", setSkinCommand) function applyAnimation(leaf) if type(leaf) ~= "table" then leaf = getSelectedGridListLeaf(wndAnim, "Animations") end if not leaf then return end server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true) end function stopAnimation() server.setPedAnimation(g_Me, false) end wndAnim = {"wnd"; text = "Animations", width = 250, x = -20, y = 0.3, controls = { {"lst"; id = "قائمة الحركات", width = 230, height = 290, columns = { {text = "الحركات", attr = "name"}}, rows = {xml = "animations.xml", attrs = {"name"}}, expandlastlevel = false, onitemdoubleclick = applyAnimation}, {"btn"; id = "موافق", onclick = applyAnimation}, {"btn"; id = "إيقاف", onclick = stopAnimation}, {"btn"; id = "إغلاق", closeswindow = true}}} addCommandHandler("anim", function(command, lib, name) server.setPedAnimation(g_Me, lib, name, true, true) end ) function addWeapon(leaf, amount) if type(leaf) ~= "table" then leaf = getSelectedGridListLeaf(wndWeapon, "weaplist") amount = getControlNumber(wndWeapon, "amount") if amount then end if amount then end return end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Tools', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Tools', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='Add', onclick=addWeapon}, {'btn', id='Close', closeswindow=true} } } addCommandHandler("setstyle", function(cmd, style) if style then style = tonumber(style) end if style then server.setPedFightingStyle(g_Me, style) end end ) function clothesInit() if getElementModel(g_Me) ~= 0 then errMsg("يجب أن تستخدم شخصية سي جي لكي تدخل إلى هذه القائمة") closeWindow(wndClothes) return end if not g_Clothes then triggerServerEvent("onClothesInit", g_Me) end end addEvent("onClientClothesInit", true) addEventHandler("onClientClothesInit", g_Root, function(clothes) g_Clothes = clothes.allClothes for i,typeGroup in ipairs(g_Clothes) do for j,cloth in ipairs(typeGroup.children) do if not cloth.name then cloth.name = cloth.model .. " - " .. cloth.texture end cloth.wearing = ((not clothes.playerClothes[typeGroup.type] or clothes.playerClothes[typeGroup.type].texture ~= cloth.texture or clothes.playerClothes[typeGroup.type].model ~= cloth.model) and false) end table.sort(typeGroup.children, function(a, b) return a.name < b.name end) end bindGridListToTable(wndClothes, "clothes", g_Clothes, false) end ) function clothListClick(cloth) setControlText(wndClothes, "addremove", cloth.wearing and "remove" or "add") end function applyClothes(cloth) if not cloth then cloth = getSelectedGridListLeaf(wndClothes, "clothes") end if not cloth then return end if cloth.wearing then cloth.wearing = false setControlText(wndClothes, "addremove", "add") server.removePlayerClothes(g_Me, cloth.parent.type) else local prevClothIndex = table.find(cloth.siblings, "wearing", true) if prevClothIndex then cloth.siblings[prevClothIndex].wearing = false end cloth.wearing = true setControlText(wndClothes, "addremove", "remove") server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type) end end wndClothes = {"wnd"; text = "Clothes", x = -20, y = 0.3, width = 350, controls = { {"lst"; id = "clothes", width = 330, height = 390, columns = { {text = "Clothes", attr = "name", width = 0.6}, {text = "Wearing", attr = "wearing", enablemodify = true, width = 0.3}}, rows = { {name = "Retrieving clothes list..."}}, onitemclick = clothListClick, onitemdoubleclick = applyClothes}, {"br"}, {"btn"; text = "Add", id = "addremove", width = 60, onclick = applyClothes}, {"btn"; id = "Close", closeswindow = true}}, oncreate = clothesInit} function addClothesCommand(cmd, type, model, texture) if type then type = tonumber(type) end if type and model and texture then server.addPedClothes(g_Me, texture, model, type) end end addCommandHandler("addclothes", addClothesCommand) addCommandHandler("ac", addClothesCommand) function removeClothesCommand(cmd, type) if type then type = tonumber(type) end if type then server.removePlayerClothes(g_Me, type) end end addCommandHandler("removeclothes", removeClothesCommand) addCommandHandler("rc", removeClothesCommand) function playerGravInit() triggerServerEvent("onPlayerGravInit", g_Me) end addEvent("onClientPlayerGravInit", true) addEventHandler("onClientPlayerGravInit", g_Root, function(curgravity) setControlText(wndGravity, "gravval", string.sub(tostring(curgravity), 1, 6)) end ) function selectPlayerGrav(leaf) setControlNumber(wndGravity, "gravval", leaf.value) end function applyPlayerGrav() local grav = getControlNumber(wndGravity, "gravval") if grav then server.setPedGravity(g_Me, grav) end closeWindow(wndGravity) end function setGravityCommand(cmd, grav) if grav then grav = tonumber(grav) end if grav then server.setPedGravity(g_Me, tonumber(grav)) end end addCommandHandler("setgravity", setGravityCommand) addCommandHandler("grav", setGravityCommand) wndGravity = {"wnd"; text = "Gravity", width = 300, controls = { Link to comment
isa_Khamdan Posted July 22, 2013 Author Share Posted July 22, 2013 (edited) Deleted Edited July 30, 2013 by Guest Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now