Jump to content

Looktovask

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by Looktovask

  1. Marker_Aleatorios = -- ADICIONE AQUI OS LOCAIS QUE O JOGADOR DEVE PASSAR { {658.48792, -546.98334, 16.33594}, {-2124.44043, 208.22417, 35.22341}, {249.56505, 1420.55273, 10.56574}, {1427.32214, 708.58142, 10.82031}, -- AS MESMA POS DE CIMA PRA EVITAR SAIR O MESMO TODA HORA {658.48792, -546.98334, 16.33594}, {-2124.44043, 208.22417, 35.22341}, {249.56505, 1420.55273, 10.56574}, {1427.32214, 708.58142, 10.82031}, } Iniciar = createMarker ( -1867.4390869141,-1668.8072509766,21, "cylinder", 1.5, 16, 111, 231, 50) local BlipI = createBlipAttachedTo( Iniciar, 59 ) local Random_Pos = math.random ( #Marker_Aleatorios ) local Entrega = createMarker ( Marker_Aleatorios, "cylinder", 1.5, 16, 111, 231, 50) BlipEntrega = createBlipAttachedTo( Entrega, 0 ) setElementVisibleTo ( Entrega, root, false ) setElementVisibleTo ( BlipEntrega, root, false ) setElementData(BlipI,"blipName", "Emprego Sucateiro") setBlipVisibleDistance(BlipI, 150) --[[ ><><><><><><><><><><><><><><><><><><><>< >< Infos Trab >< ><><><><><><><><><><><><><><><><><><><>< --]] local Blip_Marcar = createBlipAttachedTo( Iniciar, 0 ) setElementVisibleTo ( Blip_Marcar, root, false ) function Infos_Emprego ( source ) local Emprego = getElementData ( source, "Emprego" ) if Emprego == "Sucateiro" then if isElementVisibleTo ( Blip_Marcar, source ) then setElementVisibleTo ( Blip_Marcar, source, false ) triggerClientEvent(source, "addNotification", root, " Seu Local de Trabalho foi Desmarcado do Mapa") else setElementVisibleTo ( Blip_Marcar, source, true ) triggerClientEvent(source, "addNotification", root, " Seu Local de Trabalho foi Marcado no Mapa") end end end addCommandHandler ( "infos", Infos_Emprego ) function Pegar_Pampa (source) local Emprego = getElementData ( source, "Emprego" ) if Emprego == "Sucateiro" then Bicicleta = createVehicle(509, -1867.4390869141,-1668.8072509766,21) warpPedIntoVehicle ( source, Bicicleta ) else triggerClientEvent(source, "addNotification", root, "INFO: Apenas Sucateiros podem pegar cargas", "info") end end addEventHandler("onMarkerHit", Iniciar, Pegar_Pampa) function Comecar_Sucata (source) local Emprego = getElementData ( source, "Emprego" ) if (Bicicleta) and Emprego == "Sucateiro" then setElementVisibleTo ( Entrega, source, true ) setElementData(source, "Carga", true) setElementVisibleTo ( BlipEntrega, sorce, true) else triggerClientEvent(source, "addNotification", root, "INFO: Apenas Sucateiros podem pegar cargas", "info") end end addEventHandler ("onVehicleEnter", root, Comecar_Sucata) local Recompensa = math.random(1000, 2000) function Entregar_Sucata local Emprego = getElementData (source, "Emprego") if getElementData(source, "Carga") == true then setElementVisibleTo (Entrega, source, false) setElementVisibleTo (BlipEntrega, source, false) setElementData(source, "Carga", false) givePlayerMoney(source, Recompensa) triggerClientEvent(source, "addNotification", root, "INFO: Você entregou a sucata e ganhou R$:"..getElementData(source, "Recompensa").."", "info") else triggerClientEvent(source, "addNotification", root, "INFO: Você não esta com a sucata na bicicleta, "info") end addEventHandler("onMarkerHit", Entrega, Entregar_Sucata) --[[ ><><><><><><><><><><><><><><><>< >< Anti_Bugs >< ><><><><><><><><><><><><><><><>< --]] addEventHandler( "onPlayerQuit", root,) function() if getElementData ( source, "Carga" ) == true then if isElement(Entrega) then destroyElement(Entrega) end if isElement(Bicicleta) then destroyElement(Bicicleta) end if isElement(BlipEntrega) then destroyElement(BlipEntrega) end end end) addEventHandler( "onPlayerWasted", root,) function() if getElementData ( source, "Carga" ) == true then if isElement(Entrega) then destroyElement(Entrega) end if isElement(Bicicleta) then destroyElement(Entrega) end if isElement(BlipEntrega) then destroyElement(BlipEntrega) end setElementData( source, "Carga", false ) end end) alguem pode me ajudar, esta linha 71, esta dando erro local Emprego = getElementData (source, "Emprego")
  2. cara eu fico ate com vergonha, mas era esse o problema mesmo, muito obrigado
  3. bom dia amigos, estou tentando adicionar novos empregos neste script, porem se adicono mais de 1 serviço ele não abre mais o menu, alguem poredia me ajudar para eu entender onde precisa ser editado? --[[ /\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\/ Curta a Minha Página <3 https://www.facebook.com/danilinmtascr/ ::::::::: ::: :::: ::: ::::::::::: ::: ::::::::::: :::: ::: :+: :+: :+: :+: :+:+: :+: :+: :+: :+: :+:+: :+: +:+ +:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ :+:+:+ +:+ +#+ +:+ +#++:++#++: +#+ +:+ +#+ +#+ +#+ +#+ +#+ +:+ +#+ +#+ +#+ +#+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ +#+#+# #+# #+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+#+# ######### ### ### ### #### ########### ########## ########### ### #### /\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\/ --]] local screenW,screenH = guiGetScreenSize() local resW,resH = 1366,768 local x,y = (screenW/resW), (screenH/resH) local Font_1 = dxCreateFont("font/font.ttf", y*11) local Font_2 = dxCreateFont("font/font1.ttf", y*11) local Font_3 = dxCreateFont("font/fontNick.ttf", y*10) local Font_4 = dxCreateFont("font/OpenSans-Bold.ttf", y*11) ------------- ############################################ ------------- ------------- # Edite aqui (Level, Habilitação) # ------------- ------------- ############################################ ------------- Trabalhos = { {"Pescaria", 0, "Nenhuma"}, -- Emprego, Level, Habilitação {"Lixeiro", 0, "Nenhuma"}, -- Emprego, Level, Habilitação {"Carregador", 5, "Nenhuma"}, -- Emprego, Level, Habilitação {"Sedex", 10, "B"}, -- Emprego, Level, Habilitação {"Pizzaboy", 15, "A"}, -- Emprego, Level, Habilitação {"Uber", 20, "B"}, -- Emprego, Level, Habilitação {"Caminhoneiro", 25, "D"}, -- Emprego, Level, Habilitação {"Mecanico", 35, "C"} {"Mineirador", 50, "Nenhuma"} {"Detran", 70, "C"} {"SAMU", 100, "C"} {"PMESP", 200, "Nenhuma"} {"PRF", 300, "Nenhuma"} } --===================================-- ------------- Abrir/Fechar ------------ --===================================-- function Abrir_agencia () if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then return end showCursor(true) ListaTrabalhos:SetVisible(true) addEventHandler("onClientRender", root, Dx_Agencia) end addEvent("AG:Abrir", true) addEventHandler("AG:Abrir", root, Abrir_agencia) function CloseAgencia () if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then showCursor(false) ListaTrabalhos:SetVisible(false) removeEventHandler("onClientRender", root, Dx_Agencia) end end --=======================================-- ------------- Interface Painel ------------ --=======================================-- function Dx_Agencia () exports["Blur"]:dxDrawBluredRectangle(x*488, y*138, x*391, y*491, tocolor(255, 255, 255, 255)) dxDrawRectangle(x*488, y*138, x*391, y*491, tocolor(0, 0, 0, 170), false) dxDrawRectangle(x*489, y*138, x*391, y*38, tocolor(0, 0, 0, 212), false) dxDrawLine(x*488, y*176, x*880, y*176, tocolor(16, 111, 231, 255), x*2, false) dxDrawText("Agencia de Empregos", x*621, y*146, x*746, y*161, tocolor(255, 255, 255, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage(x*500, y*494, x*366, y*37, "Img/botao.png", 0, 0, 0, CorEmprego, false) dxDrawText("Pegar Emprego", x*639, y*502, x*729, y*519, tocolor(0, 0, 0, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) CorEmprego = tocolor(16, 111, 231, 170) if isCursorOnElement(x*500, y*494, x*366, y*37) then CorEmprego = tocolor(16, 111, 231, 200) end dxDrawImage(x*500, y*538, x*366, y*37, "Img/botao.png", 0, 0, 0, CorDemissao, false) dxDrawText("Pedir Demissão", x*640, y*546, x*726, y*563, tocolor(0, 0, 0, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) CorDemissao = tocolor(16, 111, 231, 170) if isCursorOnElement(x*500, y*538, x*366, y*37) then CorDemissao = tocolor(16, 111, 231, 200) end dxDrawImage(x*500, y*582, x*366, y*37, "Img/botao.png", 0, 0, 0, CorSair, false) dxDrawText("Sair Agencia", x*650, y*590, x*719, y*609, tocolor(0, 0, 0, 255), 1.00, Font_1, "left", "top", false, false, false, false, false) CorSair = tocolor(16, 111, 231, 170) if isCursorOnElement(x*500, y*582, x*366, y*37) then CorSair = tocolor(16, 111, 231, 200) end end --================================-- ------------- GridTable ------------ --================================-- addEventHandler("onClientResourceStart", resourceRoot, function () ListaTrabalhos = dxGridW:Create(494, 183, 379, 302) ListaTrabalhos:AddColumn("Emprego", 140) ListaTrabalhos:AddColumn("Level", 105) ListaTrabalhos:AddColumn("Habilitação", 120) ListaTrabalhos:SetVisible(false) for i,v in ipairs (Trabalhos) do ListaTrabalhos:AddItem(1, tostring(v[1])) ListaTrabalhos:AddItem(2, tostring(v[2])) ListaTrabalhos:AddItem(3, tostring(v[3])) end end) --=============================-- ------------- Clicks ------------ --=============================-- function Pegar_Trabalho ( _,state ) if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then if state == "down" then if isCursorOnElement(x*500, y*582, x*366, y*37) then -- Fechar Agencia CloseAgencia () end if isCursorOnElement(x*500, y*494, x*366, y*37) then -- Pegar Emprego if ListaTrabalhos:GetSelectedItem() > -1 then local Trab = ListaTrabalhos:GetItemDetails(1, ListaTrabalhos:GetSelectedItem()) local Level = ListaTrabalhos:GetItemDetails(2, ListaTrabalhos:GetSelectedItem()) local Hab = ListaTrabalhos:GetItemDetails(3, ListaTrabalhos:GetSelectedItem()) playSoundFrontEnd(12) triggerServerEvent("DNL:Pegar_Emprego", root, localPlayer, Trab, Level, Hab) else triggerEvent("addNotification", root, "INFO: Selecione o Emprego que Você Deseja Trabalhar", "info") end elseif isCursorOnElement(x*500, y*538, x*366, y*37) then -- Demissão playSoundFrontEnd(12) triggerServerEvent("DNL:Pedir_Demissao", root, localPlayer) end end end end addEventHandler ( "onClientClick", root, Pegar_Trabalho ) --=============================-- ------------- IGNORA ------------ --=============================-- --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- addEventHandler("onClientKey", root, function (button, press) if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Agencia) then if button == "F1" or button == "F2" or button == "F3" or button == "F5" or button == "F6" or button == "F7" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "t" or button == "p" or button == "m" then cancelEvent() end end end ) --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- local x,y = guiGetScreenSize() function isCursorOnElement(x, y, w, h) if (not isCursorShowing()) then return false end local mx, my = getCursorPosition() local fullx, fully = guiGetScreenSize() cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- script do painel dx --[[*************************************************************************--]] --[[****************DX IGNORA***************--]] --[[*************************************************************************--]] local font = dxCreateFont("font/font.ttf", 10) local font2 = dxCreateFont("font/font.ttf", 11) --[[************************************************************************* * * PROJECT: dxGridWlists * DEVELOPERS: t3wz < github.com/t3wz > * VERSION: 1.2 * * YOU AREN'T ALLOWED TO SELL THIS SCRIPT OR REMOVE THE AUTHOR'S NAME * EVEN IF YOU MADE SEVERAL CHANGES ! * ****************************************************************************]] dxGridW = { items = {} }; local cursorOn; local NATIVE_RESOLUTION = { 1366, 768 } -- put your screen resolution here to fit the gridlists to all resolutions (ex: { 1366, 768 } ) if ( table.maxn ( NATIVE_RESOLUTION ) == 2 ) then FIT_MODE = true RES = { guiGetScreenSize() }; X,Y = RES[1] / NATIVE_RESOLUTION[1], RES[2] / NATIVE_RESOLUTION[2]; SCALE = ( 1 / NATIVE_RESOLUTION[1] ) * RES[1]; end --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Core - functions function dxGridW:Create ( x, y, width, height, postGUI ) -- table dxGridW:Create ( int x, int y, int width, int height[, bool postGUI ] ) if __checkParams ( "Create", "nnnn", x, y, width, height ) then local data = { x = FIT_MODE and ( x * X ) or x; -- X position y = FIT_MODE and ( y * Y ) or y; -- Y position w = FIT_MODE and ( width * X ) or width; -- Width h = FIT_MODE and ( height * Y ) or height; -- Height pg = postGUI or false; -- PostGUI i = {}; -- Items mi = __calcMaxItems ( FIT_MODE and ( height * Y ) or height ); -- Max items s = 1; -- Scroll Level r = -1; -- Row count se = -1; -- Selected item mo = nil; -- Mouse-on item vis = true -- Visible }; setmetatable ( data, { __index = dxGridW } ); table.insert ( dxGridW.items, data ); return data; end end function dxGridW:Destroy () -- bool dxGridW:Destroy () for k, v in pairs ( dxGridW.items ) do if v == self then dxGridW.items[k] = nil; return true; end end return false; end function dxGridW:SetVisible ( visible ) -- bool Gridlist:SetVisible ( bool state ) if __checkParams ( "SetVisible", "b", visible ) then self.vis = visible return true else return false end end function dxGridW:IsVisible ( ) -- bool Gridlist:IsVisible() return self.vis end function dxGridW:AddColumn ( title, width ) -- int Gridlist:AddColumn ( string title, int width ) if __checkParams ( "AddColumn", "sn", title, width ) then local data = { info = { title = title, width = FIT_MODE and ( width * X ) or width } }; table.insert ( self.i, data ); return #self.i; end end function dxGridW:RemoveColumn ( columnIndex ) -- bool Gridlist:RemoveColumn ( int columnIndex ) if __checkParams ( "RemoveColumn", "n", columnIndex ) then self.i[columnIndex] = nil; -- Recalculate the highest item count local highest = -1; for _, v in ipairs ( self.i ) do if #v > highest then highest = ( #v - 1 ); end end self.r = highest; -- Recalculate the scroll level (if necessary) if ( ( ( self.s + self.mi ) - 2 ) == self.r ) then self.s = ( self.r - self.mi ) + 1; end return true end return false end function dxGridW:GetColumnCount () -- int Gridlist:GetColumnCount() return #self.i end function dxGridW:AddItem ( columnIndex, text, data, r, g, b ) -- int Gridlist:AddItem ( int columnIndex, string title[, mixed data, int r, int g, int b ] ) if __checkParams ( "AddItem", "ns", columnIndex, text ) then if self.i[columnIndex] then local tColor = __checkRGB ( r, g, b ) and { r, g, b } or { 255, 255, 255 }; table.insert ( self.i[columnIndex], { id = #self.i[columnIndex] + 1, text = tostring( text ), data = data, color = tColor } ); if #self.i[columnIndex] > self.r then self.r = #self.i[columnIndex]; end return #self.i[columnIndex]; end return false; end end function dxGridW:RemoveItem ( column, itemID ) -- bool Gridlist:RemoveItem ( int columnIndex, int itemIndex ) if __checkParams ( "RemoveItem", "nn", column, itemID ) then if self.i[column] and self.i[column][itemID] then -- Recalculate the highest item count if self.r == #self.i[column] then local highest = -1; for _, v in ipairs ( self.i ) do if #v > highest then highest = ( #v - 1 ); end end self.r = highest; end -- Recalculate the scroll level (if necessary) if ( ( ( self.s + self.mi ) - 2 ) == self.r ) then self.s = ( self.r - self.mi ) + 1; end -- Reset the selected item if necessary² if itemID == self.se then local newItem = self.se - 1 if newItem <= self.r then self.se = math.max ( 0, newItem ); else self.se = -1 end end table.remove ( self.i[column], itemID ); return true; end return false end end function dxGridW:GetItemCount ( columnID ) -- int Gridlist:GetItemCount ( int columnIndex ) if __checkParams ( "GetItemCount", "n", columnID ) then if self.i[columnID] then return #self.i[columnID] end return false end end function dxGridW:Clear () -- bool Gridlist:Clear() for k, v in ipairs ( self.i ) do self.i[k] = { info = v.info } end self.r = -1 self.se = nil -- Recalculate the scroll level self.s = 1; return true end function dxGridW:GetSelectedItem ( ) -- int Gridlist:GetSelectedItem () return self.se; end function dxGridW:SetSelectedItem ( itemID ) -- bool Gridlist:SetSelectedItem ( int itemIndex ) if __checkParams ( "SetSelectedItem", "n", itemID ) then if itemID <= self.r then self.se = itemID; return self.se == itemID; end return false; end end function dxGridW:GetItemDetails ( column, itemID ) -- string, mixed Gridlist:GetItemDetails ( int columnIndex, int itemIndex ) if __checkParams ( "GetItemDetails", "nn", columnID, itemID ) then if self.i[column] then if self.i[column][itemID] then return self.i[column][itemID].text, self.i[column][itemID].data end end return false end end --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Core - render/move addEventHandler ( "onClientRender", root, function ( ) -- Is there any gridlist to render? if #dxGridW.items > 0 then -- Loop through all grid lists for index, data in ipairs ( dxGridW.items ) do -- Is the gridlist visible? if data.vis then -- Draw the 'gridlist' itself dxDrawRectangle ( data.x, data.y, data.w, data.h, tocolor ( 0, 0, 0, 170 ), data.pg ); -- Draw the column bar dxDrawRectangle ( data.x, data.y, data.w, 30 % data.h, tocolor ( 0,0,0,170 ), data.pg ); -- Set cursorOn variable to the current gridlist, if it's selected cursorOn = nil if __isMouseInPosition ( data.x, data.y, data.w, data.h ) then cursorOn = index; end -- Check if there's any selected item local seeFrom = data.s; local seeTo = ( data.s + data.mi ) - 1; if data.se and data.se <= data.r and data.se >= seeFrom and data.se <= seeTo then local index = data.se - ( data.s - 1 ); local y2 = data.y + ( ( index - 1 ) * 25 ); -- Draw a rectangle to make it looks like selected dxDrawRectangle ( data.x, ( 30 % data.h ) + y2, data.w, 27, tocolor ( 16, 111, 231, 110 ), data.pg ); end -- Is there any column? if #data.i > 0 then local cWidth = 0 -- Loop through all columns for cIndex, cData in ipairs ( data.i ) do -- we'll go beyond the gridlist width with this column ? if ( ( cWidth + cData.info.width ) <= data.w ) then local x = data.x + cWidth; -- Draw the column title dxDrawText ( cData.info.title, x, data.y, cData.info.width + x, ( 30 % data.h ) + data.y, tocolor ( 255, 255, 255 ), FIT_MODE and ( 1 * SCALE ) or 1, font2, "center", "center", true, false, data.pg, true, false ); -- Reset the selected item cData.info.selected = -1; -- Is there any item ? if #cData > 0 then local seeFrom = data.s; local seeTo = ( data.s + data.mi ) - 1; -- Loop the items for iIndex = seeFrom, seeTo do -- There's a row with this index in the current column? if cData[iIndex] then local index = iIndex - ( data.s - 1 ); local y = data.y + ( index * 25 ); local y2 = data.y + ( ( index - 1 ) * 25 ); -- Check if cursor is on item position if __isMouseInPosition ( data.x, ( 30 % data.h ) + y2, data.w, 27 ) then -- Define the mouse-on variable data.mo = iIndex; end -- Draw the item text if cData[iIndex]["text"] == "separation" then -- dxDrawImage( x+150, y+15, 900, 2, "linea.png", 0,0,0 ,tocolor(255,255,255,105)) else dxDrawText ( cData[iIndex]["text"], x, y, cData.info.width + x, ( 35 % data.h ) + y, tocolor ( unpack ( cData[iIndex]["color"] ) ), FIT_MODE and ( 1 * SCALE ) or 1, font, "center", "center", false, false, data.pg, true, false ); end end end end cWidth = cWidth + cData.info.width; end end end end end end end , true, "low-5") -- addEventHandler ( "onClientKey", root, function ( button, press ) -- Is cursor showing? if isCursorShowing () then -- Is there any gridlist? if #dxGridW.items > 0 then -- Is there any selected gridlist? if cursorOn then -- We pressed the scroll? if press and #button > 6 then -- Does the gridlist requires scroll? if dxGridW.items[cursorOn].r > dxGridW.items[cursorOn].mi then -- Define some variables local index = cursorOn; local currentValue = dxGridW.items[index].s; local newValue = math.max ( 1, button == "mouse_wheel_down" and currentValue + 1 or button == "mouse_wheel_up" and currentValue - 1 or button == "arrow_u" and currentValue -1 or button == "arrow_d" and currentValue +1 ); -- Check if we have spent the row's limit with the new value if ( ( newValue + dxGridW.items[index].mi ) > dxGridW.items[index].r ) then newValue = ( dxGridW.items[index].r - dxGridW.items[index].mi ) + 1; end -- Set the new scroll level dxGridW.items[index].s = newValue; end elseif press and button == "mouse1" and dxGridW.items[cursorOn].mo then dxGridW.items[cursorOn].se = dxGridW.items[cursorOn].mo; end end end end end ) --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Useful function __calcMaxItems ( height ) for i = 0, 9999 do if ( ( ( i + 1 ) * 25 ) >= math.floor ( height ) ) then return ( ( ( i + 1 ) * 25 ) > math.floor ( height ) and ( i - 1 ) or i ); end end return false; end function __checkParams ( methodName, pattern, ... ) local cTable = { ["string"] = "s"; ["number"] = "n"; ["boolean"] = "b"; ["s"] = "string"; ["n"] = "number"; ["b"] = "boolean" }; if #pattern > table.maxn ( { ... } ) then local index = table.maxn ( { ... } ) == 0 and 1 or table.maxn ( { ... } ) + 1 return false, error ( "Bad Argument @ '"..methodName.."' [Expected "..cTable[ pattern:sub ( index, index ) ].." at argument "..index..", got none]" ) end for k, v in pairs ( { ... } ) do if cTable[ type ( v ) ] ~= pattern:sub ( k, k ) then return false, error ( "Bad Argument @ '"..methodName.."' [Expected "..cTable[ pattern:sub ( k, k ) ].." at argument "..k..", got "..( type ( v ) or "none" ).."]" ) end end return true; end function __checkRGB ( r, g, b ) -- Check if all parameters were passed if ( not r ) or ( not g ) or ( not b ) then return false; end for _, v in ipairs ( { r, g, b } ) do if ( type ( v ) ~= "number" ) or ( v < 0 ) or ( v > 255 ) then return false; end end return true; end function __isMouseInPosition ( x, y, w, h ) if not isCursorShowing() then return false end local res = { guiGetScreenSize() }; local cpos = { getCursorPosition() }; local fpos = { res[1] * cpos[1], res[2] * cpos[2] }; return ( fpos[1] >= x and fpos[1] <= x + w ) and ( fpos[2] >= y and fpos[2] <= y + h ) end --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==- local x,y = guiGetScreenSize() function isCursorOnElement(x, y, w, h) if (not isCursorShowing()) then return false end local mx, my = getCursorPosition() local fullx, fully = guiGetScreenSize() cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end --==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-
  4. resolvido, muito obrigado a todos script final function Pegar_Emprego (playerSource) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) -- get his account name local Emprego = getElementData ( playerSource, "Emprego" ) if Emprego == "Uber" then aclGroupAddObject (aclGetGroup("UBER"), "user."..accName) outputChatBox ("Parabéns! Agora você está trabalhando de UBER!", playerSource, 0, 255, 0,true) end end addEvent("DNL:Pegar_Emprego", true) addEventHandler("DNL:Pegar_Emprego", root, Pegar_Emprego) function Sair_ACL (playerSource) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then -- Does he have access to Admin functions? aclGroupRemoveObject (aclGetGroup("UBER"), "user."..accName) outputChatBox ("Você não está trabalhando de UBER!", playerSource, 0, 255, 0,true) end end addEvent("DNL:Pedir_Demissao", true) addEventHandler("DNL:Pedir_Demissao", root, Sair_ACL)
  5. se eu quiser fazer para que se o emprego for de uber na hora de selecionar no script da agencia seria desta forma? function Pegar_Emprego (source, Trab, Level, Hab) local Trabalho = getElementData ( source, "Emprego" ) or "Desempregado" local Habilicao = getElementData ( source, "DNL:Categoria("..Hab..")") local Level_Player = tonumber(getElementData(source, "Level")) or 0 local accName = getAccountName ( getPlayerAccount ( source ) ) if Level_Player >= tonumber(Level) then if Trabalho == Trab then triggerClientEvent(source, "addNotification", root, "INFO: Você Já Trabalha Como "..Trab.."", "info") return end if Habilicao == false then triggerClientEvent(source, "addNotification", root, "Erro: Você Não Tem Habilitação ("..Hab..") e Não Pode Trabalhar Como ("..Trab..")", "erro") return end setElementData ( source, "Emprego", Trab ) triggerClientEvent(source, "addNotification", root, "INFO: Você Agora Trabalha de "..Trab.."", "info") if Trabalho == "uber" then aclGroupAddObject (aclGetGroup("UBER"), "user."..accName) end else triggerClientEvent(source, "addNotification", root, "Erro: Seu Level é Muito Baixo e Você Não Pode Trabalhar Como "..Trab.."", "erro") end end addEvent("DNL:Pegar_Emprego", true) addEventHandler("DNL:Pegar_Emprego", root, Pegar_Emprego) --[[ ><><><><><><><><><><><><><><><><><><><>< >< Demissao Trabalho >< ><><><><><><><><><><><><><><><><><><><>< --]] function Pedir_Demissao (source) local Trabalho = getElementData ( source, "Emprego" ) or "Desempregado" if Trabalho == "Desempregado" then triggerClientEvent(source, "addNotification", root, "Erro: Você não está empregado para se demitir.", "erro") return end setElementData ( source, "Emprego", "Desempregado" ) triggerClientEvent(source, "addNotification", root, "Sucesso: Você Se Demitiu Do Emprego de "..Trabalho.."", "sucesso") end addEvent("DNL:Pedir_Demissao", true) addEventHandler("DNL:Pedir_Demissao", root, Pedir_Demissao)
  6. function Dar_ACL ( source ) local Emprego = getElementData ( source, "Emprego" ) if Emprego == "Uber" then if isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then aclGroupAddObject (aclGetGroup("UBER"), "user."..accName) else outputChatBox ("Error", playerSource, 0, 255, 0,true) end end end addEvent("DNL:Pegar_Emprego", true) addEventHandler("DNL:Pegar_Emprego", root, Dar_ACL) function Sair_ACL (playerSource) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then aclGroupRemoveObject (aclGetGroup("UBER"), "user."..accName) outputChatBox ("Você não está trabalhando de UBER!", playerSource, 0, 255, 0,true) end end addEvent("DNL:Pedir_Demissao", true) addEventHandler("DNL:Pedir_Demissao", root, Sair_ACL) daquela forma antes quando clicava em pegar emprego mesmo sem lvl suficiente movia para acl, tentei fazer com checagem de emprego pra dar a acl, mas não funcionou tbm
  7. function Pegar_Emprego (playerSource) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) -- get his account name if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then -- Does he have access to Admin functions? aclGroupAddObject (aclGetGroup("UBER"), "user."..accName) outputChatBox ("Parabéns! Agora você está trabalhando de UBER!", playerSource, 0, 255, 0,true) end end addEvent("DNL:Pegar_Emprego", true) addEventHandler("DNL:Pegar_Emprego", root, Pegar_Emprego) function Sair_ACL (playerSource) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then -- Does he have access to Admin functions? aclGroupRemoveObject (aclGetGroup("UBER"), "user."..accName) outputChatBox ("Você não está trabalhando de UBER!", playerSource, 0, 255, 0,true) end end addEvent("DNL:Pedir_Demissao", true) addEventHandler("DNL:Pedir_Demissao", root, Sair_ACL) o script ficou assim, porem mesmo se o player clicar em pegar emprego e não ter os requerimentos para o emrpego ele é movido para a ACL tentei fazer desta forma usando de baser um script da agencia, mas infelizmente não funcionou function Pegar_Emprego (playerSource, Trab, Level, Hab) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) -- get his account name local Habilicao = getElementData ( playerSource, "DNL:Categoria("..Hab..")") local Level_Player = tonumber(getElementData(playerSource, "Level")) or 0 if Emprego == "Uber" then then triggerClientEvent(playerSource, "addNotification", root, "INFO: Você Já Trabalha Como "..Trab.."", "info") return end if Habilicao == false then triggerClientEvent(playerSource, "addNotification", root, "Erro: Você Não Tem Habilitação ("..Hab..") e Não Pode Trabalhar Como ("..Trab..")", "erro") return end setElementData ( playerSource, "Emprego", Trab ) triggerClientEvent(playerSource, "addNotification", root, "INFO: Você Agora Trabalha de "..Trab.."", "info") if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then -- Does he have access to Admin functions? aclGroupAddObject (aclGetGroup("UBER"), "user."..accName) end end addEvent("DNL:Pegar_Emprego", true) addEventHandler("DNL:Pegar_Emprego", root, Pegar_Emprego) function Sair_ACL (playerSource) local accName = getAccountName ( getPlayerAccount ( playerSource ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then -- Does he have access to Admin functions? aclGroupRemoveObject (aclGetGroup("UBER"), "user."..accName) outputChatBox ("Você não está trabalhando de UBER!", playerSource, 0, 255, 0,true) end end addEvent("DNL:Pedir_Demissao", true) addEventHandler("DNL:Pedir_Demissao", root, Sair_ACL)
  8. maravilha funcionou perfeitamente, vou dar uma estudada sobre o recurso de teams do mta
  9. devo fechar antes do else? esta parte do type tbm não entendi bem, peguei de outro script, eu posso fazer com que no script da agencia eu retire o grupo acl quando pedir demissão, ou consigo neste script mesmo?
  10. alguem poderia me ajudar, não consigo fazer este script dar acl para quem pega o emprego function Pegar_Emprego (playerSource, commandName, accountName) if (type == "DNL:Pegar_Emprego") then aclGroupAddObject (aclGetGroup("UBER"), "user."..accountName) outputChatBox ("Parabéns! Agora você está trabalhando de UBER!", client, 0, 255, 0) elseif (type == "DNL:Pegar_Emprego") then if isObjectInACLGroup ("user."..accName, aclGetGroup ( "UBER" ) ) then aclGroupRemoveObject (aclGetGroup("UBER"), "user."..getAccountName (getPlayerAccount (client))) outputChatBox ("Você saiu do trabalho de UBER!", client, 0, 255, 0) else outputChatBox ("Você não está no trabalho de UBER!", client, 255, 30, 30) end end addEvent("DNL:Pegar_Emprego", true) addEventHandler("DNL:Pegar_Emprego", root, Pegar_Emprego) estou usando o mod de agencia do danilin. e este script esta separado para o emprego que adicionei de uber
×
×
  • Create New...