Hi, ich hab hier im Forum auch schon nach der lösung meines Problem gesucht
dennoch erfolglos...
Desshalb frag ich nun Euch
Problem: doch nicht gelöst ...
also Fehler ist immernoch das ich einfach in den Marker1 stehe und dieser nicht gelöscht wird und maker2 nicht erstellt wird kurz gesagt : Das Script macht rein garnichts mehr
Frage: Wie kann ich das Script einfacher oder kompakter halten?
Script(BUSFAHRER):
Lua
busstart = createMarker ( 2790.8000488281, 1255, 10, "cylinder", 2, 0, 255, 0, 255)
function busStart ( thePlayer )
local job = getElementData ( thePlayer, "Job" ) -- liest variable job aus
if ( job == 2 ) then
bus = createVehicle ( 431, 2767.6999511719, 1268.6999511719, 10.89999961853, 0, 0, 270.75 ) -- Erstellt ein Fahrzeug
warpPedIntoVehicle ( thePlayer, bus) -- Teleportiert euch in den Wagen
outputChatBox ( "Fahre zum Zielpunkt!", thePlayer, 0, 255, 0 ) -- Gebe Text in Farbe "Grün" für den Spieler aus
setVehicleEngineState ( bus, true ) -- Starte den Motor
marker1 = createMarker ( 1544.3000488281, 1136.1999511719, 10.699999809265, "checkpoint", 2, 255, 0, 0, 255, thePlayer ) -- ..
blip1 = createBlip ( 1544.3000488281, 1136.1999511719, 10.699999809265, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) -- ..
else
outputChatBox ( "Du bist kein Busfahrer!", thePlayer, 255, 0, 0 )
outputChatBox("Möchtest du als Busfahrer arbeiten? Tippe einfach /job ein!", player, 255,0,0)
end
end
addEventHandler ( "onMarkerHit", busstart, busStart )
function Busjob(player,command)
if getElementData ( player, "Job" ) ~= 0 then
outputChatBox("Du hast bereits einen Job!", player, 255,0,0)
else
if isElementWithinMarker(player, busstart) then
setElementData(player, "Job", 2)
outputChatBox("Du bist nun Busfahrer", player,0,255,0)
end
end
end
addCommandHandler("job", Busjob)
function eis ( thePlayer)
if getPedOccupiedVehicle ( thePlayer ) then
local playerVehicle = getPedOccupiedVehicle ( thePlayer )
local Status = isElementFrozen ( playerVehicle )
if (status == true ) then
setElementFrozen ( playerVehicle, false )
else
setElementFrozen ( playerVehicle, true )
end
end
end
function markerhit1 ( hitPlayer )
if getElementType(hitPlayer)=="player" and getElementData(hitPlayer,"marker")==source then
if isElementWithinMarker(hitPlayer, marker1) then
outputChatBox ( "Du hast den Checkpoint erreicht! Hier hast du 150$!", hitPlayer )
givePlayerMoney ( hitPlayer, 150 ) -- gebe Geld
setTimer ( eis, 10000, 2 )
destroyElement ( marker1 )
destroyElement ( blip1 )
marker2 = createMarker ( 1084.3000488281, 1195.8000488281, 10.699999809265, "checkpoint", 2, 255, 0, 0, 255, thePlayer ) -- ..
blip2 = createBlip ( 1084.3000488281, 1195.8000488281, 10.699999809265, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) -- ..
end
end
if getElementType(hitPlayer)=="player" and getElementData(hitPlayer,"marker")==source then
if isElementWithinMarker(hitPlayer, marker2 ) then
outputChatBox ( "Du hast den Checkpoint erreicht! Hier hast du 150$!", hitPlayer )
givePlayerMoney ( hitPlayer, 150 ) -- gebe Geld
setTimer ( eis, 10000, 2 )
destroyElement ( marker2 )
destroyElement ( blip2 )
marker3 = createMarker ( 1009.700012207, 1412.4000244141, 10.699999809265, "checkpoint", 2, 255, 0, 0, 255, thePlayer ) -- ..
blip3 = createBlip ( 1009.700012207, 1412.4000244141, 10.699999809265, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) -- ..
end
end
if getElementType(hitPlayer)=="player" and getElementData(hitPlayer,"marker")==source then
if isElementWithinMarker(hitPlayer, marker3) then
outputChatBox ( "Du hast den Checkpoint erreicht! Hier hast du 150$!", hitPlayer )
givePlayerMoney ( hitPlayer, 150 ) -- gebe Geld
setTimer ( eis, 10000, 2 )
destroyElement ( marker3 )
destroyElement ( blip3 )
marker4 = createMarker ( 1730.0999755859, 1530.1999511719, 10.699999809265, "checkpoint", 2, 255, 0, 0, 255, thePlayer ) -- ..
blip4 = createBlip ( 1730.0999755859, 1530.1999511719, 10.699999809265, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) -- ..
end
end
if getElementType(hitPlayer)=="player" and getElementData(hitPlayer,"marker")==source then
if isElementWithinMarker(hitPlayer, marker4 ) then
outputChatBox ( "Du hast den Checkpoint erreicht! Hier hast du 150$!", hitPlayer )
givePlayerMoney ( hitPlayer, 150 ) -- gebe Geld
setTimer ( eis, 10000, 2 )
destroyElement ( marker4 )
destroyElement ( blip4 )
marker5 = createMarker ( 2765, 1290.1999511719, 10.80000190735, "checkpoint", 2, 255, 0, 0, 255, thePlayer ) -- ..
blip5 = createBlip ( 2765, 1290.1999511719, 10.80000190735, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) -- ..
end
end
if getElementType(hitPlayer)=="player" and getElementData(hitPlayer,"marker")==source then
if isElementWithinMarker(hitPlayer, marker5) then
outputChatBox ( "Du hast die schicht geschafft!", hitPlayer )
destroyElement ( marker4 )
destroyElement ( blip4 )
removePedFromVehicle ( hitPlayer ) -- raus aus Fahrzeug
setPedRotation ( hitPlayer, 90 )
destroyElement ( marker5 )
destroyElement ( blip5 )
destroyElement ( bus )
end
end
end
addEventHandler ( "onMarkerHit", getRootElement(), markerhit1 )
Alles anzeigen