Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////////////////////////////////////////////////////////////
- // TEXT MESSAGES //
- /////////////////////////////////////////////////////////////////////////////////
- static
- message[100],
- date[30],
- sender;
- ShowTextMessages(playerid)
- {
- new
- slot = 0;
- if(CountTextMessages(playerid) == 0)
- ShowDialog(playerid, D_UNUSED, DIALOG_STYLE_LIST, "Text Messages List", "Your inbox is empty", ">>>", "", 0);
- Count(i, MAX_TEXT_MESSAGES)
- {
- if(MEM::get_val(Texts[playerid][i], On) == 1)
- {
- PVar:playerid[DialogInputs][slot] = i;
- sender = MEM::get_val(Texts[playerid][i], From);
- Format:gText("%sFrom %d - %s\n", gText, sender);
- slot++;
- }
- }
- ShowDialog(playerid, D_TEXTS, DIALOG_STYLE_LIST, "Text Messages List", gText, "Select", ">>>", TEXTS_LIST);
- return 1;
- }
- ShowTextMessageInfo(playerid, index)
- {
- MEM::get_arr(Texts[playerid][index], Message, message, 100);
- MEM::get_arr(Texts[playerid][index], Date, date, 30);
- sender = MEM::get_val(Texts[playerid][index], From);
- SetPVarInt(playerid, "TextNumber", sender);
- Format:gText("TEXT MESSAGE - from %d\n\n"EMBED_WHITE"Date sent: %s\nContent: %s", sender, date, message);
- ShowDialog(playerid, D_TEXTS, DIALOG_STYLE_MSGBOX, "Text Messages List", gText, "Reply", ">>>", TEXT_INFO);
- }
- ShowTextMessageReply(playerid)
- {
- new to = GetPVarInt(playerid, "TextNumber");
- Format:gText("TEXT MESSAGE - reply to %d", to);
- ShowDialog(playerid, D_TEXTS, DIALOG_STYLE_INPUT, "Text Messages List", gText, "Send", ">>>", TEXT_REPLY);
- return 1;
- }
- AssignTextMessage(playerid, text[], from)
- {
- new i = FreeMessageSlot(playerid);
- if(i == INVALID_VAL_ID) {
- ClearMessageSlot(playerid, true);
- i = FreeMessageSlot(playerid);
- }
- MEM::set_arr(Texts[playerid][i], Message, text, 100);
- MEM::set_arr(Texts[playerid][i], Date, GetFullDate(), 30);
- MEM::set_val(Texts[playerid][i], From, from);
- MEM::set_val(Texts[playerid][i], On, 1);
- }
- ClearMessageSlot(playerid, bool:all = false, index = -1)
- {
- if(all)
- {
- MEM_MACR_foreach(MAX_TEXT_MESSAGES, i)
- {
- MEM::set_val(Texts[playerid][i], On, 0);
- }
- }
- else if(index != -1)
- {
- MEM::set_val(Texts[playerid][index], On, 0);
- }
- }
- FreeMessageSlot(playerid)
- {
- MEM_MACR_foreach(MAX_TEXT_MESSAGES, i)
- {
- if(MEM::get_val(Texts[playerid][i], On) == 0) return i;
- }
- return INVALID_VAL_ID;
- }
- CountTextMessages(playerid)
- {
- new count = 0;
- MEM_MACR_foreach(MAX_TEXT_MESSAGES, i)
- {
- if(MEM::get_val(Texts[playerid][i], On) == 1) count++;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement