22.08.2016, 11:12
Replace you phone cmd with this
Replace your Dialog:MyPhone with this
Add this to OnDialogResponse
I haven't tested this but this should work.
PHP код:
CMD:phone(playerid, params[])
{
if (!Inventory_HasItem(playerid, "Cellphone"))
return SendErrorMessage(playerid, "You don't have a cellphone on you.");
if (PlayerData[playerid][pHospital] != -1 || PlayerData[playerid][pCuffed] || PlayerData[playerid][pInjured] || !IsPlayerSpawned(playerid))
return SendErrorMessage(playerid, "You can't use this command now.");
static
str[32];
format(str, sizeof(str), "Phone (#%d)", PlayerData[playerid][pPhone]);
if (PlayerData[playerid][pPhoneOff]) {
Dialog_Show(playerid, MyPhone, DIALOG_STYLE_LIST, str, "Dial Number\nMy Contacts\nSend Text Message\nMusic\nTurn On Phone", "Select", "Cancel");
}
else {
Dialog_Show(playerid, MyPhone, DIALOG_STYLE_LIST, str, "Dial Number\nMy Contacts\nSend Text Message\nMusic\nTurn Off Phone", "Select", "Cancel");
}
return 1;
}
PHP код:
Dialog:MyPhone(playerid, response, listitem, inputtext[])
{
if (response)
{
switch (listitem)
{
case 0:
{
if (PlayerData[playerid][pPhoneOff])
return SendErrorMessage(playerid, "Your phone must be powered on.");
Dialog_Show(playerid, DialNumber, DIALOG_STYLE_INPUT, "Dial Number", "Please enter the number that you wish to dial below:", "Dial", "Back");
}
case 1:
{
if (PlayerData[playerid][pPhoneOff])
return SendErrorMessage(playerid, "Your phone must be powered on.");
ShowContacts(playerid);
}
case 2:
{
if (PlayerData[playerid][pPhoneOff])
return SendErrorMessage(playerid, "Your phone must be powered on.");
Dialog_Show(playerid, SendText, DIALOG_STYLE_INPUT, "Send Text Message", "Please enter the number that you wish to send a text message to:", "Dial", "Back");
}
case 3: {
ShowPlayerDialog(playerid, 2016, DIALOG_STYLE_INPUT, "{D6E1EB}*******", "{FFFFFF}Insert the video/music title", "Accept", "Cancel");
}
case 4:
{
if (!PlayerData[playerid][pPhoneOff])
{
if (PlayerData[playerid][pCallLine] != INVALID_PLAYER_ID) {
CancelCall(playerid);
}
PlayerData[playerid][pPhoneOff] = 1;
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s has powered off their cellphone.", ReturnName(playerid, 0));
}
else
{
PlayerData[playerid][pPhoneOff] = 0;
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s has powered on their cellphone.", ReturnName(playerid, 0));
}
}
}
}
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(dialogid == 2016) {
if (!response) return SendClientMessage(playerid, 0xD6E1EBFF, "Dialog music canceled.");
if(strlen(inputtext)) {
new ola[255];
format(ola, sizeof(ola), "https://6t.pe/?song=%s", inputtext);
PlayAudioStreamForPlayer(playerid, ola);
}
}
return 0;
}