Below is my code, I am not sure why it is not broadcasting when the person takes the hostage, everything else works fine, just cannot get it to broadcast that they have taken the hostage nor the timer, only the person who takes it can see it.
publicVariable "hostage1";
publicVariable "captivetimer";
if (isciv) then
{
if(alive hostage1)exitWith {player groupChat "You cannot take a hostage mission at this time";};
"TK_GUE_Soldier_5_EP1" createUnit [getmarkerpos "hostagezone", group player, "hostage1 = this"];
hostage1 allowDamage false;
removeAllWeapons hostage1;
playsound "Bank_alarm";
titleText [localize "Terrorists have taken a hostage, Police have 15 minutes to rescue the hostage!", "PLAIN"];
hint format ["%1 has taken a hostage, Police have 15 minutes to rescue them.",name player];
//hint "Terrorists have taken a hostage, Police have 15 minutes to rescue the hostage!";
hostage1 globalChat "Somone has taken me hostage, please rescue me within 15 minutes or they will execute me!";
captivetimer = 40;
"if (isciv) then {player globalChat ""I have taken a hostage, police have 15 minutes to rescue them or they die!""};" call broadcast;
"{player globalChat ""Someone is trying to take a hostage, police have 15 minutes to rescue them!""};" call broadcast;
while {captivetimer > 0} do
{
titleText[format["Rescue time left: %1 seconds", captivetimer], "PLAIN DOWN"];
//if(captivetimer mod 30 == 0 and isServer) then {publicvariable "captivetimer";};
if(captivetimer == 1) then
{
//publicvariable "captivetimer";
hint "Hostage Taker Won and recieves $100000";
server globalchat "Hostage Taker Won and recieves $100000";
//if (iscop) then {Kontostand = Kontostand - 25000;};
if (isciv) then {['geld', 100000] call INV_AddInventoryItem;};
deleteVehicle hostage1;
};
captivetimer = captivetimer - 1;
sleep 1;
if ((hostage1 distance getmarkerpos "hostagezone" > 200 and alive hostage1) or (player distance hostage1 > 100 and alive hostage1)) then
{
captivetimer = -1;
deleteVehicle hostage1;
//hint "Mission Failed You left the area";
//server globalchat "The hostage taker FAILED!";
//"{player globalChat ""I FAILED!""};" call broadcast;
};
};
};
Else
{
hint "You are a cop, you cannot take a hostage";
};