15.09.2014, 16:45
Hey there, so i need some help with /call 911.
Whenever the player uses this command, he gets the Dispatch instead of the SAPD, this is what i've done so far but i dont get it.
CMD:
Whenever the player uses this command, he gets the Dispatch instead of the SAPD, this is what i've done so far but i dont get it.
CMD:
Код:
CMD:call(playerid, params[])
{
new number, string[128], done;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pHasCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a cellphone.");
if(!PlayerInfo[playerid][pCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You don't have a simcard.");
if(sscanf(params, "i", number)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /call [number]");
if(PhoneOff[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Your phone is turned off.");
if(Calling[playerid] || BeingCalled[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are already on a call.");
if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid phone number.");
format(string, sizeof(string), "* %s takes out their cellphone and starts calling a number.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
if(number == 911)
{
Calling[playerid] = 1;
Call911[playerid] = 1;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SendClientMessage(playerid, COLOR_YELLOW, "[Cellphone]: You are connected to the SAPD emergency line, please explain your emergency.");
}
foreach(Player, i)
{
if(PlayerInfo[i][pCellphone] == number)
{
if(PhoneOff[i]) return SendClientMessage(playerid, COLOR_GREY, "Player has their phone turned off.");
if(BeingCalled[i] || Calling[i]) return SendClientMessage(playerid, COLOR_GREY, "Number busy.");
Calling[playerid] = 1;
BeingCalled[i] = 1;
Called[playerid] = i;
Caller[i] = playerid;
SendClientMessage(playerid, COLOR_ORANGE, " The cellphone is ringing, wait for someone to pickup.");
format(string, sizeof(string), "* %s's cellphone starts ringing.", RPN(i));
SendNearbyMessage(i, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
format(string, sizeof(string), " [Cellphone]: Incoming call from %s, Ph: %d", RPN(playerid), PlayerInfo[playerid][pCellphone]);
SendClientMessage(i, COLOR_YELLOW, string);
SendClientMessage(i, COLOR_WHITE, " Type /pickup to answer or /hangup to cancel the incoming call.");
done = 1;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
}
}
if(done != 1)
{
SendClientMessage(playerid, COLOR_GREY, "Number is not currently available.");
}
return 1;
}
Код:
if(Calling[playerid] && Call911[playerid])
{
if(Call911[playerid] == 1)
{
format(D911[playerid], 12, "%s", text);
Call911[playerid] = 2;
SendClientMessage(playerid, COLOR_YELLOW, "[Cellphone]: What is your current location?");
}
else if(Call911[playerid] == 2)
{
Call911[playerid] = 0;
Calling[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "[Cellphone]: Alright, we have received your emergency call and a unit will be there shortly.");
SendClientMessage(Caller[playerid], COLOR_ORANGE, " They hungup the line.");
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an Leo Officer.");
format(string, sizeof(string), "{2641FE}Dispatch: {FFFFFF}We have received an emergency call from the phone number %d (( /track %d ))", PlayerInfo[playerid][pCellphone], playerid);
SendPlayerFactionMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "{2641FE}Emergency: {FFFFFF}%s", D911[playerid]);
SendPlayerFactionMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "{2641FE}Location: {FFFFFF}%s", text);
SendPlayerFactionMessage(playerid, COLOR_WHITE, string);
format(D911[playerid], 128, "");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
}


