Jump to content

outputChatBox now working


Recommended Posts

so, im making a /dv to destroy vehicles and the highlighted 'outputChatBox' isnt working.

addCommandHandler("dv",
function(playerSource,commandName,id)
    if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup ("Staff")) then --checks ACL
        local v1 = getElementData(playerSource, "onProt")
        if v1 == true then -- checks if the player is in the staff mode i created
            if(id) then 
                local playerID = tonumber(id)
                if(playerID) then
                    local targetPlayer, targetPlayerName = getPlayerID(playerID)
                    if targetPlayer then
                        local carro = isPedInVehicle(targetPlayer)
                        if carro == true then -- whithout this, the vehicle gets destroyed and the next else message is sent
                            local veh = getPedOccupiedVehicle(targetPlayer)
                            if veh then -- if I get to here, the code destroy the vehicle but doesnt send the message
                                destroyElement(veh) -- destroy the element
                                outputChatBox('O veículo foi destruido!',playerSource) -- but doesnt send this
                            end
                        else
                            outputChatBox("O jogador não está em um Veiculo", playerSource)-- 'next else message'
                        end
                    else
                        outputChatBox('O jogador não existe!',playerSource) -- works fine
                    end
                else
                end
            else
                local veh = getPedOccupiedVehicle(playerSource)
                if veh then
                    destroyElement(veh)-- works fine
                    outputChatBox('O veículo foi destruido!',playerSource)-- works fine
                else
                    outputChatBox("Você não está em um Veiculo", playerSource)-- works fine
                end
            end
        else
            addBox(playerSource, "Você não está no /staff!", "info")-- works fine
        end        
    end
end
)

I havent tested it with other players.
This happens whenever I try /dv [my ID], while being in a vehicle

Sorry about the title, its ''outputChatBox not working"

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...