Jump to content

Siren remover


Peti930

Recommended Posts

Hi, i have a script with i type /addvillogo and add a siren to my car, but i want /delvillogo with i can delete the siren wath I created and want /delallvillogo with delete a siren by created anyone. And anyone can make me an sql to this?

loader.lua:

function ChangeObjectModel (filename,id)
    if id and filename then
        if fileExists(filename..".txd") then
            txd = engineLoadTXD( filename..".txd" )
            engineImportTXD( txd, id )
        end            
        if fileExists(filename..".dff") then
            dff = engineLoadDFF( filename..".dff", 0 )
            engineReplaceModel( dff, id )
        end        
        if fileExists(filename..".col") then
            col = engineLoadCOL( filename..".col" )
            engineReplaceCOL( col, id )
        end            
        engineSetModelLODDistance(id,300)
    end
end

ChangeObjectModel("block",1632)

siren.lua:

mysql = exports.mysql --Script be: @Peti

local chargerPos = {
    [445] = {0,0,-0.05}, -- BMW M5         Poz. X Y Z
}

local vehicleChargers = {}

function ElementDataChange(dataName,oldValue)
    if getElementType(source) == "vehicle" and dataName == "tuning.superCharger" then
        local newValue = getElementData(source,dataName)
        --outputChatBox(newValue)
        if tonumber(newValue) == 0 then
            --outputChatBox("#7cc576[PetiScripts]: #ffffffSikeresen törölted a SuperCharger kiegészítőt!", p, 255, 0, 0, true)
            destroyElement(vehicleChargers[getElementData(source,"dbid")])
            if (isElement(vehicleChargers[getElementData(source,"dbid")])) then
                destroyElement(vehicleChargers[getElementData(source,"dbid")])
            end
        else
            createChargerToVeh(getElementData(source,"dbid"),source)
        end
    end
end
addEventHandler("onElementDataChange",getRootElement(),ElementDataChange)

function loadChargers(vehicle)
    for k, v in ipairs(getElementsByType("vehicle")) do
        if tonumber(getElementData(v, "tuning.superCharger")) == 1 then
            createChargerToVeh(getElementData(v, "dbid"), v)
        end
    end
end
addEventHandler("onResourceStart", getRootElement(), loadChargers)

function createChargerToVeh(vehID,element)
    if isElement(vehicleChargers[vehID]) then return end
    vehicleChargers[vehID] = createObject(1632,0,0,0)
    attachElements(vehicleChargers[vehID],element,chargerPos[getElementModel(element)][1],chargerPos[getElementModel(element)][2],chargerPos[getElementModel(element)][3])
end

function destroyCharger(vehID)
    local veh = getPedOccupiedVehicle(p)
    if (isElement(vehicleChargers[vehID])) then
        destroyElement(vehicleChargers[vehID])
    end
end

addCommandHandler("addvillogo",function(p,c,state)
    if state then
        outputChatBox("[SanMTA - Peti] Sikeresen felszerelted az egyedi villogót!", p)
        if isPedInVehicle(p) then
            outputChatBox("", p)
            local veh = getPedOccupiedVehicle(p)
            local vehid = getElementData(veh, "dbid")
            setElementData(getPedOccupiedVehicle(p),"tuning.superCharger",state)
            --mysql:query_free("UPDATE vehicles SET supercharger = '" .. state .. "' WHERE id='" .. getElementData(veh, "dbid") .. "'")
        end
    end
end)

 

Link to comment
  • Discord Moderators

If you cant even implement a MySQL save for this, then i dont think, that u are the one who wrote this script.Mostly because of line 50, its a gm called SanMTA, which is a totally edited gm from ExternalGaming, and such gms, therefore i think this topic should be closed, since we do not provide help with stolen scripts.

@Dutchman101

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