pickUpFendt12130NEvent = {};
pickUpFendt12130NEvent_mt = Class(pickUpFendt12130NEvent, Event);

InitEventClass(pickUpFendt12130NEvent, "pickUpFendt12130NEvent");

function pickUpFendt12130NEvent:emptyNew()
    local self = Event:new(pickUpFendt12130NEvent_mt);
    self.className="pickUpFendt12130NEvent";
    return self;
end;

function pickUpFendt12130NEvent:new(vehicle, mode)
    local self = pickUpFendt12130NEvent:emptyNew()
    self.vehicle = vehicle;
	self.mode = mode;
    return self;
end;

function pickUpFendt12130NEvent:readStream(streamId, connection)
    local id = streamReadInt32(streamId);
	self.mode = streamReadBool(streamId);
    self.vehicle = networkGetObject(id);
    self:run(connection);
end;

function pickUpFendt12130NEvent:writeStream(streamId, connection)
    streamWriteInt32(streamId, networkGetObjectId(self.vehicle));
	streamWriteBool(streamId, self.mode);
end;

function pickUpFendt12130NEvent:run(connection)   
	self.vehicle:pickUpMode(self.mode, true);
    if not connection:getIsServer() then
        g_server:broadcastEvent(pickUpFendt12130NEvent:new(self.vehicle, self.mode), nil, connection, self.vehicle);
    end;
end;

function pickUpFendt12130NEvent.sendEvent(vehicle, mode, noEventSend)
	if noEventSend == nil or noEventSend == false then
		if g_server ~= nil then
			g_server:broadcastEvent(pickUpFendt12130NEvent:new(vehicle, mode), nil, nil, vehicle);
		else
			g_client:getServerConnection():sendEvent(pickUpFendt12130NEvent:new(vehicle, mode));
		end;
	end;
end;