Moin Moiner sagt mir "Fahrzeug umgeparkt!"
aber wenn es respawnt spawnt es an der stelle wo es vom Besitzer geparkt wurde
Lua: mechaniker_server.lua
function umparken_func ( player )
if isElement(player) then -- prüft ob Spieler existiert und am Leben ist
if getPedOccupiedVehicleSeat ( player ) == 0 then -- prüft ob der Spieler auf einem Fahrersitz sitzt
if(isMechaniker(player)) and (isEmergencyOnDuty(player)) then -- prüft ob der Spieler die Berechtigungen hat
local vehicle = getPedOccupiedVehicle ( player ) -- wenn alles passt gib mir das betreffende Fahrzeug
if vehicle then -- prüfe ob das Fahrzeug tatsächlich existiert
local x, y, z = getElementPosition ( vehicle )
local rx, ry, rz = getVehicleRotation ( vehicle )
local c1, c2, c3, c4 = getVehicleColor ( vehicle )
local color = "|"..tostring(c1).."|"..tostring(c2).."|"..tostring(c3).."|"..tostring(c4).."|"
local Paintjob = getVehiclePaintjob ( vehicle ) or 3
local Benzin = vioGetElementData ( vehicle, "fuelstate" )
local owner = vioGetElementData ( vehicle, "owner" )
local Distance = vioGetElementData ( vehicle, "distance" )
local slot = vioGetElementData ( vehicle, "carslotnr_owner" )
local pname = getPlayerName ( player )
if Benzin and owner and Distance and pname and slot then -- prüfen ob alle Variablen existieren
vioSetElementData ( vehicle, "spawnposx", x )
vioSetElementData ( vehicle, "spawnposy", y )
vioSetElementData ( vehicle, "spawnposz", z )
vioSetElementData ( vehicle, "spawnrotx", rx )
vioSetElementData ( vehicle, "spawnroty", ry )
vioSetElementData ( vehicle, "spawnrotz", rz )
vioSetElementData ( vehicle, "color1", tostring(c1) ) -- tostring, falls ein Farbwert mal nicht existiert
vioSetElementData ( vehicle, "color2", tostring(c2) ) -- tostring, falls ein Farbwert mal nicht existiert
vioSetElementData ( vehicle, "color3", tostring(c3) ) -- tostring, falls ein Farbwert mal nicht existiert
vioSetElementData ( vehicle, "color4", tostring(c4) ) -- tostring, falls ein Farbwert mal nicht existiert
dbExec ( handler, "UPDATE vehicles SET Spawnpos_X=?, Spawnpos_Y=?, Spawnpos_Z=?, Spawnrot_X=?, Spawnrot_Y=?, Spawnrot_Z=?, Farbe=?, Paintjob=?, Benzin=?, Distance=? WHERE UID=? AND Slot=?", x, y, z, rx, ry, rz, color, Paintjob, Benzin, Distance, playerUID[pname], slot )
outputChatBox ( "Dein Fahrzeug in"..slot.."wurde abgeschleppt!", owner, 125, 0, 0 )
outputChatBox ( "Fahrzeug umgeparkt!", player, 0, 255, 0 )
else
outputChatBox ( "Fahrzeug umparken fehlgeschlagen!", player, 255, 0, 0 )
end
else
outputChatBox ( "Fahrzeug nicht gefunden!", player, 255, 0, 0 )
end
else
outputChatBox ( "Du bist kein Mechaniker", player, 255, 0, 0 )
end
else
outputChatBox ( "Du musst in einem Fahrzeug sitzen!", player, 255, 0, 0 )
end
end
end
addCommandHandler ( "umparken", umparken_func )
Alles anzeigen