Collect all spawn-points for each map and assign to them for which team is (you need to know to which team it belongs so the system will not punish the player for dying on the spawn-point of the opponent team). When a player dies check if there is a killer and if the team of the killer is different. If the team differs, check if playerid is in range of any spawn-point that belongs to their team.
|
if(team[issuerid] == TEAM_SWAT)
{
if(team[playerid] == TEAM_TERRORIST)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, 286.20001220705, 178.10000610352, 1007.5999755859)) // TERRORIST SPAWN
{
if(weaponid == 25)
{
GetPlayerHealth(issuerid,hp);
SetPlayerHealth(issuerid, hp -0);
}
}
}
}
PunishSpawnkiller(map_id, playerid, issuerid)
{
// sizeof spawnpoints / 2 = total number of maps
// the first half are spawnpoints of terrorists
// the other half are spawnpoints of swat
static const Float: spawnpoints[][] =
{
{286.20001220705, 178.10000610352, 1007.5999755859}, // MAP 1 - TEAM_TERRORIST
{x, y, z}, // MAP 2 - TEAM_TERRORIST
{x, y, z}, // MAP 3 - TEAM_TERRORIST
{x, y, z}, // MAP 1 - TEAM_SWAT
{x, y, z}, // MAP 2 - TEAM_SWAT
{x, y, z} // MAP 3 - TEAM_SWAT
};
new index = map_id + (team[playerid] == TEAM_SWAT ? sizeof spawnpoints / 2 : 0);
if (IsPlayerInRangeOfPoint(playerid, 1.0, spawnpoints[index][0], spawnpoints[index][1], spawnpoints[index][2]))
{
SetPlayerHealth(issuerid, 0.0);
}
}
if (issuerid != INVALID_PLAYER_ID && team[issuerid] != team[playerid])
{
PunishSpawnkiller(gCurrentMap, playerid, issuerid);
}