Habe das jetzt so Gemacht
Spoiler anzeigen
Lua
-- welt objecte --
removeWorldModel(9623, 50, -2681.3515625, 1274.609375, 57.421875)
removeWorldModel(9868, 50, -2681.3515625, 1274.609375, 57.421875)
-- VARIABLEN --
local mautstellenpreis = 25
local gate = {}
local gatevar = {}
local gatemoving = {}
local gatecol = {}
local movingtimer = {}
local ped = {}
local disallowed = {
[455] = true
}
-- GATES --
-- Von SF nach LV --
-- ALLE TORE SIND ZU BEIM START --
-- Einfahrt(nach LV)
local temp = 1
gate[temp] = createObject(968, -1658.3016357422, 544.09899902344, 37.900001525879, 0, 88.994781494141, 315.24426269531)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1658.9656982422, 537.95556640625, 38.231918334961, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt(nach SF)
temp = 2
gate[temp] = createObject(968, -1673.673828125, 547.4609375, 37.899982452393, 0, 90, 137)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1672.9270019531, 553.46875, 38.230781555176, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- Von LV nach SF --
-- Einfahrt (Nach SF)
temp = 3
gate[temp] = createObject(968, -1139.9455566406, 1110.1457519531, 38.011909484863, 0, 90, 135)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1139.1903076172, 1116.265625, 38.066013336182, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (nach LV)
temp = 4
gate[temp] = createObject(968, -1123.8515625, 1107.2841796875, 37.839832305908, 0, 90, 315)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1124.2266845703, 1101.5460205078, 38.077590942383, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- von SF nach Bayside --
-- Einfahrt (nach Bayside)--
temp = 5
gate[temp] = createObject(968, -2672.1806640625, 1277.4462890625, 55.314693450928, 0, 90, 0)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2669.1574707031, 1272.1342773438, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (von Bayside)
temp = 6
gate[temp] = createObject(968, -2690.8325195313, 1267.7491455078, 55.343799591064, 0, 90, 180)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2694.3657226563, 1273.1763916016, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- von Bayside nach SF --
-- Einfahrt (nach SF) --
temp = 7
gate[temp] = createObject(968, -2688.9206542969, 2161.6372070313, 55.229675292969, 0, 90, 180)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2692.2014160156, 2165.6672363281, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (nach Bayside)
temp = 8
gate[temp] = createObject(968, -2675.4311523438, 2170.5581054688, 55.20467376709, 0, 90, 1.4)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2672.0085449219, 2165.3879394531, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
for index, col in next, gatecol do
addEventHandler("onColShapeHit", col, function(hitElement)
if(getElementType(hitElement) == "vehicle") and (getVehicleOccupant(hitElement)) then
local id = tonumber(getElementData(source, "mautstellenid"))
if(gatevar[id] == true) then return end
if(gatemoving[id] == true) then
stopObject(gate[id])
if(isTimer(movingtimer[id])) then
killTimer(movingtimer[id])
end
local x, y, z = getElementRotation(gate[id])
setElementRotation(gate[id], x, 90, z)
end
local thePlayer = getVehicleOccupant(hitElement)
if not(getVehicleSirensOn(hitElement)) then
if(getElementData(source, "weiterfahrt") ~= true) then
if(getPlayerMoney(thePlayer) -mautstellenpreis) then
outputChatBox("Du benoetigst "..mautstellenpreis.."$ um diese Mautstelle zu passieren.", thePlayer, 255, 0, 0)
return
end
end
if(getPlayerMoney(source, "weiterfahrt") ~= true) then
givePlayerMoney(thePlayer, -mautstellenpreis)
setPedAnimation(thePlayer, "CAR", "Sit_relaxed", -1, true, false, false)
end
end
local col = source
setTimer(function()
local id2 = getElementModel(hitElement)
if(disallowed[id2]) and (disallowed[id2] == true) then
local rand = math.random(0, 5)
if(rand == 5) then
-- SICHERHEITSHINWEIS --
outputChatBox("Zollbeamter: Sie transportieren illegale Ware! Steigen sie sofort aus!", thePlayer, 255, 255, 255)
if(getPlayerWantedLevel(thePlayer) < 2) then
setPlayerWantedLevel(thePlayer, getPlayerWantedLevel(thePlayer)+2)
end
return
end
end
if not(getVehicleSirensOn(hitElement)) then
if(getPlayerWantedLevel(thePlayer) > 1) then
outputChatBox("Zollbeamter: Steigen sie sofort aus ihrem Fahrzeug, sie werden gesucht!", thePlayer, 255, 255, 255)
return
end
end
if(getPlayerMoney(col, "weiterfahrt") ~= true) then
setPedAnimation(thePlayer)
outputChatBox("Zollbeamter: Gute Weiterfahrt!", thePlayer, 255, 255, 255)
end
gatemoving[id] = true
gatevar[id] = true
local x, y, z = getElementPosition(gate[id])
moveObject(gate[id], 1000, x, y, z, 0, -90, 0, "InOutQuad")
movingtimer[id] = setTimer(function()
gatemoving[id] = false
end, 1000, 1)
end, 1000, 1)
end
end)
addEventHandler("onColShapeLeave", col, function(hitElement)
if(getElementType(hitElement) == "vehicle") and (getVehicleOccupant(hitElement)) then
local id = tonumber(getPlayerMoney(source, "mautstellenid"))
if(gatevar[id] == false) then return end
if(gatemoving[id] == true) then
stopObject(gate[id])
killTimer(movingtimer[id])
local x, y, z = getElementRotation(gate[id])
setElementRotation(gate[id], x, 0, z)
gatemoving[id] = false
end
local time = 1000
if(getVehicleTowedByVehicle(hitElement)) then
time = 3000
end
setTimer(function()
local thePlayer = getVehicleOccupant(hitElement)
gatemoving[id] = true
gatevar[id] = false
local x, y, z = getElementPosition(gate[id])
moveObject(gate[id], 1000, x, y, z, 0, 90, 0, "InOutQuad")
movingtimer[id] = setTimer(function()
gatemoving[id] = false
end, 1000, 1)
end, time, 1)
end
end)
end
Alles anzeigen
Aber jetzt habe ich ein error in zeile 174
Error : ERROR : [gamemodes]\[vio]\vio\mautstellen\server.lua:174: table index is nil
Die Zeile :
Zitatjetzt habe ich ein error in zeile 174
Error : ERROR : [gamemodes]\[vio]\vio\mautstellen\server.lua:174: table index is nil
Error Behoben in einer zeile wahr getPlayerMoney Fehl am platz hab draus getElementData Gemacht aber es geht immer noch net !
Aber sie mauntstellen gehen immernoch net
Bitte Hilfe hier nochmal sie server.lua
Spoiler anzeigen
Lua
-- welt objecte --
removeWorldModel(9623, 50, -2681.3515625, 1274.609375, 57.421875)
removeWorldModel(9868, 50, -2681.3515625, 1274.609375, 57.421875)
-- VARIABLEN --
local mautstellenpreis = 25
local gate = {}
local gatevar = {}
local gatemoving = {}
local gatecol = {}
local movingtimer = {}
local ped = {}
local disallowed = {
[455] = true
}
-- GATES --
-- Von SF nach LV --
-- ALLE TORE SIND ZU BEIM START --
-- Einfahrt(nach LV)
local temp = 1
gate[temp] = createObject(968, -1658.3016357422, 544.09899902344, 37.900001525879, 0, 88.994781494141, 315.24426269531)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1658.9656982422, 537.95556640625, 38.231918334961, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt(nach SF)
temp = 2
gate[temp] = createObject(968, -1673.673828125, 547.4609375, 37.899982452393, 0, 90, 137)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1672.9270019531, 553.46875, 38.230781555176, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- Von LV nach SF --
-- Einfahrt (Nach SF)
temp = 3
gate[temp] = createObject(968, -1139.9455566406, 1110.1457519531, 38.011909484863, 0, 90, 135)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1139.1903076172, 1116.265625, 38.066013336182, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (nach LV)
temp = 4
gate[temp] = createObject(968, -1123.8515625, 1107.2841796875, 37.839832305908, 0, 90, 315)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1124.2266845703, 1101.5460205078, 38.077590942383, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- von SF nach Bayside --
-- Einfahrt (nach Bayside)--
temp = 5
gate[temp] = createObject(968, -2672.1806640625, 1277.4462890625, 55.314693450928, 0, 90, 0)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2669.1574707031, 1272.1342773438, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (von Bayside)
temp = 6
gate[temp] = createObject(968, -2690.8325195313, 1267.7491455078, 55.343799591064, 0, 90, 180)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2694.3657226563, 1273.1763916016, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- von Bayside nach SF --
-- Einfahrt (nach SF) --
temp = 7
gate[temp] = createObject(968, -2688.9206542969, 2161.6372070313, 55.229675292969, 0, 90, 180)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2692.2014160156, 2165.6672363281, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (nach Bayside)
temp = 8
gate[temp] = createObject(968, -2675.4311523438, 2170.5581054688, 55.20467376709, 0, 90, 1.4)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2672.0085449219, 2165.3879394531, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
for index, col in next, gatecol do
addEventHandler("onColShapeHit", col, function(hitElement)
if(getElementType(hitElement) == "vehicle") and (getVehicleOccupant(hitElement)) then
local id = tonumber(getElementData(source, "mautstellenid"))
if(gatevar[id] == true) then return end
if(gatemoving[id] == true) then
stopObject(gate[id])
if(isTimer(movingtimer[id])) then
killTimer(movingtimer[id])
end
local x, y, z = getElementRotation(gate[id])
setElementRotation(gate[id], x, 90, z)
end
local thePlayer = getVehicleOccupant(hitElement)
if not(getVehicleSirensOn(hitElement)) then
if(getElementData(source, "weiterfahrt") ~= true) then
if(getPlayerMoney(thePlayer) -mautstellenpreis) then
outputChatBox("Du benoetigst "..mautstellenpreis.."$ um diese Mautstelle zu passieren.", thePlayer, 255, 0, 0)
return
end
end
if(getPlayerMoney(source, "weiterfahrt") ~= true) then
givePlayerMoney(thePlayer, -mautstellenpreis)
setPedAnimation(thePlayer, "CAR", "Sit_relaxed", -1, true, false, false)
end
end
local col = source
setTimer(function()
local id2 = getElementModel(hitElement)
if(disallowed[id2]) and (disallowed[id2] == true) then
local rand = math.random(0, 5)
if(rand == 5) then
-- SICHERHEITSHINWEIS --
outputChatBox("Zollbeamter: Sie transportieren illegale Ware! Steigen sie sofort aus!", thePlayer, 255, 255, 255)
if(getPlayerWantedLevel(thePlayer) < 2) then
setPlayerWantedLevel(thePlayer, getPlayerWantedLevel(thePlayer)+2)
end
return
end
end
if not(getVehicleSirensOn(hitElement)) then
if(getPlayerWantedLevel(thePlayer) > 1) then
outputChatBox("Zollbeamter: Steigen sie sofort aus ihrem Fahrzeug, sie werden gesucht!", thePlayer, 255, 255, 255)
return
end
end
if(getPlayerMoney(col, "weiterfahrt") ~= true) then
setPedAnimation(thePlayer)
outputChatBox("Zollbeamter: Gute Weiterfahrt!", thePlayer, 255, 255, 255)
end
gatemoving[id] = true
gatevar[id] = true
local x, y, z = getElementPosition(gate[id])
moveObject(gate[id], 1000, x, y, z, 0, -90, 0, "InOutQuad")
movingtimer[id] = setTimer(function()
gatemoving[id] = false
end, 1000, 1)
end, 1000, 1)
end
end)
addEventHandler("onColShapeLeave", col, function(hitElement)
if(getElementType(hitElement) == "vehicle") and (getVehicleOccupant(hitElement)) then
local id = tonumber(getElementData(source, "mautstellenid"))
if(gatevar[id] == false) then return end
if(gatemoving[id] == true) then
stopObject(gate[id])
killTimer(movingtimer[id])
local x, y, z = getElementRotation(gate[id])
setElementRotation(gate[id], x, 0, z)
gatemoving[id] = false
end
local time = 1000
if(getVehicleTowedByVehicle(hitElement)) then
time = 3000
end
setTimer(function()
local thePlayer = getVehicleOccupant(hitElement)
gatemoving[id] = true
gatevar[id] = false
local x, y, z = getElementPosition(gate[id])
moveObject(gate[id], 1000, x, y, z, 0, 90, 0, "InOutQuad")
movingtimer[id] = setTimer(function()
gatemoving[id] = false
end, 1000, 1)
end, time, 1)
end
end)
end
Alles anzeigen
Habe Jetzt So oft rumproebiert und hat net geklappt hier die server.lua nochmal
Spoiler anzeigen
Lua
-- welt objecte --
removeWorldModel(9623, 50, -2681.3515625, 1274.609375, 57.421875)
removeWorldModel(9868, 50, -2681.3515625, 1274.609375, 57.421875)
-- VARIABLEN --
local mautstellenpreis = 25
local gate = {}
local gatevar = {}
local gatemoving = {}
local gatecol = {}
local movingtimer = {}
local ped = {}
local disallowed = {
[455] = true
}
-- GATES --
-- Von SF nach LV --
-- ALLE TORE SIND ZU BEIM START --
-- Einfahrt(nach LV)
local temp = 1
gate[temp] = createObject(968, -1658.3016357422, 544.09899902344, 37.900001525879, 0, 88.994781494141, 315.24426269531)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1658.9656982422, 537.95556640625, 38.231918334961, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt(nach SF)
temp = 2
gate[temp] = createObject(968, -1673.673828125, 547.4609375, 37.899982452393, 0, 90, 137)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1672.9270019531, 553.46875, 38.230781555176, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- Von LV nach SF --
-- Einfahrt (Nach SF)
temp = 3
gate[temp] = createObject(968, -1139.9455566406, 1110.1457519531, 38.011909484863, 0, 90, 135)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1139.1903076172, 1116.265625, 38.066013336182, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (nach LV)
temp = 4
gate[temp] = createObject(968, -1123.8515625, 1107.2841796875, 37.839832305908, 0, 90, 315)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-1124.2266845703, 1101.5460205078, 38.077590942383, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- von SF nach Bayside --
-- Einfahrt (nach Bayside)--
temp = 5
gate[temp] = createObject(968, -2672.1806640625, 1277.4462890625, 55.314693450928, 0, 90, 0)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2669.1574707031, 1272.1342773438, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (von Bayside)
temp = 6
gate[temp] = createObject(968, -2690.8325195313, 1267.7491455078, 55.343799591064, 0, 90, 180)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2694.3657226563, 1273.1763916016, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
-- von Bayside nach SF --
-- Einfahrt (nach SF) --
temp = 7
gate[temp] = createObject(968, -2688.9206542969, 2161.6372070313, 55.229675292969, 0, 90, 180)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2692.2014160156, 2165.6672363281, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
-- Ausfahrt (nach Bayside)
temp = 8
gate[temp] = createObject(968, -2675.4311523438, 2170.5581054688, 55.20467376709, 0, 90, 1.4)
gatevar[temp] = false
gatemoving[temp] = false
gatecol[temp] = createColSphere(-2672.0085449219, 2165.3879394531, 55.4296875, 5)
setElementData(gatecol[temp], "mautstellenid", temp)
setElementData(gatecol[temp], "weiterfahrt", true)
for index, col in next, gatecol do
addEventHandler("onColShapeHit", col, function(hitElement)
if(getElementType(hitElement) == "vehicle") and (getVehicleOccupant(hitElement)) then
local id = tonumber(getElementData(source, "mautstellenid"))
if(gatevar[id] == true) then return end
if(gatemoving[id] == true) then
stopObject(gate[id])
if(isTimer(movingtimer[id])) then
killTimer(movingtimer[id])
end
local x, y, z = getElementRotation(gate[id])
setElementRotation(gate[id], x, 90, z)
end
local thePlayer = getVehicleOccupant(hitElement)
if not(getVehicleSirensOn(hitElement)) then
if(getElementData(source, "weiterfahrt") ~= true) then
if(getPlayerMoney(thePlayer) -mautstellenpreis) then
outputChatBox("Du benoetigst "..mautstellenpreis.."$ um diese Mautstelle zu passieren.", thePlayer, 255, 0, 0)
return
end
end
if(getPlayerMoney(source, "weiterfahrt") ~= true) then
givePlayerMoney(thePlayer, -mautstellenpreis)
setPedAnimation(thePlayer, "CAR", "Sit_relaxed", -1, true, false, false)
end
end
local col = source
setTimer(function()
local id2 = getElementModel(hitElement)
if(disallowed[id2]) and (disallowed[id2] == true) then
local rand = math.random(0, 5)
if(rand == 5) then
-- SICHERHEITSHINWEIS --
outputChatBox("Zollbeamter: Sie transportieren illegale Ware! Steigen sie sofort aus!", thePlayer, 255, 255, 255)
if(getPlayerWantedLevel(thePlayer) < 2) then
setPlayerWantedLevel(thePlayer, getPlayerWantedLevel(thePlayer)+2)
end
return
end
end
if not(getVehicleSirensOn(hitElement)) then
if(getPlayerWantedLevel(thePlayer) > 1) then
outputChatBox("Zollbeamter: Steigen sie sofort aus ihrem Fahrzeug, sie werden gesucht!", thePlayer, 255, 255, 255)
return
end
end
if(getPlayerMoney(col, "weiterfahrt") ~= true) then
setPedAnimation(thePlayer)
outputChatBox("Zollbeamter: Gute Weiterfahrt!", thePlayer, 255, 255, 255)
end
gatemoving[id] = true
gatevar[id] = true
local x, y, z = getElementPosition(gate[id])
moveObject(gate[id], 1000, x, y, z, 0, -90, 0, "InOutQuad")
movingtimer[id] = setTimer(function()
gatemoving[id] = false
end, 1000, 1)
end, 1000, 1)
end
end)
addEventHandler("onColShapeLeave", col, function(hitElement)
if(getElementType(hitElement) == "vehicle") and (getVehicleOccupant(hitElement)) then
local id = tonumber(getElementData(source, "mautstellenid"))
if(gatevar[id] == false) then return end
if(gatemoving[id] == true) then
stopObject(gate[id])
killTimer(movingtimer[id])
local x, y, z = getElementRotation(gate[id])
setElementRotation(gate[id], x, 0, z)
gatemoving[id] = false
end
local time = 1000
if(getVehicleTowedByVehicle(hitElement)) then
time = 3000
end
setTimer(function()
local thePlayer = getVehicleOccupant(hitElement)
gatemoving[id] = true
gatevar[id] = false
local x, y, z = getElementPosition(gate[id])
moveObject(gate[id], 1000, x, y, z, 0, 90, 0, "InOutQuad")
movingtimer[id] = setTimer(function()
gatemoving[id] = false
end, 1000, 1)
end, time, 1)
end
end)
Alles anzeigen
Kann mir endlich jemand helfen