25.05.2016, 21:34
This is my /call command and I want to pay the audio like in single players when someone calls CJ, if you know what I mean. When I receive a call I will listen the audio and when I /pickup the audio will stop. I will REP++
PHP код:
CMD:call(playerid, params[])
{
new string[128], phonenumb;
if(isnull(params))
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /call [phonenumber]");
phonenumb = strval(params);
if(PlayerInfo[playerid][pNumber] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have a cell phone.");
return 1;
}
if(PhoneOnline[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "Your phone is off.");
return 1;
}
format(string, sizeof(string), "* %s takes out a cellphone.", RPN(playerid));
SendNearbyMessage(playerid, 30.0, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
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;
if(PlayerInfo[playerid][pDead] == 1)
{
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
}
else
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SetPlayerAttachedObject(playerid, 9, 330, 6);
}
return 1;
}
if(phonenumb == 745)
{
SendClientMessage(playerid, COLOR_GREY, "Thank you for calling a Taxi, we will send your request to way. They hang up..");
new Float:PosX, Float:PosY, Float:PosZ;
GetPlayerPos(playerid, PosX, PosY, PosZ);
foreach(Player, i)
{
if(IsATaxidriver(i))
{
SetPlayerCheckpoint(i, PosX, PosY, PosZ, 5.0);
}
}
return 1;
}
if(phonenumb == PlayerInfo[playerid][pNumber])
{
SendClientMessage(playerid, COLOR_WHITE, " You just get a busy tone...");
return 1;
}
if(Mobile[playerid] != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, "You're already in a call...");
return 1;
}
foreach(Player, i)
{
if(PlayerInfo[i][pNumber] == phonenumb && phonenumb != 0)
{
new giveplayerid = i;
Mobile[playerid] = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "That player's phone is switched off.");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(Mobile[giveplayerid] != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, "You just get a busy tone...");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(Spec[giveplayerid]!=0)
{
SendClientMessage(playerid, COLOR_WHITE, "You just get a busy tone...");
Mobile[playerid] = INVALID_PLAYER_ID;
return 1;
}
if(Mobile[giveplayerid] == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "Your mobile is ringing - type /pickup to answer it. [Caller ID: %s]", RPN(playerid));
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string), "* %s's phone begins to ring.", RPN(i));
SendClientMessage(playerid, COLOR_WHITE, "HINT: You now use T to talk on your cellphone, type /hangup to hang up.");
SendNearbyMessage(playerid, 30.0, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CellTime[playerid] = 1;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SetPlayerAttachedObject(playerid, 9, 330, 6);
return 1;
}
}
}
}
}
//SendClientMessage(playerid, COLOR_WHITE, "Your call can't be completed as dialed, please check the number and try again.");
return 1;
}
PHP код:
CMD:pickup(playerid, params[])
{
if(Mobile[playerid] != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, " you're already on a call...");
return 1;
}
foreach(Player, i)
{
if(Mobile[i] == playerid)
{
Mobile[playerid] = i; //caller connecting
SendClientMessage(i, COLOR_WHITE, " They picked up the call.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SetPlayerAttachedObject(playerid, 9, 330, 6);
}
}
return 1;
}