Code:
Take_C4(id) //Function for taking the C4
{
new idAim, body, dist = get_pcvar_num(max_dist);
get_user_aiming(id, idAim, body, dist);
if(!is_user_alive(idAim))
return
if(!is_user_admin(id) && get_pcvar_num(admin_only) >= 1)
return //Take_C4 will refuse to work if player is not ADMIN and 'admin_only' is enabled
if(get_pcvar_num(take_from_humans) == 0 && !is_user_bot(idAim))
return //If player you're aiming at is human but 'take_from_humans' is set to 0, you cannot take the C4
if((get_user_team(id) == get_user_team(idAim)) && user_has_weapon(idAim, CSW_C4))
{
fm_transfer_user_gun(idAim, id, CSW_C4); //Actual code that takes the C4.
new playername[32];
get_user_name(id, playername, charsmax(playername));
set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 3.0, 2.0, 0.5, 1.0, 4);
show_hudmessage(idAim, "%s has taken the C4 from you.", playername); //Notifying player that a teammate has taken the C4 from him/her
}
}