PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Server-Crash bei mapchange



Northdegree
10.04.2012, 19:32
Hallo liebe Leute,

komischerweise crasht mein Server sobald ich einen Mapchange mache. Jedoch läuft der Server normal wenn ich die map via. startkommando starte.

Ich habe den (Problem)-code schon ausfindig gemacht.


function ReFuel()
if GasOnline then
for i,ent in pairs (vehicle_table) do
local Vehicle = ent
if not (Vehicle and Vehicle:IsValid() and Vehicle:IsVehicle()) then return end
local ply = Vehicle:GetDriver()
if ply:IsValid() and ply:IsPlayer() then
local Fuel = Vehicle:GetNWInt("fuel")
local price = 2
local plypos = ply:GetPos()
local plyposx = math.Round(plypos.x)
local plyposy = math.Round(plypos.y)
if (plyposx <= tankx1 and plyposx >= tankx2) or (plyposx <= tankx3 and plyposx >= tankx4) then
--print("x-coordinate matches")
if (plyposy <= tanky1 and plyposy >= tanky2) or (plyposy <= tanky3 and plyposy >= tanky4) then
--print("y-coordinate matches")
if Fuel <= 0 and ply:CanAfford(3*price) then
Vehicle:Fire("turnon", 1, 0)
end
if Fuel <= 97 then
if not ply:CanAfford(3*price) then Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, "fuel")) return "" end
ply:AddMoney(-(3*price))
local newfuel = Fuel + 3
Vehicle:SetNWInt("fuel", newfuel)
elseif Fuel == 98 then
if not ply:CanAfford(2*price) then Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, "fuel")) return "" end
ply:AddMoney(-(2*price))
local newfuel = Fuel + 2
Vehicle:SetNWInt("fuel", newfuel)
elseif Fuel == 99 then
if not ply:CanAfford(price) then Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, "fuel")) return "" end
ply:AddMoney(-price)
local newfuel = Fuel + 1
Vehicle:SetNWInt("fuel", newfuel)
elseif Fuel >= 100 then
return
end
end
end
end
end
end
end
timer.Create("Vehicle_Fuel_CountUp", 3, 0, ReFuel)
function CountFuels()
if GasOnline then
for i,ent in pairs (vehicle_table) do
local conv = 10.936133
local Vehicle = ent
if not (Vehicle and Vehicle:IsValid() and Vehicle:IsVehicle()) then return end
local speed = Vehicle:GetVelocity():Length()/conv
local Fuel = Vehicle:GetNWInt("fuel")
if Fuel > 0 and Vehicle:GetDriver() then
if speed > 2 and speed < 50 then
local newfuel = Fuel - 1
Vehicle:SetNWInt("fuel", newfuel)
elseif speed > 49 then
local newfuel = Fuel - 2
Vehicle:SetNWInt("fuel", newfuel)
end
elseif Fuel < 0 then
Vehicle:SetNWInt("fuel", 0)
end
if Vehicle:GetNWInt("fuel") < 1 then
Vehicle:Fire("turnoff", 1, 0)
local Driver = Vehicle:GetDriver()
if Driver and Driver:IsValid() and Driver:IsPlayer() then
Notify(Driver, 1, 5, "This vehicle ran out of fuel!")
end
end
end
end
end
timer.Create("Vehicle_Fuel_Count", 20, 0, CountFuels)


Kann mir vielleicht jemand sagen, warum genau dieser Code den Mapchange blockiert?

Mit freundlichen Gruß:
Northdegree

RP-01
12.04.2012, 06:42
Gibt's bei/nach dem Crash möglicherweise irgendeine genauere Problembeschreibung?

Northdegree
14.04.2012, 16:27
Nein, der schmiert ohne dump oder sonstiges ab.

minifisch
14.04.2012, 16:40
Guck mal in den Logs nach einer Fehlermeldung kurz vor dem Crash :)

gamerpaddy
14.04.2012, 17:13
der kack ist ja der, dass SRCDS und die addons immer erst loggen.. und minuten später crasht der server

Schmiert der code auch im Singleplayer ab?
denn da macht der ggf eine dump

Northdegree
27.04.2012, 12:29
Also das letzte was ich in der Log sehe ist "ScriptEnforce is disabled".

Im Singleplayer genau das selbe. Sobald ich einen Mapchange mache crasht der Server.

Das passiert aber erst nach dem einfügen des genannten codes. Sobald ich diesen auskommentiere funktioniert es einwandfrei.

Aber wenn ich den Server normal starte (ohne einen Mapchange) läuft es ohne Probleme.