Jump to content

bugs mission


MaRcell

Recommended Posts

good my mission system appeared some bugs like the player makes the mission and not earn money and not the xp anyone help me?

-- server 
local playerMission1 = nil -- jogador da missao 
local markerMission = createMarker(2500.74951, -1674.49402, 12.35166,"cylinder", 2, 255, 0, 0, 255) -- pode continuar kk 
local blipMission1 = createBlip (2500.74951 ,-1674.49402, 13.35166 ,15) 
local blipDestination1 = nil 
local botPrincipal1 = nil 
local botMissionTeam = createTeam("botMissionTeam",0,0,0) 
  
function onMarkerMissionHit(Element) 
    local t = getElementType(Element) 
    if(t == "player" and playerMission1 == nil)then  
    playerMission = Element 
    outputChatBox("#ffffff[MISSAO] mate o chefe dos ballas.",playerMission1,255,255,255,true) 
    blipDestination1 = createBlip(2324.74756, -1532.23267, 25.34375)---pronto 
    botPrincipal1 = exports [ "slothBot" ]:spawnBot(2289.10254 ,-1528.64917 ,26.87500,90,104,0,0,botMissionTeam,31,"guarding") 
    addEventHandler("onPedWasted",botPrincipal1,onPedWasted) 
    addEventHandler("onPlayerWasted",playerMission1,PlayerPrincipalPerde) 
    addEventHandler("onPlayerQuit",playerMission1,PlayerPrincipalPerde) 
  
    for i=1,4 do  
    randomBot = exports [ "slothBot" ]:spawnBot(2289.10254+math.cos(math.rad(math.random(0,360)))*math.random(-3,3),-1528.64917+math.sin(math.rad(math.random(0,360)))*math.random(-3,3),29.87500,90,103,0,0,botMissionTeam,31,"hunting") 
    setElementData(randomBot,"botMissionKill",true) 
    end 
  
    end 
end 
addEventHandler("onMarkerHit",markerMission,onMarkerMissionHit) -- n exatamente faltas coisa tanto no blips quanto o marker 
  
function onPedWasted() -- quando o bot principal morrer o que acontece? 
givePlayerMoney (playerMission1, 20000) 
exports.Manawydan_expSystem:addPlayerExp(playerMission,10)-- da 50 de exp 
outputChatBox('#ffffffMISSAO COMPLETA +20MIl.',playerMission1,255,255,255,true) 
destroyElement(blipDestination1) 
blipDestination1 = nil 
removeEventHandler("onPedWasted",botPrincipal1,onPedWasted) -- pode ser denecessario 
removeEventHandler("onPlayerWasted",playerMission1,PlayerPrincipalPerde) 
removeEventHandler("onPlayerQuit",playerMission1,PlayerPrincipalPerde) 
playerMission1 = nil 
 MatarBotsVivos() 
end 
  
function PlayerPrincipalPerde() 
    outputChatBox("missao fracassada voce morreu",playerMission1) 
     
    removeEventHandler("onPedWasted",botPrincipal1,onPedWasted) 
    removeEventHandler("onPlayerWasted",playerMission1,PlayerPrincipalPerde) 
    removeEventHandler("onPlayerQuit",playerMission1,PlayerPrincipalPerde) 
    destroyElement(blipDestination1) 
    blipDestination1 = nil 
    playerMission1 = nil 
        MatarBotsVivos() 
end 
  
function MatarBotsVivos() 
    if(botPrincipal1 and isElement(botPrincipal))then destroyElement(botPrincipal1) end -- destruir bot se exitir 
    local allPeds = getElementsByType("ped") -- pega todos os peds 
    for k,v in ipairs (allPeds) do 
        if(getElementData(v,"botMissionKill"))then  -- checa se tem a data da missao 
            destroyElement(v) -- destroi eles 
            end 
      end 
       botPrincipal1 = nil 
end 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...