if(strcmp(cmd, "/call", true) == 0 || strcmp(cmd, "/c", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/c)all [phonenumber]");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, " ..You dont't have a cell phone");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s takes out a cellphone.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new phonenumb = strval(tmp);
if(phonenumb == 911)
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Which Service Do You Require, Police or Paramedic?");
Mobile[playerid] = 911;
return 1;
}
if(phonenumb == PlayerInfo[playerid][pPnumber])
{
SendClientMessage(playerid, COLOR_GRAD2, " ..You just get a busy tone");
return 1;
}
if(Mobile[playerid] != 255)
{
SendClientMessage(playerid, COLOR_GRAD2, " ..You are already on a call");
return 1;
}
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
{
giveplayerid = i;
Mobile[playerid] = giveplayerid; //caller connecting
if (Mobile[giveplayerid] == 255)
{
format(string, sizeof(string), "Your Mobile Is Ringing Type (/Pickup) CallerID: %s", sendername);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
RingTone[giveplayerid] = 10;
format(string, sizeof(string), "* %s's phone begins to ring.", sendername);
SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up");
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CellTime[playerid] = 1;
return 1;
}
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " ..You just get a Busy tone");
return 1;
}
public OnPlayerText(playerid, text[])
{
if(Mute[playerid] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
return 0;
}
if(Mobile[playerid] != 255)
{
new string [128];
new sendername[MAX_PLAYER_NAME];
new idx;
new tmp[MAX_PLAYER_NAME];
tmp = strtok(text, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Says (cellphone): %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
//printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
if(Mobile[playerid] == 914)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Sorry I don't understand?");
return 0;
}
new turner[MAX_PLAYER_NAME];
new wanted[128];
GetPlayerName(playerid, turner, sizeof(turner));
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: We have alerted all units in the area.");
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Thank you for reporting this incident");
format(wanted, sizeof(wanted), "Dispatch: All Units IA: Caller: %s",turner);
SendTeamBeepMessage(1, TEAM_CYAN_COLOR, wanted);
format(wanted, sizeof(wanted), "Dispatch: Incident: %s",text);
SendTeamMessage(1, TEAM_CYAN_COLOR, wanted);
if(FlashTime[playerid] == 0){FlashTime[playerid] = 10;}
SendClientMessage(playerid, COLOR_GRAD2, " They Hung Up...");
Mobile[playerid] = 255;
return 0;
}
if(Mobile[playerid] == 913)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
return 0;
}
if ((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
{
new turner[MAX_PLAYER_NAME];
new wanted[128];
GetPlayerName(playerid, turner, sizeof(turner));
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: We have alerted all units in the area.");
SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
format(wanted, sizeof(wanted), "HQ: All Units APB: Reporter: %s",turner);
SendTeamBeepMessage(2, COLOR_DBLUE, wanted);
format(wanted, sizeof(wanted), "HQ: Crime: %s, Suspect: Unknown",PlayerCrime[playerid][pAccusing]);
SendTeamMessage(2, COLOR_DBLUE, wanted);
if(FlashTime[playerid] == 0){FlashTime[playerid] = 10;}
SendClientMessage(playerid, COLOR_GRAD2, " They Hung Up...");
Mobile[playerid] = 255;
return 0;
}
new badguy;
if(IsStringAName(tmp))
{
badguy = GetPlayerID(tmp);
}
else
{
badguy = strval(tmp);
}
if (gTeam[badguy] == 2 || gTeam[badguy] == 1)
{
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: You will have to contact internal affairs. This is an emergency line");
SendClientMessage(playerid, COLOR_GRAD2, " They Hung Up...");
Mobile[playerid] = 255;
return 0;
}
if (gTeam[badguy] >= 4)
{
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Units are already assigned to that case");
SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
SendClientMessage(playerid, COLOR_GRAD2, " They Hung Up...");
Mobile[playerid] = 255;
return 0;
}
if (badguy == playerid)
{
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Dont Fool Around, This is an emergency line.");
SendClientMessage(playerid, COLOR_GRAD2, " They Hung Up...");
Mobile[playerid] = 255;
return 0;
}
if (IsPlayerConnected(badguy))
{
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: We have alerted all units in the area.");
SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
SetPlayerCriminal(badguy,playerid, PlayerCrime[playerid][pAccusing],0,0);
if(FlashTime[badguy] == 0){FlashTime[playerid] = 10;}
if(FlashTime[playerid] == 0){FlashTime[playerid] = 10;}
SendClientMessage(playerid, COLOR_GRAD2, " They Hung Up...");
Mobile[playerid] = 255;
return 0;
}
else
{
format(string, sizeof(string), "Police HQ: I have no Information on %s, are you shure thats the right name?",tmp);
SendClientMessage(playerid, COLOR_DBLUE, string);
return 0;
}
}
if(Mobile[playerid] == 912)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
return 0;
}
strmid(PlayerCrime[playerid][pAccusing], text, 0, strlen(text), 255);
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: If you know the assailant's name or part of it say it now or just say no.");
Mobile[playerid] = 913;
return 0;
}
if(Mobile[playerid] == 911)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand, police or paramedic?");
return 0;
}
else if ((strcmp("police", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("police")))
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Police HQ, please hold.");
Mobile[playerid] = 912;
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Please give me a short description of the crime.");
return 0;
}
else if ((strcmp("paramedic", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("paramedic")))
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Paramedic HQ, please hold.");
Mobile[playerid] = 914;
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Please give me a short description of the Incident.");
return 0;
}
else
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand, police or paramedic?");
return 0;
}
}
if(IsPlayerConnected(Mobile[playerid]) == 1 && Mobile[Mobile[playerid]] == playerid)
{
SendClientMessage(Mobile[playerid], COLOR_YELLOW,string);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW,"Theres nobody there");
}
return 0;
}
if (realchat)
{
new string [128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Says %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 0;
}
return 1;
}