Das Problem ist, dass du nur eine Variable für das Fahrzeug hast. Du brauchst aber pro Spieler eine Variable. Etwa so:
Lua
function MuellentStart ( thePlayer )
local playerjob = getElementData ( thePlayer, "Job" )
local dim = math.random ( 0, 0 )
local finishmuell = math.random ( 1, 3 )
local Muelid = "Trucker" .. tostring ( dim )
local finishmuells = "finishmuell" .. tostring ( dim )
setElementData ( thePlayer, "PilotIDs", tostring ( dim ) )
local Muellwagen= createVehicle ( 574, Y, X, C, 0, 0, 0, )
setElementDimension ( Muellwagen, dim )
setElementDimension ( thePlayer, dim )
warpPedIntoVehicle ( thePlayer, Muellwagen, 0 )
setVehicleEngineState ( Muellwagen , true )
setElementData ( thePlayer, "onMüllWagen", Muellwagen )
setTimer ( payMuellJob, 1000, 1, thePlayer )
outputChatBox ( "In der ganzen Stadt ist Müll! Deine Aufgabe ist es, ihn zu Sammeln", thePlayer,225,225,0)
outputChatBox ( "Damit du Geld bekommst musst du die Strasse befahren um sie zu Reinigen!", thePlayer,225,0,0)
end
if ( playerjob == 9 ) then
if (not isPedInVehicle ( thePlayer )) then
setElementData ( thePlayer, "onMüllWagen", 1 )
end
end
end
end
end
addCommandHandler ( "startmüll", MuellentStart )
function onMuellmanCancelExit ( thePlayer )
takePlayerMoney(thePlayer, 10)
local wagen = getElementData ( thePlayer, "onMüllWagen" )
setElementData ( thePlayer, "onMüllWagen", 0)
setElementDimension (thePlayer, 0)
respawnVehicle(wagen)
outputChatBox ( "Du hat den Dienst Beendet! Steuer: 10$", thePlayer,185,0,0)
end
end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), onMuellmanCancelExit )
Alles anzeigen