Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <cstrike>
#define PLUGIN "Spawnplant"
#define VERSION "1.0"
#define AUTHOR "suhdude/alliedmodders"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("HLTV", "new_round", "a", "1=0", "2=0");
}
stock is_user_in_plant_zone( id )
{
return (cs_get_user_mapzones(id) & CS_MAPZONE_BOMBTARGET)
}
public new_round()
{
new players[32];
new playercount, i;
get_players(players, playercount);
for (i=0; i<playercount; i++)
set_task(0.5,"plant_bomb",players[i]);
set_task(0.5,"delete_clock");
return PLUGIN_CONTINUE;
}
public plant_bomb(id)
{
if ( is_user_in_plant_zone( id ) )
{
client_cmd (id,"say /plant"); //activates another plugin that plants the bomb.
client_print( 0, print_center, "#Cstrike_TitlesTXT_Bomb_Planted" );
}
}
public delete_clock(id)
{
new c4origin[3]
get_user_origin(id, c4origin[3], mode = 0);
message_begin(MSG_ALL, get_user_msgid("BombDrop"), {0,0,0}, 1)
write_byte(c4origin[0]);
write_byte(c4origin[1]);
write_byte(c4origin[2]);
write_byte(1);
message_end();
}