PHP код:
public OnPlayerText(playerid, text[])
{
// Anti Adv
if(AntiAdv(playerid, text)) return 0;
// The Rest
new string[128];
/*format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, RPN(playerid), text);
IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg); */
if(Mobile[playerid] != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "(Cellphone) %s says: %s", RPN(playerid), text);
if(IsPlayerInAnyVehicle(playerid)) { //Windows closed.
format(string, sizeof(string), "%s", string);
SendNearbyMessage(playerid, 3.0, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
} else {
SendNearbyMessage(playerid, 3.0, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
if(Mobile[playerid] == 914)
{
if(!text[0])
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Sorry, I don't understand?");
return 0;
}
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(string, sizeof(string), "Dispatch: All Units IA: Caller: %s",RPN(playerid));
SendLSFMDMessage(COLOR_TWPINK, string);
format(string, sizeof(string), "Dispatch: Incident: %s",text);
SendLSFMDMessage(COLOR_TWPINK, string);
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(i, 100.0, 1498.6595,-2182.5081,14.1682) || IsPlayerInRangeOfPoint(i, 25.0, 2408.0505,-1330.7889,879.7735))
{
PlayAudioStreamForPlayer(i, "http://vc-rp.eu/firetone.mp3");
format(string, sizeof(string), "* The fire alarm tone rings out as a call comes in *");
SendClientMessage(i, ACTION, string);
}
}
CalledMedics[playerid] = 1;
MedicsCallTime[playerid] = 60;
ShowPlayerBeaconForMedics(playerid);
SendClientMessage(playerid, COLOR_WHITE, " They hung up...");
Mobile[playerid] = INVALID_PLAYER_ID;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid, 9);
return 0;
}
if(Mobile[playerid] == 913)
{
if(!text[0])
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry, I don't understand?");
return 0;
}
if(strcmp("no", text, true) == 0)
{
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(string, sizeof(string), "HQ: All Units APB: Reporter: %s",RPN(playerid));
SendFBIMessage(COLOR_DBLUE, string);
SendCopMessage(COLOR_DBLUE, string);
format(string, sizeof(string), "HQ: Crime: %s, Suspect: Unknown",PlayerCrime[playerid][pAccusing]);
SendFBIMessage(COLOR_DBLUE, string);
SendCopMessage(COLOR_DBLUE, string);
CalledCops[playerid] = 1;
CopsCallTime[playerid] = 60;
ShowPlayerBeaconForCops(playerid);
SendClientMessage(playerid, COLOR_WHITE, " They hung up...");
Mobile[playerid] = INVALID_PLAYER_ID;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid, 9);
return 0;
}
new badguy = playerid;
if(IsPlayerConnected(badguy))
{
if(badguy != INVALID_PLAYER_ID)
{
if(PlayerInfo[badguy][pCrimes] > 0)
{
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_WHITE, " They hung up...");
Mobile[playerid] = INVALID_PLAYER_ID;
return 0;
}
if(badguy == playerid)
{
SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Don't fool around. This is an emergency line.");
SendClientMessage(playerid, COLOR_WHITE, " They hung up...");
Mobile[playerid] = INVALID_PLAYER_ID;
return 0;
}
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(string, sizeof(string), "HQ: All Units APB: Reporter: %s",RPN(playerid));
SendFBIMessage(COLOR_DBLUE, string);
SendCopMessage(COLOR_DBLUE, string);
format(string, sizeof(string), "HQ: Crime: %s, Suspect: %s",PlayerCrime[playerid][pAccusing], RPN(badguy));
SendFBIMessage(COLOR_DBLUE, string);
SendCopMessage(COLOR_DBLUE, string);
CalledCops[playerid] = 1;
CopsCallTime[playerid] = 60;
ShowPlayerBeaconForCops(playerid);
SendClientMessage(playerid, COLOR_WHITE, " They hung up...");
Mobile[playerid] = INVALID_PLAYER_ID;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid, 9);
return 0;
}
return 0;
}
else
{
format(string, sizeof(string), "Police HQ: I have no information on %s, are you sure that's the correct name?",text);
SendClientMessage(playerid, COLOR_DBLUE, string);
return 0;
}
}
if(Mobile[playerid] == 912)
{
if(!text[0])
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry, I don't 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(!text[0])
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry, I don't understand - police or paramedic?");
return 0;
}
else if(strcmp("police", text, true) == 0)
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to police headquarters, 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", text, true) == 0)
{
SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Medical Emergency Services headquarters, 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 don't understand - police or paramedic?");
return 0;
}
}
if(IsPlayerConnected(Mobile[playerid]))
{
if(Mobile[Mobile[playerid]] == playerid)
{
if(SpeakerPhone[playerid] != 0)
{
format(string, sizeof(string), "(speakerphone) %s says: %s", RPN(playerid), text);
SendNearbyMessage(Mobile[playerid], 3.0, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
else
{
SendClientMessage(Mobile[playerid], COLOR_YELLOW, string);
}
if(PlayerInfo[playerid][pBugged] == 1)
{
format(string, sizeof(string), "(bug) %s (cellphone): %s", RPN(playerid), text);
SendAdminMessage(COLOR_LIGHTGREEN, 1, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "There's nobody there!");
CellTime[playerid] = 0;
SendClientMessage(playerid, COLOR_WHITE, " You hung up.");
Mobile[playerid] = INVALID_PLAYER_ID;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid, 9);
}
return 0;
}
else if(Live[playerid])
{
if(IsNewsVehicle(GetPlayerVehicleID(playerid)))
{
format(string, sizeof(string), "** [Live News]: %s: %s", RPN(playerid), text);
SendClientMessageToAll(COLOR_LIGHTGREEN, string);
/*format(ircMsg, sizeof(ircMsg), "3[Live News] %s(%d): %s", RPN(playerid), playerid, text);
IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg); */
}
}
else
{
new str[256], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(str, sizeof(str), "%s{FF0000}[%d]: {FFFFFF}%s", playername, playerid, text);
SendClientMessageToAll(DEFAULT_YELLOW, str);
}
format(string,sizeof string,text);
SendNearbyMessage(playerid, 10, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
Log("logs/chat.log", string);
return 0;
}