I have found a very good way of making semiclip (I think it is new). The main idea is to add SOLID_NOT flag for a player on a right moment.
Lets start with the simplest example.
PHP Code:
plugin_init()
{
register_forward(FM_PlayerPreThink, "preThink")
register_forward(FM_PlayerPostThink, "postThink")
}
public preThink(id)
{
if(pev(id, pev_movetype) == MOVETYPE_NOCLIP) return
set_pev(id, pev_solid, SOLID_SLIDEBOX)
}
public postThink(id)
{
if(pev(id, pev_movetype) == MOVETYPE_NOCLIP) return
set_pev(id, pev_solid, SOLID_NOT)
}
This little example is good enough for a KZ or Surf server. Player during the Think is SOLID_SLIDEBOX, so it means it will Touch all entities. In the same time all other players are SOLID_NOT, so you will go trough them without a touch.
It works pretty nice on KZ servers. Even better than the old way. It is ~5 lines of code and you don't have to worry about trigger_teleport and other stuff bicouse everything works fine. All what has left is to add a transparcy rendering.
The dis advanced of this example is that player is SOLID_NOT almost always. So bullets wont touch the player.
The second example is a bit more recourses consuming, compared to the first one. Now I will change every player to SOLID_NOT (accept 1) before a Think, and put things back to normal after Think.
PHP Code:
new maxplayers
new plr_solid[33]
plugin_init()
{
register_forward(FM_PlayerPreThink, "preThink")
register_forward(FM_PlayerPostThink, "postThink")
maxplayers = get_maxplayers()
}
public preThink(id)
{
if(pev(id, pev_movetype) == MOVETYPE_NOCLIP) return
for(new i=1; i <= maxplayers; i++)
{
if(!pev_valid(i) || i == id) continue
plr_solid[i] = pev(i, pev_solid)
set_pev(i, pev_solid, SOLID_NOT)
}
}
public postThink(id)
{
if(pev(id, pev_movetype) == MOVETYPE_NOCLIP) return
for(new i=1; i <= maxplayers; i++)
{
if(!pev_valid(i) || i == id) continue
set_pev(i, pev_solid, plr_solid[i])
}
}
This part of code has a 1 big dis advanced. Everything works fine on the server. However client thinks that everyone is SOLID_BBOX. This gives a very uncomfortable effect for a player when he is going trough others. To manage this problem we will have to use FM_AddToFullPack, which is very resources consuming function bicouse it is called very often.
This is all about the main idea. All the rest are enchantments/optimizations.
In the attachment you will find a fully working semiclip plugin for general-cs/hns/kz/surf. Other mods should work well too. Plugin will make your teammates transparent and you will be able to walk thought them without a touch. At the same time opposite team will be solid, you will be able to shoot them. (note that you should use mp_friendlyfire 0 with this plugin or else you can hurt your team)