Jump to content

Ajuda com mensagem floodando!


Recommended Posts

Olá pessoal

Gostaria de saber se alguem pode me ajudar com isso, esse codigo faz parte de uma concessionaria, que estou editando as mensagens mas essas mensagens dai (voce nao tem dinheiro para comprar esse carro!) (voce pode comprar apenas 10 carros) ficam floodando aparece umas 20 vezes nao sei porque alguem consegue me dar uma ajuda aqui porfavor?

Lembrando que esse mod foi retirado da Net não é meu

 

function(Model, cost, r1, g1, b1, r2, g2, b2)
    abc = false
    local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ?", getAccountName(getPlayerAccount(source))), -1)
    for i, data in ipairs (data) do
        if data["Model"] == Model then
            abc = true
            break
        end
    end
    if #data >= 10 then outputChatBox("Você pode comprar apenas 10 veiculos!", source, 38, 122, 216, true) return end
    if abc == true then 
        return 
    end
    if getPlayerMoney(source) >= tonumber(cost) then
        takePlayerMoney ( source, cost )
        local x, y, z = getElementPosition(source)
        local _, _, rz = getElementRotation(source)
        local shopID = getElementData ( source, "atVehShop")
        local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2
        if shopID and shopsVehSpawns[shopID] then
            vehicle = createVehicle(Model, shopsVehSpawns[shopID][1], shopsVehSpawns[shopID][2], shopsVehSpawns[shopID][3], shopsVehSpawns[shopID][4], shopsVehSpawns[shopID][5], shopsVehSpawns[shopID][6])
        else
            vehicle = createVehicle(Model, x-5, y+5, z, 0, 0, rz)
        end
        setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2)
        setElementData(vehicle, "Owner", source)
        local NewID = getFreeID()
        local Placa = getElementData(vehicle,"Placa") 
        if Placa == nil or not Placa then
        local NewPlate = getFreePlate(vehicle,id, source)
        end
        local Placa = getElementData(vehicle,"Placa") 
        setElementData(vehicle, "ID", NewID)
        dbExec(db, "INSERT INTO VehicleList VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", NewID, Placa, getAccountName(getPlayerAccount(source)), Model, x-5, y+5, z, rz, color, "", 3, false, cost, 1000, 0)
        updateVehicleInfo(source)
        setElementData(vehicle, "ownercar", getAccountName(getPlayerAccount(source)))
        warpPedIntoVehicle ( source, vehicle )
        vv[vehicle] = setTimer(function(source)
            if not isElement(source) then killTimer(vv[source]) vv[source] = nil end
            if isElement(source) and getElementHealth(source) <= 255 then
                setElementHealth(source, 255.5)
                setVehicleDamageProof(source, true)
                setVehicleEngineState(source, false)
            end
        end, 150, 0, vehicle)
        addEventHandler("onVehicleDamage", vehicle,
        function(loss)
            local account = getAccountName(getPlayerAccount(getElementData(source, "Owner")))
            setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source)
        end)
        addEventHandler("onVehicleEnter", vehicle,
        function(player)
            if getElementHealth(source) <= 255.5 then 
                setVehicleEngineState(source, false)
            else
                if isVehicleDamageProof(source) then
                    setVehicleDamageProof(source, false)
                end
            end
        end)
    else
        outputChatBoxError ("Você não tem dinheiro suficiente para esse carro!", source, 38, 122, 216, true)
    end
end)

Edited by Im_PlayerGTA
Link to comment
  • Scripting Moderators

Hi, welcome to the forums!

Your thread has been moved to a more language-specific section so that you can get better answers in your native language.

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