After looking here:
https://github.com/VSES/SourceEngine...state.cpp#L125
Something like this should work and wont require signatures.
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
bool bomb_set_up;
int site;
public void OnPluginStart()
{
HookEvent("round_start", round_start_event);
HookEvent("player_spawn", player_spawn_event);
HookEvent("bomb_planted", c4_bomb_planted);
}
public void round_start_event(Handle event, char[] name, bool dontBroadcast)
{
bomb_set_up = false;
}
public void player_spawn_event(Handle event, char[] name, bool dontBroadcast)
{
int userid = GetClientOfUserId(GetEventInt(event,"userid"));
if (bomb_set_up && IsClientInGame(userid) && IsPlayerAlive(userid) && GetClientTeam(userid) == 3)
{
int ent = -1;
ent = FindEntityByClassname(ent, "planted_c4");
if(ent != -1)
{
float c4_position[3];
GetEntPropVector(ent, Prop_Send, "m_vecOrigin", c4_position);
int target = -1;
for(int i = 1;i < MaxClients+1;i++)
{
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 3 && IsPlayerAlive(i))
{
target = i;
break;
}
}
if(target != -1)
{
float player_position[3];
GetEntPropVector(target, Prop_Send, "m_vecOrigin", player_position);
TeleportEntity(target, c4_position, NULL_VECTOR, NULL_VECTOR);
Event BombPlanted = CreateEvent("bomb_planted");
if(BombPlanted != null)
{
SetEventInt(BombPlanted, "userid", target);
SetEventInt(BombPlanted, "site", site);
FireEvent(BombPlanted, true);
}
TeleportEntity(target, player_position, NULL_VECTOR, NULL_VECTOR);
}
}
}
}
public void c4_bomb_planted(Handle event, char[] name, bool dontBroadcast)
{
if(!bomb_set_up)
{
site = GetEventInt(event,"site");
bomb_set_up = true;
}
}
__________________