Code:
function InstantAction:RevivePlayer(channelId, player, keepEquip)
local result=false;
local groupId=player.spawnGroupId;
local teamId=self.game:GetTeam(player.id);
if (player:IsDead()) then
keepEquip=false;
end
player.lastExitedVehicleId = nil;
player.lastExitedVehicleTime = nil;
if (self.USE_SPAWN_GROUPS and groupId and groupId~=NULL_ENTITY) then
local spawnGroup=System.GetEntity(groupId);
if (spawnGroup and spawnGroup.vehicle) then -- spawn group is a vehicle, and the vehicle has some free seats then
result=false;
for i,seat in pairs(spawnGroup.Seats) do
if ((not seat.seat:IsDriver()) and (not seat.seat:IsGunner()) and (not spawnGroup.x_lock) and (seat.seat:IsFree())) then
self.game:RevivePlayerInVehicle(player.id, spawnGroup.id, i, teamId, not keepEquip);
result=true;
break;
end
end
if(not result) then
self.game:RevivePlayerInVehicle(player.id, spawnGroup.id, -1, teamId, not keepEquip);
result=true;
end
end
elseif (self.USE_SPAWN_GROUPS) then
Log("Failed to spawn %s! teamId: %d groupId: %s groupTeamId: %d", player:GetName(), self.game:GetTeam(player.id), tostring(groupId), self.game:GetTeam(groupId or NULL_ENTITY));
return false;
end
if (not result) then
local ignoreTeam=(groupId~=nil) or (not self.TEAM_SPAWN_LOCATIONS);
local includeNeutral=true;
if (self.TEAM_SPAWN_LOCATIONS) then
includeNeutral=self.NEUTRAL_SPAWN_LOCATIONS or false;
end
local spawnId,zoffset;
if (self.TIA_SPAWN_LOCATIONS) then
spawnId,zoffset = self.game:GetSpawnLocationTeam(player.id, player.death_pos);
else
if(player.spawn_time==nil or _time-player.spawn_time>100) then
player.skipSpawnId=0;
end
if (self.USE_SPAWN_GROUPS or (not player.death_time) or (not player.death_pos)) then
spawnId,zoffset = self.game:GetSpawnLocation(player.id, ignoreTeam, includeNeutral, groupId or NULL_ENTITY, 0, g_Vectors.v000, player.skipSpawnId);
else
spawnId,zoffset = self.game:GetSpawnLocation(player.id, ignoreTeam, includeNeutral, groupId or NULL_ENTITY, 50, player.death_pos, player.skipSpawnId);
end
player.spawn_time=_time;
player.skipSpawnId=spawnId;
end
local pos,angles;
if (spawnId) then
local spawn=System.GetEntity(spawnId)
if (spawn) then
spawn:Spawned(player);
pos=spawn:GetWorldPos(g_Vectors.temp_v1);
angles=spawn:GetWorldAngles(g_Vectors.temp_v2);
pos.z=pos.z+zoffset;
if (zoffset>0) then
Log("Spawning player '%s' with ZOffset: %g!", player:GetName(), zoffset);
end
self.game:RevivePlayer(player.id, pos, angles, teamId, not keepEquip);
result=true;
end
end
end
player:UpdateAreas();
if (result) then
if(player.actor:GetSpectatorMode() ~= 0) then
player.actor:SetSpectatorMode(0, NULL_ENTITY);
end
if (not keepEquip) then
local additionalEquip;
if (groupId) then
local group=System.GetEntity(groupId);
if (group and group.GetAdditionalEquipmentPack) then
additionalEquip=group:GetAdditionalEquipmentPack();
end
end
self:EquipPlayer(player, additionalEquip);
end
player.death_time=nil;
player.frostShooterId=nil;
local invuln = System.GetCVar("g_spawnProtectionTime");
if (invuln and invuln>0) then
self.game:SetInvulnerability(player.id, true, invuln);
end
end
if (not result) then
Log("Failed to spawn %s! teamId: %d groupId: %s groupTeamId: %d", player:GetName(), self.game:GetTeam(player.id), tostring(groupId), self.game:GetTeam(groupId or NULL_ENTITY));
end
return result;
end
Der einfachste Weg, Ohne SSM ist also das in die Server.cfg zu schreiben: