Jump to content

Duff1995

Members
  • Posts

    21
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Duff1995's Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. local Ped1 = createPed(1, 1370.398, -1291.019, 13.549, 0.529) --Após a cordenada de onde o ped irá ficar ex: 1370.398, -1291.019, 13.549 Adicione uma virgula e pegue a totação, você pode utilizar um resource para isso. duvidas: Stressado#0394
  2. local screenW,screenH = guiGetScreenSize() local resW, resH = 1600,900 local x, y = (screenW/resW), (screenH/resH) local screenWidth, screenHeight = guiGetScreenSize() local webBrowser = createBrowser(screenWidth, screenHeight, false, false) sx,sy = guiGetScreenSize() x,y = (sx/1366), (sy/768) messages = {} editBox = {} editBox.__index = editBox editBox.instances = {} function onClientResourceStart() tick = getTickCount() font = dxCreateFont("gfx/sans-pro-regular.ttf", 20) sound = playSound("sfx/music.mp3",true) g = {} g.user = editBox.new() g.user:setPosition(x*610,y*320,x*213,y*41) g.user.color = {79,86,94,160} g.user.font = font g.user.text = loadLoginFromXML() g.user.visible = true g.user.onInput = function() g.user.color = {87, 95, 104, 160} end g.user.onOutput = function() g.user.color = {79,86,94,160} end g.pass = editBox.new() g.pass:setPosition(x*610,y*390,x*213,y*41) g.pass.color = {79,86,94,160} g.pass.font = font g.pass.masked = true g.pass.visible = true g.pass.onInput = function() g.pass.color = {87, 95, 104, 160} end g.pass.onOutput = function() g.pass.color = {79,86,94,160} end g.rUser = editBox.new() g.rUser:setPosition(x*610,y*320,x*213,y*41) g.rUser.color = {79,86,94,160} g.rUser.font = font g.rUser.onInput = function() g.rUser.color = {87, 95, 104, 160} end g.rUser.onOutput = function() g.rUser.color = {79,86,94,160} end g.rPass = editBox.new() g.rPass:setPosition(x*610,y*390,x*213,y*41) g.rPass.color = {79,86,94,160} g.rPass.font = font g.rPass.masked = true g.rPass.onInput = function() g.rPass.color = {87, 95, 104, 160} end g.rPass.onOutput = function() g.rPass.color = {79,86,94,160} end showChat(false) showCursor(true) addEventHandler("onClientRender", root, paint) end addEventHandler("onClientResourceStart",resourceRoot,onClientResourceStart) function paint() local rh,ry = interpolateBetween(0, (y*559/2)+y*105, 0, y*559, y*105, 0, (getTickCount()-tick)/1400, "Linear") --dxDrawImage(0,0,sx,sy,"gfx/wallpaper.png") dxDrawImage(x*0, y*0, x*1600, y*900, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) if getTickCount()-tick > 1500 then local bColor = tocolor(6, 255, 0,200) if isMouseInPosition(x*552,y*450,x*262,y*44) then bColor = tocolor(6, 255, 0,200) end dxDrawImage(x*605,y*90,x*199,y*198,"gfx/logo.png",getTickCount()/100,0,0,tocolor(255,255,255,255)) if not inRegisterTab then dxDrawRectangle(x*562,y*320,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*570,y*325,x*33,y*31,"gfx/user.png") dxDrawRectangle(x*562,y*390,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*575,y*395,x*23,y*31,"gfx/pass.png") dxDrawRectangle(x*561,y*450,x*262,y*44,bColor) dxDrawBorder(x*561,y*450,x*262,y*44,tocolor(0,0,0,240),1.4) dxDrawText("Logar",x*561,y*450,x*552+x*262,y*450+y*44,tocolor(255,255,255),y*1,font,"center","center") dxDrawText([[Não tem uma conta? Crie aqui #00ff82Register.]],x*588,y*420,x*588+x*192,y*592+y*43,tocolor(255,255,255),y*0.6,font,"center","center",false,false,false,true) end for k,self in pairs(editBox.instances) do if self.visible then local px,py,pw,ph = self:getPosition() local text = self.masked and string.gsub(self.text,".","•") or self.text local alignX = dxGetTextWidth(text,self.scale,self.font) <= pw and "left" or "right" dxDrawRectangle(px, py, pw, ph, tocolor(unpack(self.color))) dxDrawText(text,px+x*5, py,px-x*5+pw, py+ph,tocolor(unpack(self.textColor)),self.scale,self.font,alignX,"center",true) if self.input and dxGetTextWidth(text,self.scale,self.font) <= pw then local lx = dxGetTextWidth(text,self.scale,self.font)+px+x*8 local lx = dxGetTextWidth(text,self.scale,self.font)+px+x*8 dxDrawLine(lx, py+y*10, lx, py+ph-y*10, tocolor(255,255,255,math.abs(math.sin(getTickCount()/300))*200), 2) end end end if not inRegisterTab then dxDrawBorder(x*561,y*320,x*262,y*41,tocolor(0,0,0,240),1) dxDrawBorder(x*561,y*390,x*262,y*41,tocolor(0,0,0,240),1) else dxDrawRectangle(x*561,y*320,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*570,y*325,x*33,y*31,"gfx/user.png") dxDrawRectangle(x*561,y*390,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*575,y*395,x*23,y*31,"gfx/pass.png") dxDrawBorder(x*561,y*320,x*262,y*41,tocolor(0,0,0,240),1) dxDrawBorder(x*561,y*390,x*262,y*41,tocolor(0,0,0,240),1) dxDrawRectangle(x*561,y*450,x*262,y*44,bColor) dxDrawBorder(x*561,y*450,x*262,y*44,tocolor(0,0,0,240),1.4) dxDrawText("Registre-se",x*561,y*450,x*552+x*262,y*450+y*44,tocolor(255,255,255),y*1,font,"center","center") end end if getKeyState("backspace") then for k,self in pairs(editBox.instances) do if self.visible and self.input then if not keyState then keyState = getTickCount() + 400 self.text = string.sub(self.text,1,string.len(self.text)-1) elseif keyState and keyState < getTickCount() then keyState = getTickCount()+100 self.text = string.sub(self.text,1,string.len(self.text)-1) end return end end keyState = nil end for i, v in pairs(messages) do if v.visible then dxDrawRectangle(sx-dxGetTextWidth(v.text, 1, "default-bold")-10, 35*i, dxGetTextWidth(v.text, 1, "default-bold")+50, 32,v.color) dxDrawBorder(sx-dxGetTextWidth(v.text, 1, "default-bold")-10, 35*i, dxGetTextWidth(v.text, 1, "default-bold")+20, 32,tocolor(255,255,255,200),1.6) dxDrawText(v.text,sx-dxGetTextWidth(v.text,1,"default-bold")-5, 9+35*i, dxGetTextWidth(v.text, 1, "default-bold"), 32, tocolor(255,255,255,255), 1, "default-bold", "left", "top", false, false ,false, true) end end end function onClientClick(button,state,cX,cY) if not isCursorShowing() then return end if button == "left" and state == "up" then for k,self in pairs(editBox.instances) do if self.visible then if self.input then self.input = nil self.onOutput() end local x,y,w,h = self:getPosition() if isMouseInPosition(x,y,w,h) then self.input = true self.onInput() end end end if not inRegisterTab then if isMouseInPosition(x*552,y*450,x*262,y*44) then triggerServerEvent("onRequestLogin",localPlayer,g.user.text,g.pass.text) elseif isMouseInPosition(x*700,y*520,x*44,y*22) then g.user.visible = false g.pass.visible = false inRegisterTab = true g.rUser.visible = true g.rPass.visible = true end else if isMouseInPosition(x*552,y*450,x*262,y*44) then triggerServerEvent("onRequestRegister",localPlayer,g.rUser.text,g.rPass.text) end end end end addEventHandler("onClientClick", root, onClientClick) function onClientCharacter(character) if not isCursorShowing() then return end for k,self in pairs(editBox.instances) do if self.visible and self.input then if (string.len(self.text)) < self.maxLength then self.text = self.text..character end end end end addEventHandler("onClientCharacter", root, onClientCharacter) function editBox.new() local self = setmetatable({}, editBox) self.text = "" self.maxLength = 20 self.scale = y*0.8 self.state = "normal" self.font = "sans" self.color = {255,255,255,220} self.textColor = {255,255,255,220} table.insert(editBox.instances, self) return self end function editBox:getPosition() return self.x, self.y, self.w, self.h end function editBox:setPosition(x,y,w,h) self.x, self.y, self.w, self.h = x,y,w,h return true end function dxDrawBorder(posX, posY,posW,posH,color,scale) dxDrawLine(posX, posY, posX+posW, posY, color, scale,false) dxDrawLine(posX, posY, posX, posY+posH, color, scale,false) dxDrawLine(posX, posY+posH, posX+posW, posY+posH, color, scale,false) dxDrawLine(posX+posW, posY, posX+posW, posY+posH, color, scale,false) end function isMouseInPosition(x,y,width,height) local cx, cy = getCursorPosition() local cx, cy = (cx*sx), (cy*sy) if (cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true else return false end end function onLogin() showChat(true) showCursor(false) stopSound(sound) removeEventHandler("onClientRender", root, paint) removeEventHandler("onClientClick",root,onClientClick) removeEventHandler("onClientCharacter",root,onClientCharacter) end addEvent("onLogin", true) addEventHandler("onLogin", localPlayer, onLogin) function onRegister() g.user.visible = true g.pass.visible = true g.user.text = "" g.pass.text = "" inRegisterTab = false g.rUser.visible = false g.rPass.visible = false g.rUser.text = "" g.rPass.text = "" end addEvent("onRegister", true) addEventHandler("onRegister", localPlayer, onRegister) function loadLoginFromXML() local XML = xmlLoadFile ("userdata.xml") if not XML then XML = xmlCreateFile("userdata.xml", "login") end local usernameNode = xmlFindChild (XML, "username", 0) if usernameNode then return xmlNodeGetValue(usernameNode) else return "" end xmlUnloadFile ( XML ) end function saveLoginToXML(username) local XML = xmlLoadFile ("userdata.xml") if not XML then XML = xmlCreateFile("userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (XML, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(XML, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end xmlSaveFile(XML) xmlUnloadFile (XML) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", root, saveLoginToXML) function login_text(result, text) if result == "sucess" then addNotification(text,1) elseif result == "error" then addNotification(text,2) end end addEvent("login_text",true) addEventHandler("login_text",root,login_text) function addNotification(text, type) text = string.gsub(text,"#%x%x%x%x%x%x","") local i = 0 if text == "" or text == nil or not type then return else for i = 0, #messages+1 do if messages[i] then i = i+1 else messages[i] = {} messages[i].text = text messages[i].visible = true if type == 1 then messages[i].color = tocolor(0,255,0,160) elseif type == 2 then messages[i].color = tocolor(255,0,0,160) end setTimer(removeNotify,5000,1,i) end end end end function removeNotify(i) messages[i].visible = false messages[i] = nil end function dxDrawBorder(posX, posY,posW,posH,color,scale) dxDrawLine(posX, posY, posX+posW, posY, color, scale,false) dxDrawLine(posX, posY, posX, posY+posH, color, scale,false) dxDrawLine(posX, posY+posH, posX+posW, posY+posH, color, scale,false) dxDrawLine(posX+posW, posY, posX+posW, posY+posH, color, scale,false) end estava querendo adicionar um video de fundo na area de login, porem o video não está aparecendo hlp :0
  3. function onInventory(source) if not isGuestAccount(getPlayerAccount(source)) then triggerClientEvent(source, "N3xT.onOpenInventory", source) else messageS(source, "Você precisa estar logado para abrir o inventário!", "error") end end function onResStart() for index, player in ipairs(getElementsByType("player")) do bindKey(player, config.bind, "down", onInventory) if not isGuestAccount(getPlayerAccount(player)) then local acc = getAccountName(getPlayerAccount(player)) loadItens(player, acc) end end end addEventHandler("onResourceStart", resourceRoot, onResStart) function onPlayerJoin() bindKey(source, config.bind, "down", onInventory) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin) function cleanAll() for index, player in ipairs(getElementsByType("player")) do unbindKey(player, config.bind, "down", onInventory) bindKey ( player, "F1", "down", onInventory ) end end addEventHandler("onResourceStop", resourceRoot, cleanAll)
  4. bom esté é o client do meu mod de trancar veiculos, o problema é que nos veiculos da conce, outros jogadores conseguem destrancar os veiculos um dos outros algm tem a moral de me ajudar com isso aqui
  5. local Cortando = math.random(50,125) local locations = { { 1175.446, -2364.027, 12.318 }, { 1214.335, -2344.706, 13.925 }, { 1245.387, -2339.776, 13.828 }, { 1267.052, -2300.626, 12.216 }, { 1313.299, -2285.248, 13.51 }, { 1268.388, -2274.247, 13.451 }, { 1268.388, -2274.247, 13.451 }, { 1223.237, -2282.027, 13.482 }, { 1204.502, -2319.271, 14.705 }, { 1180.061, -2339.961, 13.623 }, { 1143.323, -2359.932, 12.081 }, { 1165.128, -2386.746, 11.187 }, { 1191.322, -2338.888, 13.996 }, { 1217.812, -2329.446, 14.565 }, { 1246.38, -2292.822, 12.783 } } atualrotnumberJORNAL = {} ppcikJORNAL = {} blips = {} rotasJORNAL = { ["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = { {1175.446, -2364.027, 12.318}, {1214.335, -2344.706, 13.925}, {1245.387, -2339.776, 13.828}, {1267.052, -2300.626, 12.216}, {1313.299, -2285.248, 13.51}, {1268.388, -2274.247, 13.451}, {1268.388, -2274.247, 13.451}, {1223.237, -2282.027, 13.482}, {1204.502, -2319.271, 14.705}, {1180.061, -2339.961, 13.623}, {1143.323, -2359.932, 12.081}, {1165.128, -2386.746, 11.187}, {1191.322, -2338.888, 13.996}, {1217.812, -2329.446, 14.565}, {1246.38, -2292.822, 12.783}, }, ["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = { (locations [ math.random ( 1, #locations ) ] ) }, } pay = { ["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = 500, ["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = 500, } function ifPlayerEnterOnMarker(markerHit,matchingDimension) if isPedInVehicle(source) then if markerHit == ppcikJORNAL[source] then if (matchingDimension) then if isElement(ppcikJORNAL[source]) then local rname = getElementData(source,"rtnameJornal") or nil if rname == nil then return end destroyElement(ppcikJORNAL[source]) triggerClientEvent(source,"AirNew>JOBCortador>blips<Client",source,false) local vh = getPedOccupiedVehicle(source) --toggleAllControls ( source, false ) --setControlState ( source, "handbrake", true ) if atualrotnumberJORNAL[source] <= #rotasJORNAL[rname] then givePlayerMoney(source,Cortando) --exports.Scripts_Dxmessages:outputDx(source, "Entregando Jornais... Aguarde 2 Segundos!", "info") setTimer(gerarrota,1,1,source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu + $ e Exp", "success") end,1,1,source) elseif atualrotnumberJORNAL[source] == #rotasJORNAL[rname]+1 then setElementData(source,"rtnameJornal",rname) atualrotnumberJORNAL[source] = 1 local rec = pay[rname] givePlayerMoney(source,tonumber(rec)) local vh = getPedOccupiedVehicle(source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu um Valor de $"..rec.." Por Finalizar as Entregas de Jornais!", "success") end,1,1,source) --setTimer(function(source) toggleAllControls ( source, true ) end, 2500,1, source ) --setTimer(function(source) setControlState ( source, "handbrake", false ) end, 2500,1, source ) setElementData(source,"rtnameJornal",nil) end end end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),ifPlayerEnterOnMarker) Olá, alguem poderia me ajudar com esse script? eu queria os check do emprego aleatorios, ent criei o local locations, porem cria apenas 1 check, e quando entro nele finaliza as entregas ao invez se aparecer outro
  6. function voolscomercial () if (getPlayerMoney(source) < PrecoLSComercial) then if tonumber(PrecoLSComercial) then --if (getPlayerMoney(source) < 5) then outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê não tem dinheiro suficiente $"..PrecoLSComercial.."", source, 255, 255, 255, true) else takePlayerMoney(source, ""..PrecoLSComercial.."") --Remover Dinheiro setElementPosition ( source, 1642.058, -2334.951, 13.547 ) outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê acaba de ir para LS por R$"..PrecoLSComercial.." ", player, 255,255,255,true) end end end addEvent("comercials",true) addEventHandler ( "comercials", getRootElement(), voolscomercial ) então na teoria ficaria assim? porem mesmo retornou o mesmo problema no debug, "sou iniciante", vou explicar melhor como estou fazendo o mod pois pode ser algo errado Minha pasta do mod https://imgur.com/JAENiUB dentro do edits está assim PrecoLSComercial = "5000" é dai que estou tirando o PrecoLSComercial que estou colocando no Duff_S server, e que quero colocar na getPlayerMoney
  7. function voolscomercial () if (getPlayerMoney(source) < 5) then outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê não tem dinheiro suficiente $"..PrecoLSComercial.."", source, 255, 255, 255, true) else takePlayerMoney(source, ""..PrecoLSComercial.."") --Remover Dinheiro setElementPosition ( source, 1642.058, -2334.951, 13.547 ) outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê acaba de ir para LS por R$"..PrecoLSComercial.." ", player, 255,255,255,true) end end addEvent("comercials",true) addEventHandler ( "comercials", getRootElement(), voolscomercial ) no caso eu queria adicionar o ( "..PrecoLSComercial.." ) na linha 2 no lugar do numero 5 mas retorna erro no debug (attempt to compare number whit string)
  8. function ifPlayerEnterOnMarker(markerHit,matchingDimension) if isElement(markerHit) and matchingDimension then if getElementType(markerHit) == "player" and not isPedInVehicle(markerHit) then if isPedInVehicle(source) then if markerHit == ppcikPOSTES[source] then if (matchingDimension) then if isElement(ppcikPOSTES[source]) then local rname = getElementData(source,"rtnamePostes") or nil if rname == nil then return end destroyElement(ppcikPOSTES[source]) triggerClientEvent(source,"AirNew>JOBEletricista>blips<Client",source,false) local vh = getPedOccupiedVehicle(source) outputChatBox ( "#FF0000/reparar", root, 255, 255, 255, true ) toggleAllControls ( source, false ) setControlState ( source, "handbrake", true ) if atualrotnumberPOSTES[source] <= #rotasPOSTES[rname] then exports.Scripts_Dxmessages:outputDx(source, "Reparando... Aguarde 2 Segundos!", "info") setElementData ( source, "AirNewSCR_LiberarXP", "Sim" ) givePlayerMoney ( source, VALOR_POR_POSTES ) setTimer(gerarrota,2500,1,source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Jornais Entregues, Siga Para o Proximo Checkpoint!", "success") end,2500,1,source) elseif atualrotnumberPOSTES[source] == #rotasPOSTES[rname]+1 then setElementData(source,"rtnamePostes",rname) atualrotnumberPOSTES[source] = 1 local rec = pay[rname] givePlayerMoney(source,tonumber(rec)) local vh = getPedOccupiedVehicle(source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu um Valor de $"..rec.." Por Finalizar as Entregas de Jornais!", "success") end,2500,1,source) setTimer(function(source) toggleAllControls ( source, true ) end, 2500,1, source ) setTimer(function(source) setControlState ( source, "handbrake", false ) end, 2500,1, source ) setElementData(source,"rtnamePostes",nil) end end end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),ifPlayerEnterOnMarker) Meu código está assim porem não está funcionando como deveria, ( na teoria quando o player fosse fazer a entrega se ele estiver dentro do veiculo ele não consegue entregar, ele tem que sair do carro e ir no marker para ai sim funcionar) agradeço dez de já quem puder dar uma moral aqui
  9. eu gostaria de abrir este painel por comando function showPanellr(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then ---So Mude "PCC" Grupo que vai poder abrir o painel ! triggerClientEvent(thePlayer, "painelrota", getRootElement()) end end function onResStartlr() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr) function onPlayerJoinlr() bindKey(source, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr) function cleanAlllr(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr) function reparar() local veiculo = getPedOccupiedVehicle(source) if isPedInVehicle(source) then fixVehicle(veiculo) end end addEvent("reparar", true) addEventHandler("reparar", getRootElement(), reparar) function armas () giveWeapon( source, 24, 999, true ) giveWeapon( source, 27, 999, true ) giveWeapon( source, 34, 999, true ) giveWeapon( source, 32, 999, true ) end addEvent("armasrota",true) addEventHandler ( "armasrota", getRootElement(), armas ) function money () -- get the amount of money from the player who entered the command setPlayerMoney(root, 1000000) -- if money is more than 1000 end addEvent("moneyrt",true) addEventHandler ( "moneyrt", getRootElement(), money ) function money1 () -- get the amount of money from the player who entered the command setPlayerMoney(root, 10000000) -- if money is more than 1000 end addEvent("moneyrt1",true) addEventHandler ( "moneyrt1", getRootElement(), money1 )
  10. -- no caso eu queria fazer para o painel que é definido como "Pdx" abrice por um comando ex /abrir -- function abrir (_,state) if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addEvent("painelrota", true) addEventHandler("painelrota", root , abrir)
  11. -- no caso eu queria fazer para o painel que é definido como "Pdx" abrice por um comando ex /abrir -- function abrir (_,state) if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addEvent("painelrota", true) addEventHandler("painelrota", root , abrir)
  12. ----- queria que apenas spawnase quando um trabalhador hit o marker carro = createMarker(2146.883, -2289.945, 14.761 -1,"cylinder", 2.0, 255,0,0,80) desespawncm = createMarker(2151.133, -2290.037, 13.368 -1 , "cylinder",2.0,255,255,255,80) veh = {} function spawnviaturaone(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) if isElementWithinMarker(thePlayer, carro) then if veh[thePlayer] and isElement(veh[thePlayer]) then destroyElement(veh[thePlayer]) veh[thePlayer] = nil else veh[thePlayer] = createVehicle(530, 2153.617, -2287.28, 13.524) warpPedIntoVehicle(thePlayer, veh[thePlayer]) end end end addEventHandler("onMarkerHit", carro, spawnviaturaone ) function desespawncmm(thePlayer) destroyElement(veh[thePlayer]) destroyElement(thePlayer) end addEventHandler("onMarkerHit", desespawncm, desespawncmm) function Sair_do_Servidor_AirNewSCR ( quitType ) if isElement ( veh[source] ) then destroyElement ( veh[source] ) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), Sair_do_Servidor_AirNewSCR ) -- client trabalho --[[ ################################################ # # # Script Criado Por # # FACEBOOK.COM/AIRNEWSCR # # # # # ################################################ --]] -------------------------------------------------------------------- local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) -------------------------------------------------------------------- function Window(rnames) if isElement(myWindow) then return end local screenW, screenH = guiGetScreenSize() myWindow = guiCreateWindow((screenW - x*485) / 2, (screenH - y*404) / 2, x*485, y*404, "Rotas", false) rotas = guiCreateGridList(x*40, y*40, x*405, y*275, false, myWindow) guiWindowSetSizable(myWindow, false) guiSetAlpha(rotas, x*0.70) guiGridListAddColumn( rotas, "Rotas", x*0.85 ) for k,v in pairs(rnames) do row = guiGridListAddRow ( rotas ) guiGridListSetItemText ( rotas, row, 1, tostring(k), false, false ) end showCursor(true) fechar = guiCreateButton(x*275, y*334, x*168, y*35, "Fechar", false, myWindow) escolher = guiCreateButton(x*42, y*334, x*168, y*35, "Carregar", false, myWindow) end addEvent("AirNew>JOBEntregadorDeJornal>AbrirPainel<Client", true) addEventHandler("AirNew>JOBEntregadorDeJornal>AbrirPainel<Client", localPlayer, Window) function botoes(bt,state) if state == "up" and bt == "left" then if source == fechar then if isElement(myWindow) then destroyElement(myWindow) showCursor(false) end end if source == escolher then local selectedItemx = guiGridListGetSelectedItem(rotas) local nome = guiGridListGetItemText(rotas, selectedItemx, 1) if nome == nil then outputChatBox("[ #00FF73Servidor #ffffff] - Selecione Uma Rota",255,255,255,true) return end triggerServerEvent("AirNew>request>Startrota>Server>EntregadorDeJornal",localPlayer,localPlayer,nome) if isElement(myWindow) then destroyElement(myWindow) showCursor(false) end end end end addEventHandler("onClientGUIClick", root,botoes) function blips(state,x,y,z) if state == true then if not isElement(blips) then blips = createBlip ( x, y, z, 0) end else if isElement(blips) then destroyElement(blips) end end end addEvent("AirNew>JOBEntregadorDeJornal>blips<Client", true) addEventHandler("AirNew>JOBEntregadorDeJornal>blips<Client", localPlayer, blips) function DesligarAntiQuedaBike () setPedCanBeKnockedOffBike ( localPlayer, true ) end addEvent( "Desligar:AntiQueda", true ) addEventHandler( "Desligar:AntiQueda", localPlayer, DesligarAntiQuedaBike ) function LigarAntiQuedaBike () setPedCanBeKnockedOffBike ( localPlayer, false ) end addEvent( "Ligar:AntiQueda", true ) addEventHandler( "Ligar:AntiQueda", localPlayer, LigarAntiQuedaBike ) --server trabalho MarkerSafeEntregadorDeJornal = createMarker( 765.68848, -1355.44495, 13.52570, "cylinder", 35, 0, 255, 0, 0) EntregadorDeJornalPickup = createPickup ( 783.27710, -1327.66260, 13.54688, 3, 1210) MarkerEntregadorDeJornal = createMarker ( 783.27710, -1327.66260, 13.54688, "cylinder", 1.2, 255, 255, 255, 0 ) attachElements ( MarkerEntregadorDeJornal, EntregadorDeJornalPickup, 0, 0, -1 ) BlipEntregadorDeJornal = createBlipAttachedTo ( MarkerEntregadorDeJornal, 42 ) setBlipVisibleDistance ( BlipEntregadorDeJornal, 150 ) function CancelarSumirPickup ( player ) cancelEvent() end addEventHandler ( "onPickupHit", EntregadorDeJornalPickup, CancelarSumirPickup ) LetraParaMarkers = "k" cmd1 = "hq" cmd2 = "profissao" local HQEntregadorDeJornalBlip = createBlip ( 783.27710, -1327.66260, 13.54688 ) setElementVisibleTo ( HQEntregadorDeJornalBlip, root, false ) -------------------------------------------------------------------- function VerificarBlipEmprego(player) if player then acc = getPlayerAccount ( player ) if isGuestAccount ( acc ) then return end setElementVisibleTo ( HQEntregadorDeJornalBlip, player, false ) end end setTimer( function() for i, pl in pairs(getElementsByType("player")) do if pl ~= (false or nil) then if getElementData ( pl, "Emprego" ) == "Entregador de Jornal" then return end VerificarBlipEmprego(pl) end end end, 3000,0) -------------------------------------------------------------------- function ComandoHQ ( source ) if getElementData ( source, "Emprego" ) == "Entregador de Jornal" then if isElementVisibleTo ( HQEntregadorDeJornalBlip, source ) then setElementVisibleTo ( HQEntregadorDeJornalBlip, source, false ) exports.Scripts_Dxmessages:outputDx(source, "Seu Local de Trabalho foi Desmarcado do Mapa!", "info") else setElementVisibleTo ( HQEntregadorDeJornalBlip, source, true ) exports.Scripts_Dxmessages:outputDx(source, "Seu Local de Trabalho foi Marcado no Mapa!", "info") end end end addCommandHandler ( cmd1, ComandoHQ ) -------------------------------------------------------------------- function AceitarEmprego02 (source) exports.Scripts_OnMarkerMsgs_:delete(source) unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 ) if getElementData ( source, "AirNew>Encaminhamento" ) == "Entregador de Jornal" then setElementData ( source, "AirNew>Encaminhamento", false ) setElementData ( source, "Emprego", "Entregador de Jornal" ) exports.Scripts_Dxmessages:outputDx(source, "Você Agora Trabalha de Entregador de Jornal, Para Mais Informações Digite ( /Profissao )", "success") else exports.Scripts_Dxmessages:outputDx(source, "Você Precisa Estar Encaminhado da Agencia de Empregos para Trabalhar neste Local!", "error") end end function RecusarEmprego02 (source) exports.Scripts_OnMarkerMsgs_:delete(source) unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 ) if isElementVisibleTo ( HQEntregadorDeJornalBlip, source ) then setElementVisibleTo ( HQEntregadorDeJornalBlip, source, false ) end removeElementData ( source, "Emprego", "Entregador de Jornal" ) exports.Scripts_Dxmessages:outputDx(source, "Você se Demitiu do Emprego de Entregador de Jornal com Sucesso!", "warning") end -------------------------------------------------------------------- function ComandosProf ( ThePlayer ) if getElementData ( ThePlayer, "Emprego" ) == "Entregador de Jornal" then playSoundFrontEnd ( ThePlayer, 43 ) outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profissão #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #BEE09AComandos da Profissão de Entregador de Jornal", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #55D444/HQ #ffffff- #9ABDE0Para Marcar / Desmarcar o seu Local de Trabalho", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #55D444/Rotas #ffffff- #9ABDE0Abre a Lista de Rotas Disponiveis Para Trabalhar", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #FFD700Entre na Bike e Digite /Rotas Selecione uma Rota e Siga os Checkpoints!", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profissão #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true ) end end addCommandHandler(cmd2, ComandosProf ) -------------------------------------------------------------------- function emarker(marker,md) if (md) then if isPedInVehicle ( source ) then return end if marker == MarkerEntregadorDeJornal then if getElementData ( source, "Emprego" ) == "Entregador de Jornal" then exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para se Demitir do Emprego de Entregador de Jornal") bindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 ) else exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para Aceitar o Emprego de Entregador de Jornal") bindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 ) end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),emarker) function lmarker(marker,md) if (md) then if marker == MarkerEntregadorDeJornal then exports.Scripts_OnMarkerMsgs_:delete(source) unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego02 ) unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego02 ) end end end addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker) function CriarVeiculosComData () VeiculosComDataEntregadorDeJornal = { createVehicle(418, 783.54602, -1334.39611, 13.66790, 0, 0, 90 ), createVehicle(418, 783.19165, -1339.09948, 13.50201, 0, 0, 90 ), createVehicle(418, 783.29638, -1343.80102, 13.50254, 0, 0, 90 ), createVehicle(418, 783.37371, -1348.26196, 13.50224, 0, 0, 90 ), createVehicle(418, 783.51849, -1352.64526, 13.50811, 0, 0, 90 ), createVehicle(418, 783.38525, -1357.21313, 13.131029, 0, 0, 90 ), createVehicle(418, 783.16894, -1361.29101, 13.192735, 0, 0, 90 ), createVehicle(418, 783.11541, -1365.41711, 13.194348, 0, 0, 90 ), createVehicle(418, 783.16296, -1369.40722, 13.195641, 0, 0, 90 ), ------ createVehicle(510, 783.16296, -1369.40722, 13.195641, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -20, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -22, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -24, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -26, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -28, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -30, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -32, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -34, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -36, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -38, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -40, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -42, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -44, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -46, 13.54213, 0, 0, 90 ), ------ createVehicle(418, 785.55151, -1332.39575 -48, 13.54213, 0, 0, 90 ), ------ createVehicle(510, 785.55151, -1332.39575 -50, 13.54213, 0, 0, 90 ), } for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) do setElementData ( veh, "Emprego", "Entregador de Jornal" ) setVehicleDamageProof(veh,true) setVehicleColor( veh, 0, 0, 0 ) setVehiclePlateText ( veh, "RPGAMING" ) addEventHandler("onVehicleStartEnter", veh, VerificarEmprego ) --addEventHandler("onVehicleExit", veh, SairDoVeiculosComData ) local tx, ty, tz = getElementPosition(veh) local rx, ry, rz = getElementRotation(veh) setVehicleRespawnPosition(veh, tx, ty, tz, rx, ry, rz) end end addEventHandler("onResourceStart", resourceRoot, CriarVeiculosComData ) function VerificarEmprego (thePlayer, seat) local Jogador = getElementData(thePlayer, "Emprego" ) if seat == 0 then if Jogador == "Entregador de Jornal" then else cancelEvent() exports.Scripts_Dxmessages:outputDx(thePlayer, "Esse Veiculo é Exclusivo dos Entregadores de Jornal!", "error") end end end --[[function SairDoVeiculosComData () local veh = source setTimer(function() if getVehicleOccupant(veh) == false then respawnVehicle(veh) end end, 30000, 1) end addEventHandler ( "onPlayerQuit", getRootElement(), SairDoVeiculosComData ) --]] -------------------------------------------------------------------- local rElement = getRootElement() function respawnVehicles(player, seconds) for i, veh in ipairs(VeiculosComDataEntregadorDeJornal) do if isEmpty( veh ) then respawnVehicle ( veh ) end end end setTimer(respawnVehicles, 60000,0) function isEmpty( vehicle ) local passengers = getVehicleMaxPassengers( vehicle ) if type( passengers ) == 'number' then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end -------------------------------------------------------------------- atualrotnumberJORNAL = {} ppcikJORNAL = {} blips = {} rotasJORNAL = { ["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = { {825.184020, -1472.98876, 12.53338}, ------- 993.64386, -1050.08850, 30.72189 {763.92578, -1564.48425, 13.20226}, {1248.03588, -1561.93261, 13.21602}, {1364.48669, -1279.30102, 13.19416}, {1408.68762, -930.52990, 35.071788}, {1423.06555, -883.22113, 50.198425}, {1516.51940, -764.47930, 79.699653}, {1269.48010, -916.03302, 42.007972}, {1024.39660, -982.81207, 42.304122}, {458.39724, -1501.76721, 30.685428}, {314.51614, -1772.04675, 4.31334}, {335.31448, -1352.68127, 14.16307}, {406.65902, -1264.70227, 49.95773}, {542.10595, -1200.41784, 44.04943}, {688.54528, -1073.10400, 49.11075}, {833.98223, -926.041992, 54.89589}, {895.58306, -921.980895, 42.07406}, {996.54058, -916.591735, 41.82923}, {904.05651, -1333.21496, 13.16217}, {778.05102, -1333.59057, 13.19954}, }, ["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = { {799.274, -1070.383, 24.087}, {637.208, -571.723, 15.84}, {680.38, -481.45, 15.841}, {236.531, -226.303, 1.081}, {211.736, -208.112, 1.088}, {209.682, -67.42, 1.088}, {254.644, -67.281, 1.086}, {318.415, -126.088, 1.94}, {1284.511, 175.263, 19.987}, {1293.098, 268.087, 19.068}, {1355.85, 244.474, 19.224}, {1351.297, 207.086, 19.212}, {2248.981, 46.128, 25.988}, {2307.204, 87.946, 25.989}, {2357.026, 119.875, 26.641}, {2811.293, -1182.426, 24.949}, {2854.568, -1345.299, 10.722}, {2494.49, -1755.65, 13.137}, {1425.196, -1699.463, 13.041}, {777.526, -1335.479, 13.538}, }, } pay = { ["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = 2500, ["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = 3250, } function ifPlayerEnterOnMarker(markerHit,matchingDimension) if isPedInVehicle(source) then if markerHit == ppcikJORNAL[source] then if (matchingDimension) then if isElement(ppcikJORNAL[source]) then local rname = getElementData(source,"rtnameJORNAL") or nil if rname == nil then return end destroyElement(ppcikJORNAL[source]) triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,false) local vh = getPedOccupiedVehicle(source) toggleAllControls ( source, false ) setControlState ( source, "handbrake", true ) if atualrotnumberJORNAL[source] <= #rotasJORNAL[rname] then exports.Scripts_Dxmessages:outputDx(source, "Entregando Jornais... Aguarde 2 Segundos!", "info") setTimer(gerarrota,2500,1,source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Jornais Entregues, Siga Para o Proximo Checkpoint!", "success") end,2500,1,source) elseif atualrotnumberJORNAL[source] == #rotasJORNAL[rname]+1 then setElementData(source,"rtnameJornal",rname) atualrotnumberJORNAL[source] = 1 local rec = pay[rname] givePlayerMoney(source,tonumber(rec)) local vh = getPedOccupiedVehicle(source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu um Valor de $"..rec.." Por Finalizar as Entregas de Jornais!", "success") end,2500,1,source) setTimer(function(source) toggleAllControls ( source, true ) end, 2500,1, source ) setTimer(function(source) setControlState ( source, "handbrake", false ) end, 2500,1, source ) setElementData(source,"rtnameJornal",nil) end end end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),ifPlayerEnterOnMarker) -------------------------------------------------------------------- function VerificarCairBike(player) if player then acc = getPlayerAccount ( player ) if isGuestAccount ( acc ) then return end local rname = getElementData(player,"rtnameJornal") or nil if rname == nil then triggerClientEvent ( "Desligar:AntiQueda", player ) else triggerClientEvent ( "Ligar:AntiQueda", player ) end end end setTimer( function() for i, pl in pairs(getElementsByType("player")) do if pl ~= (false or nil) then if getElementData ( pl, "Emprego" ) == "Entregador de Jornal" then VerificarCairBike(pl) end end end end, 3000,0) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function pickjobJornal(source) if not isElement(source) then return end local im = isPedInVehicle(source) if im == false then return end local job = getElementData(source,"Emprego") or false if job == "Entregador de Jornal" then local vh = getPedOccupiedVehicle(source) if isElement(vh) then local x,y = getElementPosition(vh) local x1,y1 = getElementPosition(source) local dist = getDistanceBetweenPoints2D(x,y,x1,y1) local isMarkerSafe = isElementWithinMarker(vh,MarkerSafeEntregadorDeJornal) local id = getElementModel(vh) local seat = getPedOccupiedVehicleSeat(source) if dist > 0 then return end if id == 418 then if seat == 0 then if isMarkerSafe == false then return end triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>AbrirPainel<Client",source,rotasJORNAL) end end end end end addCommandHandler("rotas",pickjobJornal) function receivert(source,rotaname) if isElement(ppcikJORNAL[source]) then destroyElement(ppcikJORNAL[source]) end triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,false) setElementData(source,"rtnameJornal",rotaname) atualrotnumberJORNAL[source] = 1 gerarrota(source) end addEvent("AirNew>request>Startrota>Server>EntregadorDeJornal", true) addEventHandler("AirNew>request>Startrota>Server>EntregadorDeJornal",getRootElement(), receivert) function gerarrota(source) local rname = getElementData(source,"rtnameJornal") or nil if rname == nil then return end if not isElement(ppcikJORNAL[source]) and isPedInVehicle(source) then local vh = getPedOccupiedVehicle(source) toggleAllControls ( source, true ) setControlState ( source, "handbrake", false ) local id = tonumber(atualrotnumberJORNAL[source]) local x,y,z = rotasJORNAL[rname][id][1],rotasJORNAL[rname][id][2],rotasJORNAL[rname][id][3] ppcikJORNAL[source] = createMarker (x, y,z, "checkpoint", 4, 255, 0, 0, 50,source) triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,true,x,y,z) atualrotnumberJORNAL[source] = id+1 end end function sair ( quitType ) if isElement(ppcikJORNAL[source]) then destroyElement(ppcikJORNAL[source]) end end addEventHandler ( "onPlayerQuit", getRootElement(), sair ) function SairDaBike ( thePlayer, seat, jacked ) local rname = getElementData(thePlayer,"rtnameJornal") or nil if rname == nil then return end canceljobtimer (thePlayer) exports.Scripts_Dxmessages:outputDx(thePlayer, "Você Saiu da Van, Entregas Canceladas!", "warning") end addEventHandler ( "onVehicleExit", getRootElement(), SairDaBike ) function canceljobtimer(source) if isElement(ppcikJORNAL[source]) then destroyElement(ppcikJORNAL[source]) end triggerClientEvent(source,"AirNew>JOBEntregadorDeJornal>blips<Client",source,false) atualrotnumberJORNAL[source] = 1 setElementData(source,"rtnameJornal",nil) end function canceljobdeath() local job = getElementData(source,"Emprego") or false if job ~= "Entregador de Jornal" then return end local rname = getElementData(source,"rtnameJornal") or nil if rname == nil then return end canceljobtimer(source) exports.Scripts_Dxmessages:outputDx(source, "Você Morreu e Suas Entregas Foram Canceladas!", "warning") end addEventHandler( "onPlayerWasted", getRootElement( ),canceljobdeath)
  13. então estou editando um painel e gostaria que quando ele aparece na tela tocase uma musica, até ai consegui mas ao fechar a agencia a musica não para de tocar function AbrirAgenciaEmpregos () if AgenciaEmpregosAirNew == false then addEventHandler ( "onClientRender", root, PainelAgenciaEmpregosNew ) showCursor ( true ) AgenciaEmpregosAirNew = true playSound("img/music.mp3",true) -- inicia musica ao abrir o painel da agencia showChat(false) -- desativa o chat enquanto o painel ta aberto end end addEvent ( "AirNew>AbrirAgencia", true) addEventHandler ( "AirNew>AbrirAgencia", root, AbrirAgenciaEmpregos ) function FecharAgenciaEmpregos () if AgenciaEmpregosAirNew == true then removeEventHandler ( "onClientRender", root, PainelAgenciaEmpregosNew ) showCursor ( false ) AgenciaEmpregosAirNew = false playSoundFrontEnd ( 40 ) stopSound(sound) --deveria parar a musica a o fecher a agencia showChat(true) --deveria mostrar o chat ao fechar a agencia end end addEvent ( "AirNew>FecharAgencia", true) addEventHandler ( "AirNew>FecharAgencia", root, FecharAgenciaEmpregos )
  14. Tou a tarde toda tentando ;.; ja apaguei um monte de arquivo q da erro ;.;
×
×
  • Create New...