Guten Tag!
Ich habe ein kleines Kartscript gescriptet. Das Problem ist, nur die Person die nach einem Script oder Server restart kann ein kart fahren. Jeder andere kann es nicht. Praktisch wer als erster da ist, malt zuerst. Keine Errors keine Warnings auch im debugscript nichts. Hier das Script:
Lua
markerkart = createMarker ( -2029.8000488281, -120.69999694824, 34.200000762939, "cylinder", 1, 255, 0, 0, 125 )
currentKarts = {}
function kartspawn_func (hitElement,dim)
if getElementType(hitElement) ~= "player" then
return
end
local x1, y1, z1 = getElementPosition ( player )
local x2, y2, z2 = getElementPosition ( markerkart )
if getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) <= 5 then
if dim then
local spawndaskart = createVehicle ( 571, -2039.5999755859,-138.69999694824,34.599998474121, 0, 0, 90 )
warpPedIntoVehicle(hitElement, spawndaskart)
outputChatBox ( "Du fährst nun Kart! Viel Spaß! Wenn du keine lust mehr hast, einfach aussteigen!", hitElement, 0, 255, 255 )
currentKarts[spawndaskart] = true
end
end
end
addCommandHandler("kart", kartspawn_func)
function ChatBox_func ( hitElement )
outputChatBox ("Tippe /kart um Kart zu fahren!", player, 0, 0, 255)
end
addEventHandler( "onMarkerHit", markerkart, ChatBox_func)
addEventHandler("onVehicleExit", root,
function ()
if currentKarts[source] then
currentKarts[source] = nil
destroyElement(source)
end
end
)
Alles anzeigen
MfG
Sulection