Giter Club home page Giter Club logo

Comments (4)

GalaxHD551 avatar GalaxHD551 commented on June 12, 2024

Automatic doors, need a police car @diegobh

from onsetrp.

diegobh avatar diegobh commented on June 12, 2024

Automatic doors, need a police car @diegobh

I tried and it don't works. Tried with the police car id = 3;

Still tried add:

table.insert(doorstocheck, { door = 6, vehid = 3 })
table.insert(doorstocheck, { door = 19, vehid = 3 })

to salsi\vehdoors.lua

But still don't worked.

Any idea what im missing, please?

Thank you very much!

from onsetrp.

GalaxHD551 avatar GalaxHD551 commented on June 12, 2024

Maybe you forgot something, like the package.json ? Are you sure about the id for these doors ?

from onsetrp.

diegobh avatar diegobh commented on June 12, 2024

Maybe you forgot something, like the package.json ? Are you sure about the id for these doors ?

It's really bugged.
But it's salsi's repo build bug.

frederic2ec help me and gives me the script to fix this error. I made small changes to it work.

Create the file: doorcheck.lua in: packages\salsi folder:

local modelstocheck = {
    {door = 6, vehid = 3},
    {door = 18, vehid = 3},
	{door = 19, vehid = 3}
}
local doorstocheck = {}

function check_doors2()
    local doorstoopen = {}
    local doorstoclose = {}
    for i, ply in pairs(GetAllPlayers()) do
        for i, door in pairs(doorstocheck) do
            for i, v in ipairs(modelstocheck) do
                if v.door == GetDoorModel(door) then
                    if GetVehicleModel(GetPlayerVehicle(ply)) == v.vehid then
                        local veh = GetPlayerVehicle(ply)
                        local x,y,z = GetDoorLocation(door)
                        local x2,y2,z2 = GetVehicleLocation(veh)
                        local dist = GetDistance3D(x, y, z, x2, y2, z2)

                        if dist < 700 then
                            if GetPlayerCount() > 1 then
                                doorstoopen[door] = true
                            else
                                SetDoorOpen(door, true)
                            end
                        else
                            if GetPlayerCount() > 1 then
                                doorstoclose[door] = true
                            else
                                SetDoorOpen(door, false)
                            end
                        end
                    else
                        doorstoclose[door] = true
                    end
                end
            end
        end
    end

    for kc,vc in pairs(doorstoclose) do
        if doorstoopen[kc] then
            SetDoorOpen(kc, true)
        else
            SetDoorOpen(kc, false)
        end
    end

    for ko,vo in pairs(doorstoopen) do 
        SetDoorOpen(ko, true)
    end
end

AddEvent("OnPackageStart",function()
    for i,door in pairs(GetAllDoors()) do
        for i, v in ipairs(modelstocheck) do
            if v.door == GetDoorModel(door) then
                table.insert(doorstocheck, door)
            end
        end
    end
    CreateTimer(check_doors2, 200)
end)

Add the script in packages\salsi\package.json:

"server_scripts": [
        "simpletp/server.lua",
        "detector/server.lua",
        "vehdoors.lua",
        "screenbroke.lua",
		"doorcheck.lua"
    ],

Be happy ;)

from onsetrp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.