Jump to content

Closed doors


dima3367

Recommended Posts

Hello, please tell me, how do I do so that the players could not in any way to open the doors for players to drgua car.
My script works works as a player gets in the car, then I used the function:

bool setVehicleLocked ( vehicle theVehicle, bool locked )

The doors are closed and it is impossible to sit down. But there is a bug, if the player in advance would open the door and quickly gone, the door will be shown as open. The player sits in the car through the other (closed) door, the machine once again uses setVehicleLocked However, another player can steal a car if he sits through the door, which was opened in advance. Meanwhile sama he could steal his car.

 

How can I fix it?

I apologize in advance for the bad english.

Link to comment

Not much I can understand how it can be implemented immediately.
This is the server part of the script:
 

createBlip(1904.80798, -1875.38660, 13.56194,46)
local sweeperki = {

{1904.80798, -1875.38660, 13.56194, 270},
{1904.80798, -1870.38660, 13.56194, 270},
{1904.80798, -1865.38660, 13.56194, 270},
{1904.80798, -1860.38660, 13.56194, 270},
{1904.80798, -1855.38660, 13.56194, 270},
{1904.80798, -1850.38660, 13.56194, 270},
{1917.8698, -1862.37256 , 13.56194, 90},
{1921.8698, -1862.37256 , 13.56194, 90},
{1925.8698, -1862.37256 , 13.56194, 90},
}

for i,v in ipairs(sweeperki) do
    v.sweeper = createVehicle(574, v[1], v[2], v[3], 0, 0, v[4])
    setElementData(v.sweeper, "sweeper:dopracy", 1) 
    setElementFrozen(v.sweeper, true)
    setVehicleLocked(v.sweeper, false)
    setVehicleDamageProof(v.sweeper, true )
end

local punkty = {
[1] = {1954.08594, -1874.65625, 13.54688},
[2] = {1954.26794, -1886.18250, 13.54688},
[3] = {1954.13489, -1897.88843, 13.54688},
[4] = {1954.27319, -1909.31433, 13.54688},
[5] = {1951.84375, -1924.82556, 13.54688},
[6] = {1941.38416, -1924.69043, 13.54688},
[7] = {1926.11865, -1924.13684, 13.54688},
[8] = {1911.16296, -1924.30396, 13.54688},
[9] = {1896.21094, -1924.20935, 13.54688},
[10] = {1873.53076, -1924.54944, 13.54688},
[11] = {1858.87756, -1924.69458, 13.54688},
[12] = {1848.70020, -1924.64734, 13.54688},
[13] = {1833.95801, -1924.28638, 13.54688},
[14] = {1829.27258, -1920.93982, 13.54875},
[15] = {1829.00964, -1908.74426, 13.51301},
[16] = {1829.18213, -1898.01489, 13.47368},
[17] = {1829.21655, -1887.19006, 13.47277},
[18] = {1829.34045, -1855.69873, 13.57813},
[19] = {1829.15881, -1835.55383, 13.77813},
[20] = {1829.06641, -1817.33350, 13.57336},
[21] = {1828.96204, -1800.64502, 13.55298},
[22] = {1829.54895, -1787.36963, 13.54688},
[23] = {1829.43481, -1773.53503, 13.54688},
[24] = {1833.90747, -1760.08167, 13.54688},
[25] = {1845.34924, -1760.04407, 13.54688},
[26] = {1860.09766, -1759.97449, 13.54688},
[27] = {1870.29443, -1759.97632, 13.54688},
[28] = {1889.15906, -1759.92346, 13.54688},
[29] = {1922.46289, -1759.83020, 13.54688},
[30] = {1953.61145, -1771.04236, 13.54688},
[31] = {1953.99561, -1807.84521, 13.54688},
[32] = {1954.12012, -1817.94287, 13.54688},
[33] = {1954.80115, -1837.05542, 13.53908},
[34] = {1954.49500, -1856.19482, 13.54688}
}

function nextPunkt(plr, id)
    local x,y,z = punkty[id][1], punkty[id][2], punkty[id][3]
    triggerClientEvent(plr, "postawSweeperMarker", plr, x, y, z)
end


function startSweeperki(veh, seat)
    if getElementData(veh, "sweeper:dopracy") == 1 and seat == 0 then
    outputChatBox("Диспетчер Анна: Добро пожаловать на работу уборщика улиц.", source)
    outputChatBox("Диспетчер Анна: Продолжайте  движение по синим маркерам!", source)
    outputChatBox("Диспетчер Анна: За каждый круг тебе заплатят 500$", source)
    nextPunkt(source, 1)
    setElementFrozen(veh, false)
	setVehicleLocked(veh, true)
    setVehicleDamageProof(veh, true )
    setElementData(source, "sweeper:smiec", 1)
    setElementData(source, "sweeper:zebrane", 0)
    if veh then
		fixVehicle(veh)
	end
    end
end
addEventHandler("onPlayerVehicleEnter", getRootElement(), startSweeperki)

function stopSweeperki(veh, seat)
    if getElementData(veh, "sweeper:dopracy") == 1 and seat == 0 then
        respawnVehicle(veh)
        setElementFrozen(veh, true)
	    setVehicleLocked(veh, false)
        setVehicleDamageProof(veh, true )
        triggerClientEvent(source, "usunSweeperMarker", source)
    end
end
addEventHandler("onPlayerVehicleExit", getRootElement(), stopSweeperki)

function serverSweeperHit(plr)
    if (getElementData(plr, "sweeper:smiec")+1) == #punkty then
        setElementData(plr, "sweeper:smiec", 1)
        nextPunkt(plr, 1)
        exports["tws-main"]:givePlayerMoney(plr, 500)
		outputChatBox("Диспетчер Анна: Вы получили 500$, можете продолжить или закончить, оставив машину.", source)
    else
        setElementData(plr, "sweeper:smiec", getElementData(plr, "sweeper:smiec")+1)
        nextPunkt(plr, getElementData(plr, "sweeper:smiec"))
    end
end
addEvent("sweeperkiHitFunction", true)
addEventHandler("sweeperkiHitFunction", getRootElement(), serverSweeperHit)

Could you show an example?

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