Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- notificationg.Show("Tittle", "Text", "Text2", "Logo");
- */
- // * Settings * //
- #define MAX_NOTIFY (8) // max show notofication
- #define MAX_NT_STRING (320)
- #define MAX_NT_STRING2 (320)
- #define MAX_NT_TITLE (64)
- #define SECONDS_NT (5)
- enum ntInfo {ntIcon[32], ntTitle[MAX_NT_TITLE], ntMessage[MAX_NT_STRING], ntMessage2[MAX_NT_STRING2], ntLines }
- static notifyInfo[MAX_NOTIFY][ntInfo],
- Text:notifyPTD[MAX_NOTIFY * 7],
- notifyIndex;
- #define notify::%0(%1) forward %0(%1); public %0(%1)
- #define InternalNotification_show InternalNotification_Show
- #define notificationg. InternalNotification_
- static const TDTextCaracterWidth[] = {
- 0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
- 12,12,12,12,12,12,12,13,13,28,28,28,28,8,17,17,30,28,28,12,9,21,28,14,28,28,
- 28,28,28,28,28,28,13,13,30,30,30,30,10,25,23,21,24,22,20,24,24,17,20,22,20,
- 30,27,27,26,26,24,23,24,31,23,31,24,23,21,28,33,33,14,28,10,11,12,9,11,10,
- 10,12,12,7,7,13,5,18,12,10,12,11,10,12,8,13,13,18,17,13,12,30,30,37,35,37,
- 25,25,25,25,33,21,24,24,24,24,17,17,17,17,27,27,27,27,31,31,31,31,11,11,11,
- 11,11,20,9,10,10,10,10,7,7,7,7,10,10,10,10,13,13,13,13,27,12,30
- };
- // Get width for char //
- stock getSizeMessage(const message[], maxWidth=500) {
- new size = 0, lines=1, i=-1, lastPoint = 0;
- while(message[++i]) {
- size += TDTextCaracterWidth[message[i]];
- switch(message[i]) {
- case ' ':
- lastPoint = i;
- default:
- if(size >= maxWidth)
- ++lines,
- size -= maxWidth,
- size += i - lastPoint;
- }
- }
- return lines;
- }
- stock getSizeMessage2(const message2[], maxWidth=500) {
- new size = 0, lines=1, i=-1, lastPoint = 0;
- while(message2[++i]) {
- size += TDTextCaracterWidth[message2[i]];
- switch(message2[i]) {
- case ' ':
- lastPoint = i;
- default:
- if(size >= maxWidth)
- ++lines,
- size -= maxWidth,
- size += i - lastPoint;
- }
- }
- return lines;
- }
- //main function for show notification
- stock InternalNotification_Show(const title[], const message[], const message2[], const icon[] = "hud:radar_triads")
- {
- for(new x=-1;++x<notifyIndex;) {
- for(new i=-1;++i<7;) TextDrawDestroy(notifyPTD[(x*7) + i]);
- notifyInfo[notifyIndex-x] = notifyInfo[(notifyIndex-x)-1];
- }
- strmid(notifyInfo[0][ntTitle], title, 0, MAX_NT_TITLE);
- strmid(notifyInfo[0][ntMessage], message, 0, MAX_NT_STRING);
- strmid(notifyInfo[0][ntMessage2], message2, 0, MAX_NT_STRING2);
- strmid(notifyInfo[0][ntIcon], icon, 0, 20);
- notifyInfo[0][ntLines] = getSizeMessage(message);
- notifyInfo[0][ntLines] += getSizeMessage(message2);
- ++notifyIndex;
- new Float:static_x=0.0;
- for(new x=-1;++x<notifyIndex;) {
- createNotifyTD(x, x * 7, static_x);
- static_x+=(notifyInfo[x][ntLines] * 7.5) + 34.1;
- }
- SetTimer("destroy_notify", SECONDS_NT * 1000, false);
- return 1;
- }
- // when the notification stops //
- notify::destroy_notify() {
- if(!notifyIndex) return 1;
- --notifyIndex;
- for(new i=-1;++i<7;) TextDrawDestroy(notifyPTD[(notifyIndex*7) + i]);
- return 1;
- }
- // display notification //
- stock createNotifyTD(index, i, const Float:static_x) {
- new lines = notifyInfo[index][ntLines],Float:x = (lines * 7.5) + static_x;
- notifyPTD[i] = TextDrawCreate(517.247802, 340.083221 - x, "ld_bum:blkdot");
- TextDrawFont(notifyPTD[i], 4);
- TextDrawLetterSize(notifyPTD[i], 0.000000, 0.000000 + (lines *0.9));
- TextDrawTextSize(notifyPTD[i], 135.402648, 37.916664);
- TextDrawSetOutline(notifyPTD[i], 1);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], 190);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawBoxColor(notifyPTD[i], 50);
- TextDrawUseBox(notifyPTD[i], 1);
- TextDrawSetProportional(notifyPTD[i], 1);
- TextDrawShowForAll(notifyPTD[i]);
- notifyPTD[++i] = TextDrawCreate(27.84, 298.5 - x, "");
- TextDrawLetterSize(notifyPTD[i], 0.0, 0.0);
- TextDrawTextSize(notifyPTD[i], 109.0, 15.0 + (lines * 7.2));
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], -16777184);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawSetOutline(notifyPTD[i], 0);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawFont(notifyPTD[i], 4);
- TextDrawSetProportional(notifyPTD[i], 0);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawShowForAll(notifyPTD[i]);
- notifyPTD[++i] = TextDrawCreate(517.247497, 337.749969 - x, "ld_bum:blkdot");
- TextDrawFont(notifyPTD[i], 4);
- TextDrawLetterSize(notifyPTD[i], 0.000000, 0.000000);
- TextDrawTextSize(notifyPTD[i], 142.430450, 2.916687);
- TextDrawSetOutline(notifyPTD[i], 1);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], 512819199);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawBoxColor(notifyPTD[i], 50);
- TextDrawUseBox(notifyPTD[i], 1);
- TextDrawSetProportional(notifyPTD[i], 1);
- TextDrawShowForAll(notifyPTD[i]);
- notifyPTD[++i] = TextDrawCreate(519.590270, 343.583374 - x, notifyInfo[index][ntIcon]);
- TextDrawFont(notifyPTD[i], 4);
- TextDrawLetterSize(notifyPTD[i], 0.000000, 0.000000);
- TextDrawTextSize(notifyPTD[i], 8.286972, 9.916668);
- TextDrawSetOutline(notifyPTD[i], 1);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], 16711935);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawBoxColor(notifyPTD[i], 50);
- TextDrawUseBox(notifyPTD[i], 1);
- TextDrawSetProportional(notifyPTD[i], 1);
- TextDrawShowForAll(notifyPTD[i]);
- notifyPTD[++i] = TextDrawCreate(529.429382, 341.833343 - x, notifyInfo[index][ntTitle]);
- TextDrawFont(notifyPTD[i], 1);
- TextDrawLetterSize(notifyPTD[i], 0.181259, 1.194166);
- TextDrawTextSize(notifyPTD[i], 617.000000, 12.500000);
- TextDrawSetOutline(notifyPTD[i], 0);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], -1);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawBoxColor(notifyPTD[i], 50);
- TextDrawUseBox(notifyPTD[i], 0);
- TextDrawSetProportional(notifyPTD[i], 1);
- TextDrawShowForAll(notifyPTD[i]);
- notifyPTD[++i] = TextDrawCreate(520.058715, 353.500091 - x, notifyInfo[index][ntMessage]);
- TextDrawFont(notifyPTD[i], 1);
- TextDrawLetterSize(notifyPTD[i], 0.200000, 1.200000);
- TextDrawTextSize(notifyPTD[i], 676.500000, 12.500000);
- TextDrawSetOutline(notifyPTD[i], 0);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], -1);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawBoxColor(notifyPTD[i], 50);
- TextDrawUseBox(notifyPTD[i], 0);
- TextDrawSetProportional(notifyPTD[i], 1);
- TextDrawShowForAll(notifyPTD[i]);
- notifyPTD[++i] = TextDrawCreate(520.058715, 363.500091 - x, notifyInfo[index][ntMessage2]);
- TextDrawFont(notifyPTD[i], 1);
- TextDrawLetterSize(notifyPTD[i], 0.200000, 1.200000);
- TextDrawTextSize(notifyPTD[i], 676.500000, 12.500000);
- TextDrawSetOutline(notifyPTD[i], 0);
- TextDrawSetShadow(notifyPTD[i], 0);
- TextDrawAlignment(notifyPTD[i], 1);
- TextDrawColor(notifyPTD[i], -1);
- TextDrawBackgroundColor(notifyPTD[i], 255);
- TextDrawBoxColor(notifyPTD[i], 50);
- TextDrawUseBox(notifyPTD[i], 0);
- TextDrawSetProportional(notifyPTD[i], 1);
- TextDrawShowForAll(notifyPTD[i]);
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- notifyIndex = 0;
- #if defined NT_OnPlayerConnect
- return NT_OnPlayerConnect(playerid);
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnPlayerConnect NT_OnPlayerConnect
- #if defined NT_OnPlayerConnect
- forward NT_OnPlayerConnect(playerid);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement