dener189 Posted September 14, 2019 Share Posted September 14, 2019 Olá peguei esse script da net que é um emprego de entregador de malotes, configurei as rotas tudo certo e pá, mas quando vai dar o comando para abrir, simplesmente não abre Cliente: local TransportadorTarget local TransportadorBlip local function clickToThrow(btn, state) if btn == "lalt" and state == true then if not isElement (TransportadorTarget) then removeEventHandler ("onClientKey", root, clickToThrow) else local localPos = {getElementPosition (localPlayer)} local targetPos = {getElementPosition (TransportadorTarget)} if getDistanceBetweenPoints3D (localPos[1], localPos[2], localPos[3], targetPos[1], targetPos[2], targetPos[3]) < 10 then local Transportador = createObject (1550, localPos[1], localPos[2] - 0.1, localPos[3] + 0.7) moveObject (Transportador, 400, targetPos[1], targetPos[2], targetPos[3]) setTimer (destroyElement, 3000, 1, Transportador) setElementCollisionsEnabled (Transportador, false) localPos = nil targetPos = nil clearTransportadorMission() triggerServerEvent ("payMeWhatYouOweMe", localPlayer) end end end end addEvent ("requestTransportadorjobStart", true) local function startTransportadorjob (locationTable) local randomLocation = locationTable[math.random(#locationTable)] TransportadorTarget = createMarker (randomLocation[1], randomLocation[2], randomLocation[3], "cylinder", 4, 255, 50, 50, 100) TransportadorBlip = createBlipAttachedTo (TransportadorTarget, 31) addEventHandler ("onClientKey", root, clickToThrow) --outputChatBox ( "Você Pegou Transportador, Siga o Checkpoint para Entregar!"--[[..getZoneName(randomLocation[1], randomLocation[2], randomLocation[3])--]], 255, 50, 50, true) end addEventHandler ("requestTransportadorjobStart", localPlayer, startTransportadorjob) function clearTransportadorboyMission() if isElement (TransportadorTarget) then destroyElement (TransportadorTarget) end if isElement (TransportadorBlip) then destroyElement (TransportadorBlip) end removeEventHandler ("onClientKey", root, clickToThrow) end addEventHandler ("onClientPlayerWasted", localPlayer, clearTransportadorMission) function removeHelmetOnExit ( vehicle, seat, jacked ) if isElement (TransportadorTarget) then destroyElement (TransportadorTarget) end if isElement (TransportadorBlip) then destroyElement (TransportadorBlip) end removeEventHandler ("onClientKey", root, clickToThrow) end addEventHandler ( "onPlayerVehicleExit", getRootElement(), removeHelmetOnExit ) addEvent( "HurleyRoleplay:CancelarEmpregoTransportador", true ) addEventHandler( "HurleyRoleplay:CancelarEmpregoTransportador", localPlayer, removeHelmetOnExit ) Server: TransportadorPickup = createPickup ( 1088.438, 1913.967, 10.82, 3, 1210) MakerTransportador = createMarker ( 1088.438, 1913.967, 10.82, "cylinder", 1.2, 255, 255, 255, 0 ) attachElements ( MakerTransportador, TransportadorPickup, 0, 0, -1 ) MarkerSafeTransportador = createMarker ( 1080.761, 1919.251, 11.23, "cylinder", 20, 255, 255, 255, 0 ) function CancelarSumirPickup ( player ) cancelEvent() end addEventHandler ( "onPickupHit", TransportadorPickup, CancelarSumirPickup ) LetraParaMarkers = "k" cmd1 = "profissao" cmd2 = "transportar" cmd3 = "hq" local HQTransportadorBlip = createBlip ( 1088.438, 1913.967, 10.82 ) setElementVisibleTo ( HQTransportadorBlip, root, false ) ------------------------------------------------------------------------------------------------------------------------------------------------------ function VerificarBlipEmprego(player) if player then acc = getPlayerAccount ( player ) if isGuestAccount ( acc ) then return end setElementVisibleTo ( HQTransportadorBlip, player, false ) end end setTimer( function() for i, pl in pairs(getElementsByType("player")) do if pl ~= (false or nil) then if getElementData ( pl, "Emprego" ) == "Transportador" then return end VerificarBlipEmprego(pl) end end end, 3000,0) ------------------------------------------------------------------------------------------------------------------------------------------------------ function ComandoHQ ( source ) if getElementData ( source, "Emprego" ) == "Transportador" then if isElementVisibleTo ( HQTransportadorBlip, source ) then setElementVisibleTo ( HQTransportadorBlip, source, false ) exports.Scripts_Dxmessages:outputDx(source, "Seu Local de Trabalho foi Desmarcado do Mapa!", "info") else setElementVisibleTo ( HQTransportadorBlip, source, true ) exports.Scripts_Dxmessages:outputDx(source, "Seu Local de Trabalho foi Marcado no Mapa!", "info") end end end addCommandHandler ( cmd3, ComandoHQ ) ------------------------------------------------------------------------------------------------------------------------------------------------------ function AceitarEmprego07 (source) exports.Scripts_OnMarkerMsgs_:delete (source) unbindKey (source, LetraParaMarkers, "down", AceitarEmprego07) if getElementData (source, "HurleyRoleplay>Encaminhamento") == "Transportador" then setElementData (source, "HurleyRoleplay>Encaminhamento", false) setElementData (source, "Emprego", "Transportador") exports.Scripts_Dxmessages:outputDx (source, "Você Agora Trabalha de Transportador de Valores, Para Mais Informações Digite ( /Profissao )", "success") if not isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (source)), aclGetGroup("Transportador")) then aclGroupAddObject (aclGetGroup("Transportador"), "user."..getAccountName (getPlayerAccount (source))) else exports.Scripts_Dxmessages:outputDx (source, "Você Precisa Estar Encaminhado da Agencia de Empregos para Trabalhar neste Local!", "error") end end end function RecusarEmprego07 (source) exports.Scripts_OnMarkerMsgs_:delete (source) unbindKey (source, LetraParaMarkers, "down", RecusarEmprego07) if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (source)), aclGetGroup("Transportador")) then aclGroupRemoveObject (aclGetGroup("Transportador"), "user."..getAccountName (getPlayerAccount (source))) if isElementVisibleTo (HQEntregadorDeJornalBlip, source) then setElementVisibleTo (HQEntregadorDeJornalBlip, source, false) end end removeElementData (source, "Emprego", "Transportador") if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (source)), aclGetGroup("Transportador")) then aclGroupRemoveObject (aclGetGroup("Transportador"), "user."..getAccountName (getPlayerAccount (source))) else exports.Scripts_Dxmessages:outputDx(source, "Você se demitiu do emprego de Transportador de Valores com sucesso!", "warning") end end ------------------------------------------------------------------------------------------------------------------------------------------------------ Spawn = createMarker(1082.66, 1913.823, 10.82 -1,"cylinder", 1.9, 0, 255, 0, 99) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end veh = {} function spawnvtr ( thePlayer, comando, nick ) if veh[thePlayer] and isElement( veh[thePlayer] ) then destroyElement ( veh[thePlayer] ) veh[thePlayer] = nil end local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Transportador") ) then veh[thePlayer] = createVehicle(498, 1081.771, 1922.637, 11.205, -0, 0, 354.788) warpPedIntoVehicle ( thePlayer, veh[thePlayer] ) exports.Scripts_Dxmessages:outputDx(thePlayer, "Veiculo criado com sucesso", "success") else exports.Scripts_Dxmessages:outputDx(thePlayer, "Esse Veiculo é Exclusivo dos Transportador de Valores!", "warning") end end addEventHandler("onMarkerHit", Spawn, spawnvtr) ------------------------------------------------------------------------------------------------------------------------------------------------------ function emarker(marker,md) if (md) then if isPedInVehicle ( source ) then return end if marker == MakerTransportador then if getElementData ( source, "Emprego" ) == "Transportador" then exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para se Demitir do Emprego de Transportador de Valores") bindKey ( source, LetraParaMarkers, "down", RecusarEmprego07 ) else exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'K' Para Aceitar o Emprego de Transportador de Valores") bindKey ( source, LetraParaMarkers, "down", AceitarEmprego07 ) end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),emarker) function lmarker(marker,md) if (md) then if marker == MakerTransportador then exports.Scripts_OnMarkerMsgs_:delete(source) unbindKey ( source, LetraParaMarkers, "down", AceitarEmprego07 ) unbindKey ( source, LetraParaMarkers, "down", RecusarEmprego07 ) end end end addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker) ------------------------------------------------------------------------------------------------------------------------------------------------------ function ComandosProf ( ThePlayer ) if getElementData ( ThePlayer, "Emprego" ) == "Transportador" then playSoundFrontEnd ( ThePlayer, 43 ) outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profissão #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #BEE09AComandos da Profissão de Transportador de Valores", 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/Transportar #ffffff- #9ABDE0Para Iniciar a Entrega dos Malotes", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #55D444ALT Esquerdo #ffffff- #9ABDE0Entrega o Malote no Marker da Entrega", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F96031» #FFD700Entre no Caminão de Valores, Digite /Transportar e Siga os Checkpoints!", ThePlayer, 255, 255, 255, true ) outputChatBox ( "#F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #F96031Profissão #F9A631~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ThePlayer, 255, 255, 255, true ) end end addCommandHandler(cmd1, ComandosProf ) -- local moneyPerTransportador = 10000 local TransportadorSkins = { [71]=true; } local TransportadorVehicles = { [498]=true; } -- Note that location name must correspond to the area in San Andreas you'd like Job available in, for example: ["RC"] won't work, instead, put ["Red County"] local locations = { ["San Andreas"] = { { 2534.708, 1969.196, 11.224 -1}; { 2189.125, 2459.45, 11.127 -1}; { 2106.925, 901.697, 11.232 -1}; { -5.474, 1193.666, 19.211 -1}; { -823.825, 1496.641, 19.253 -1}; { -1534.713, 2605.708, 55.686 -1}; { -2491.248, 2335.734, 4.836 -1}; { -2359.108, 1003.349, 50.703 -1}; { -2011.403, 443.272, 35.016 -1}; { -2599.528, 25.445, 4.18 -1}; { -1803.874, -127.844, 5.58 -1}; { 228.301, -187.859, 1.43 -1}; { 658.364, -576.345, 16.336 -1}; { 1383.188, 264.063, 19.57 -1}; { 2365.264, 86.898, 26.341 -1}; { 1052.542, -1136.714, 23.656 -1}; { 767.607, -1324.25, 13.391 -1}; { 1822.777, -1560.236, 13.367 -1}; { 1932.181, -1769.308, 13.383 -1}; }; } local function initializeOnVehicleEnter (p, s) --if p and s == 0 and pizzaSkins[getElementModel(p)] and pizzaVehicles[getElementModel(source)] then if getElementData ( p, "Emprego" ) == "Transportador" then if isElementWithinMarker( p, MarkerSafeTransportador) then local sourcePos = {getElementPosition(p)} local playerZone = getZoneName (sourcePos[1], sourcePos[2], sourcePos[3], true) if locations[playerZone] then triggerClientEvent (p, "requestTransportadorjobStart", p, locations[playerZone]) exports.Scripts_Dxmessages:outputDx( p, "Você Pegou os Malotes, Siga o Checkpoint para Entregar!", "info") --outputChatBox ("* PIZZA * Dica:#FFFFFF Utilize o Botão esquerdo do Mouse para Entregar a Pizza!", p, 255, 50, 50, true) end sourcePos = nil playerZone = nil end end end --addEventHandler ("onVehicleEnter", root, initializeOnVehicleEnter) addCommandHandler (cmd2, initializeOnVehicleEnter) addEvent ("payMeWhatYouOweMe", true) local function payMeWhatYouOweMe() givePlayerMoney (client, moneyPerTransportador) exports.Scripts_Dxmessages:outputDx(client, "Você recebeu $"..moneyPerTransportador.." Por Entregar um Malote, Siga Para a Proxima Entrega!", "success") setTimer (function(client) if not client then return end local sourcePos = {getElementPosition(client)} local playerZone = getZoneName (sourcePos[1], sourcePos[2], sourcePos[3], true) triggerClientEvent (client, "requestTransportadorjobStart", client, locations[playerZone]) sourcePos = nil playerZone = nil end, 1500, 1, client) end addEventHandler ("payMeWhatYouOweMe", root, payMeWhatYouOweMe) function removeHelmetOnExit ( thePlayer, seat, jacked ) triggerClientEvent ( "HurleyRoleplay:CancelarEmpregoTransportador", thePlayer ) end addEventHandler ( "onVehicleExit", getRootElement(), removeHelmetOnExit ) ------------------------------------------------------------------------------------------------------------------------------------------------------ Link to comment
Furzy Posted September 14, 2019 Share Posted September 14, 2019 Vc setou seu emprego para Transportador? setElementData(p,"Emprego","Transportador") Link to comment
dener189 Posted September 15, 2019 Author Share Posted September 15, 2019 9 hours ago, Furzy said: Vc setou seu emprego para Transportador? sim if getElementData (source, "HurleyRoleplay>Encaminhamento") == "Transportador" then setElementData (source, "HurleyRoleplay>Encaminhamento", false) setElementData (source, "Emprego", "Transportador") Link to comment
DNL291 Posted September 15, 2019 Share Posted September 15, 2019 Pode ser erro no código, use o comando /debugscript 3 para ver o debug. Pode ser a elementData inexistente, nesse caso uma depuração básica com outputChatBox e cada trecho irá te ajudar a encontrar onde surge o problema. Você também terá que adicionar o resource na ACL pois o mesmo utiliza a função aclGroupAddObject. Link to comment
dener189 Posted September 15, 2019 Author Share Posted September 15, 2019 9 minutes ago, DNL291 said: Pode ser erro no código, use o comando /debugscript 3 para ver o debug. Pode ser a elementData inexistente, nesse caso uma depuração básica com outputChatBox e cada trecho irá te ajudar a encontrar onde surge o problema. Você também terá que adicionar o resource na ACL pois o mesmo utiliza a função aclGroupAddObject. Tô ciente do aclGroupAddObject, já criei a ACL "Transportador" , tudo tá funcionando normal, menos abrir as rotas Link to comment
Furzy Posted September 15, 2019 Share Posted September 15, 2019 1 hour ago, dener189 said: Tô ciente do aclGroupAddObject, já criei a ACL "Transportador" , tudo tá funcionando normal, menos abrir as rotas /debugscript 3 e veja o erro que ta aparecendo quando tenta abrir Link to comment
dener189 Posted September 16, 2019 Author Share Posted September 16, 2019 19 hours ago, Furzy said: /debugscript 3 e veja o erro que ta aparecendo quando tenta abrir dei o comando, e mesmo assim quando eu dou o comando não aparece nem um erro '-' Link to comment
DNL291 Posted September 16, 2019 Share Posted September 16, 2019 Aonde tá a dificuldade de fazer uma depuração e testar os resultados... local function initializeOnVehicleEnter (p, s) --if p and s == 0 and pizzaSkins[getElementModel(p)] and pizzaVehicles[getElementModel(source)] then if getElementData ( p, "Emprego" ) == "Transportador" then if isElementWithinMarker( p, MarkerSafeTransportador) then local sourcePos = {getElementPosition(p)} local playerZone = getZoneName (sourcePos[1], sourcePos[2], sourcePos[3], true) outputChatBox("playerZone: "..tostring(playerZone), p) outputChatBox("locations[playerZone]: "..tostring(locations[playerZone]), p) if locations[playerZone] then if triggerClientEvent (p, "requestTransportadorjobStart", p, locations[playerZone]) then outputChatBox("Evento 'requestTransportadorjobStart' chamado com sucesso", p) end exports.Scripts_Dxmessages:outputDx( p, "Você Pegou os Malotes, Siga o Checkpoint para Entregar!", "info") --outputChatBox ("* PIZZA * Dica:#FFFFFF Utilize o Botão esquerdo do Mouse para Entregar a Pizza!", p, 255, 50, 50, true) end sourcePos = nil playerZone = nil else outputChatBox("Você não esta na marker!", p) end else outputChatBox("Você não é Transportador!", p) end end 1 Link to comment
dener189 Posted September 18, 2019 Author Share Posted September 18, 2019 On 16/09/2019 at 14:00, DNL291 said: Aonde tá a dificuldade de fazer uma depuração e testar os resultados... local function initializeOnVehicleEnter (p, s) --if p and s == 0 and pizzaSkins[getElementModel(p)] and pizzaVehicles[getElementModel(source)] then if getElementData ( p, "Emprego" ) == "Transportador" then if isElementWithinMarker( p, MarkerSafeTransportador) then local sourcePos = {getElementPosition(p)} local playerZone = getZoneName (sourcePos[1], sourcePos[2], sourcePos[3], true) outputChatBox("playerZone: "..tostring(playerZone), p) outputChatBox("locations[playerZone]: "..tostring(locations[playerZone]), p) if locations[playerZone] then if triggerClientEvent (p, "requestTransportadorjobStart", p, locations[playerZone]) then outputChatBox("Evento 'requestTransportadorjobStart' chamado com sucesso", p) end exports.Scripts_Dxmessages:outputDx( p, "Você Pegou os Malotes, Siga o Checkpoint para Entregar!", "info") --outputChatBox ("* PIZZA * Dica:#FFFFFF Utilize o Botão esquerdo do Mouse para Entregar a Pizza!", p, 255, 50, 50, true) end sourcePos = nil playerZone = nil else outputChatBox("Você não esta na marker!", p) end else outputChatBox("Você não é Transportador!", p) endend aparece um erro no chat Link to comment
DNL291 Posted September 19, 2019 Share Posted September 19, 2019 Quais mensagens mostra? 1 Link to comment
dener189 Posted September 19, 2019 Author Share Posted September 19, 2019 (edited) 20 hours ago, DNL291 said: Quais mensagens mostra? Consegui arrumar, apenas renomeei algumas linhas do script. Obrigado pela sua ajuda, e a ajuda dos demais Edited September 19, 2019 by dener189 Consegui arrumar :D 1 Link to comment
dener189 Posted September 20, 2019 Author Share Posted September 20, 2019 Bom as rotas funciona, mas ta com outro bug, quando chego no local da entrega e aperto a tecla para concluir a entrega "Alt" simplesmente não completa a entrega, apenas aparece o malote entregue no local Link to comment
DNL291 Posted September 23, 2019 Share Posted September 23, 2019 Mostre o seu código. 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