Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:phone(playerid, params[])
- {
- if(PlayerInfo[playerid][pJailed] != 0) return SCM(playerid, COLOR_WHITE, "Can't call in jail/ajail.");
- if(PlayerIsWounded(playerid)) return SCM(playerid, COLOR_GREY, "You can't call while you are wounded.");
- if(PlayerInfo[playerid][pCellPhone] != 1) return CellMSG(playerid, "You don't have a cellphone.");
- if(cellOn[playerid] = 1)
- {
- Dialog_Show(playerid, Phone, DIALOG_STYLE_LIST, "Phone", "Dial Number\nContacts\nSend Text\nMy Music\nTurn Off Phone", "Select", "Cancel");
- }
- else {
- Dialog_Show(playerid, Phone, DIALOG_STYLE_LIST, "Phone", "Dial Number\nContacts\nSend Text\nMy Music\nTurn On Phone", "Select", "Cancel");
- }
- return 1;
- }
- ***********************************************************DIALOGS*********************************************************************
- GetNumberOwner(number)
- {
- foreach (new i : Player) if (PlayerInfo[i][pCellPhone] == number) {
- return i;
- }
- return INVALID_PLAYER_ID;
- }
- IsNumeric(const str[])
- {
- for (new i = 0, l = strlen(str); i != l; i ++)
- {
- if (i == 0 && str[0] == '-')
- continue;
- else if (str[i] < '0' || str[i] > '9')
- return 0;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- if(dialogid == 2016) {
- if (!response) return SCM(playerid, 0xD6E1EBFF, "Music Search Canceled.");
- if(strlen(inputtext)) {
- new ola[255];
- format(ola, sizeof(ola), "https://6t.pe/?song=%s", inputtext);
- PlayAudioStreamForPlayer(playerid, ola);
- }
- }
- return 0;
- }
- Dialog:SendText(playerid, response, listitem, inputtext[])
- {
- if (response)
- {
- new number = strval(inputtext);
- if (isnull(inputtext) || !IsNumeric(inputtext))
- return Dialog_Show(playerid, SendText, DIALOG_STYLE_INPUT, "Send Text", "Please enter the number that you wish to send a text message to:", "Text", "Back");
- if (GetNumberOwner(number) == INVALID_PLAYER_ID)
- return Dialog_Show(playerid, SendText, DIALOG_STYLE_INPUT, "Send Text Message", "Error: That number is not online right now.\n\nPlease enter the number that you wish to send a text message to:", "Text", "Back");
- PlayerInfo[playerid][pContacts] = GetNumberOwner(number);
- Dialog_Show(playerid, TextMessage, DIALOG_STYLE_INPUT, "Text Message", "Please enter the message to send to %s:", "Send", "Back", GetName(PlayerInfo[playerid][pContacts], 0));
- }
- else {
- cmd_phone(playerid, "\1");
- }
- return 1;
- }
- Dialog:TextMessage(playerid, response, listitem, inputtext[])
- {
- if (response)
- {
- if (isnull(inputtext))
- return Dialog_Show(playerid, TextMessage, DIALOG_STYLE_INPUT, "Text Message", "Error: Please enter a message to send.\n\nPlease enter the message to send to %s:", "Send", "Back", GetName(PlayerInfo[playerid][pContacts], 0));
- new targetid = PlayerInfo[playerid][pContacts];
- if (!IsPlayerConnected(targetid) || !PlayerInfo[targetid][pCellPhone])
- return SCM(playerid, COLOR_GREY, "The specified phone number went offline.");
- GiveCash(playerid, -2);
- format(msg, sizeof(msg), "You've been charged ~r$2~w~ for the text.");
- GameTextForPlayer(playerid, msg, 5000, 1);
- SCM(targetid, COLOR_YELLOW, "[TEXT]: %s - %s (%d)", inputtext, GetName(playerid, 0), PlayerInfo[playerid][pCellPhone]);
- SCM(playerid, COLOR_YELLOW, "[TEXT]: %s - %s (%d)", inputtext, GetName(playerid, 0), PlayerInfo[playerid][pCellPhone]);
- PlaySound(playerid, 1052);
- ActionMessage(playerid, 20.0, "takes out their phone and sends a text.", GetName(playerid, 0));
- }
- else {
- Dialog_Show(playerid, SendText, DIALOG_STYLE_INPUT, "Send Text Message", "Please enter the number that you wish to send a text message to:", "Submit", "Back");
- }
- return 1;
- }
- Dialog:CallNumber(playerid, response, listitem, inputtext[])
- {
- if (response)
- {
- new
- string[16];
- if (isnull(inputtext) || !IsNumeric(inputtext))
- return Dialog_Show(playerid, CallNumber, DIALOG_STYLE_INPUT, "Call Number", "Please enter the number that you wish to call below:", "Call", "Back");
- format(string, 16, "%d", strval(inputtext));
- cmd_call(playerid, string);
- }
- else {
- cmd_phone(playerid, "\1");
- }
- return 1;
- }
- Dialog:Phone(playerid, response, listitem, inputtext[])
- {
- if (response)
- {
- switch (listitem)
- {
- case 0:
- {
- if(GetIntVar(playerid, "cellOn") == 0)
- return SCM(playerid, COLOR_GREY, "Your phone must be powered on.");
- Dialog_Show(playerid, CallNumber, DIALOG_STYLE_INPUT, "Call Number", "Please enter the number that you wish to call below:", "Call", "Back");
- }
- case 1:
- {
- if(GetIntVar(playerid, "cellOn") == 0)
- return SCM(playerid, COLOR_GREY, "Your phone must be powered on.");
- DisplayContactList(playerid);
- }
- case 2:
- {
- if(GetIntVar(playerid, "cellOn") == 0)
- return SCM(playerid, COLOR_GREY, "Your phone must be powered on.");
- Dialog_Show(playerid, SendText, DIALOG_STYLE_INPUT, "Send Text", "Please enter the number that you wish to send a text message to:", "Send", "Back");
- }
- case 3: {
- ShowPlayerDialog(playerid, 2016, DIALOG_STYLE_INPUT, "{D6E1EB}Youtube", "{FFFFFF}Insert the video/music title", "Accept", "Cancel");
- }
- case 4:
- {
- if(GetIntVar(playerid, "OnCall") == 1) return cmd_hangup(playerid, "\1");
- if(cellOn[playerid] == 1)
- {
- cellOn[playerid] = 0;
- ActionMessage(playerid, 20.0, "has powered off their cellphone.");
- }
- else
- {
- cellOn[playerid] = 1;
- ActionMessage(playerid, 20.0, "has powered on their cellphone.");
- }
- }
- }
- }
- return 1;
- }
- Dialog:Contacts(playerid, response, listitem, inputtext[])
- {
- if(response)
- {
- //Must be +1 because slots are starting from 1
- new number = PlayerInfo[playerid][pContacts][listitem+1];
- if(number == 0)
- {
- Dialog_Show(playerid, ContactNoExist, DIALOG_STYLE_MSGBOX, "Contacts List", "The contact you have selected does not exists...", "<<<", "");
- }
- else
- {
- PlayerCallTo(playerid, number);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement