Quote:
Originally Posted by e54385991
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
int g_offsCollisionGroup;
public void OnPluginStart()
{
g_offsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
HookEvent("player_team", Event_Team, EventHookMode_Pre);
}
public Action Event_Team(Event event, const char[] name, bool dontBroadcast)
{
int userid = event.GetInt("userid");
int client = GetClientOfUserId(userid);
if(!client || !IsClientInGame(client))
return Plugin_Continue;
int iNewTeam = event.GetInt("team");
if(iNewTeam != CS_TEAM_T && iNewTeam != CS_TEAM_CT)
{
CreateTimer(0.0, Timer_Post, userid);
}
return Plugin_Continue;
}
public Action Timer_Post(Handle timer, int userid)
{
int client = GetClientOfUserId(userid);
if(client <=0 || !IsClientInGame(client))
return Plugin_Continue;
int iTeam = GetClientTeam(client);
if(iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT)
return Plugin_Continue;
SetEntData(client, g_offsCollisionGroup, 2, 4, true);
return Plugin_Continue;
}
no test
|
I didn't test this but this is guaranteed not to work for two reasons:
1. Spectators show up as enemies so it's still annoying to see the "enemy" marker which shows a name without having an enemy
2. Solidity of a player doesn't affect collision of bullets. I tried it in my AS gamemode plugin and confirmed it. The problem is that the spectator is alive.
__________________
I am available to make plugins for pay.
Discord: Eyal282#1334