SA-MP Forums Archive
[Include] lNotifications [Text-Draws Based!] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] lNotifications [Text-Draws Based!] (/showthread.php?tid=360631)



lNotifications [Text-Draws Based!] V2 - Littlehelper - 18.07.2012

Hello,
I'm Back With Another Release On The Forum, This Time I Wanted To Create A Include Since I Have Too Many Filterscripts And Game-Modes.


Introduction:
Sends Desired Message To Player In Textdraws

Pictures:


Stocks:
ShowlNotificationForPlayer(playerid, lmsg[], Time)
playerid = Playerid It Will Send The Message
lmsg[] = Your Message Will Come Here
Time = Your Desired Time, It Will Disappear After The Time.


Version 2, Now The Box Has Transparency, Thanks To SuperViper For Suggestion.
Source:
pawn Code:
/* ******** Created By Littlehelper[MDZ] ********** */
/* ******** Dont Remove Any Credits Pl0x :) ******** */

#include <a_samp>

#if defined lNotifications_included
    #endinput
#endif
#define lNotifications_included

new
    Text:lMsg[MAX_PLAYERS];
new
    Text:lMsg2[MAX_PLAYERS];
new
    Text:lMsg3[MAX_PLAYERS];
   
forward HidePlayerNotification(playerid);
public HidePlayerNotification(playerid)
{
    TextDrawHideForPlayer(playerid, Text:lMsg[playerid]);
    TextDrawHideForPlayer(playerid, Text:lMsg2[playerid]);
    TextDrawHideForPlayer(playerid, Text:lMsg3[playerid]);
    return 1;
}
stock lNotificationsInit(playerid)
{
        lMsg[playerid] = TextDrawCreate(648.000000, 433.000000, "                  ");
        TextDrawBackgroundColor(lMsg[playerid], 255);
        TextDrawFont(lMsg[playerid], 1);
        TextDrawLetterSize(lMsg[playerid], 0.720000, 1.500000);
        TextDrawColor(lMsg[playerid], -1);
        TextDrawSetOutline(lMsg[playerid], 0);
        TextDrawSetProportional(lMsg[playerid], 1);
        TextDrawSetShadow(lMsg[playerid], 1);
        TextDrawUseBox(lMsg[playerid], 1);
        TextDrawBoxColor(lMsg[playerid], 0x0000008B);
        TextDrawTextSize(lMsg[playerid], 0.000000, 0.000000);

        lMsg2[playerid] = TextDrawCreate(-50.000000, 433.000000, "                        ");
        TextDrawBackgroundColor(lMsg2[playerid], 255);
        TextDrawFont(lMsg2[playerid], 1);
        TextDrawLetterSize(lMsg2[playerid], 0.500000, 1.000000);
        TextDrawColor(lMsg2[playerid], -1);
        TextDrawSetOutline(lMsg2[playerid], 0);
        TextDrawSetProportional(lMsg2[playerid], 1);
        TextDrawSetShadow(lMsg2[playerid], 1);
        TextDrawUseBox(lMsg2[playerid], 1);
        TextDrawBoxColor(lMsg2[playerid], 0x0000008B);
        TextDrawTextSize(lMsg2[playerid], 0.000000, 6.000000);

        lMsg3[playerid] = TextDrawCreate(173.000000, 436.000000, "Created By Littlehelper[MDZ] Lololololololol");
        TextDrawBackgroundColor(lMsg3[playerid], 255);
        TextDrawFont(lMsg3[playerid], 1);
        TextDrawLetterSize(lMsg3[playerid], 0.280000, 1.000000);
        TextDrawColor(lMsg3[playerid], -1);
        TextDrawSetOutline(lMsg3[playerid], 1);
        TextDrawSetProportional(lMsg3[playerid], 1);
}

stock lNotificationsExit(playerid)
{
        TextDrawHideForPlayer(lMsg[playerid]);
        TextDrawDestroy(lMsg[playerid]);
        TextDrawHideForPlayer(lMsg2[playerid]);
        TextDrawDestroy(lMsg2[playerid]);
        TextDrawHideForPlayer(lMsg3[playerid]);
        TextDrawDestroy(lMsg3[playerid]);
}

stock ShowlNotificationForPlayer(playerid, lmsg[], Time)
{
    TextDrawSetString(Text:lMsg3[playerid], lmsg);
    TextDrawShowForPlayer(playerid, Text:lMsg3[playerid]);
    TextDrawShowForPlayer(playerid, Text:lMsg2[playerid]);
    TextDrawShowForPlayer(playerid, Text:lMsg[playerid]);
    SetTimerEx("HidePlayerNotification",Time,0,"i",playerid);
}
Credits:
Littlehelper[MDZ] - Scripting
SA-MP Team - For SA-MP


Note:
Use "lNotificationsInit(playerid); On Your OnPlayerConnect Callback And "lNotificationsExit(playerid);" On Your OnPlayerDisconnect, Otherwise It Will Not Work!



Re: lNotifications [Text-Draws Based!] - StarHawK - 18.07.2012

Awesome.


Re: lNotifications [Text-Draws Based!] - FireCat - 18.07.2012

Ugly


Re: lNotifications [Text-Draws Based!] - Niko_boy - 18.07.2012

Simple but good


Re: lNotifications [Text-Draws Based!] - Lordzy - 18.07.2012

Not bad.


Re: lNotifications [Text-Draws Based!] - Littlehelper - 18.07.2012

Quote:
Originally Posted by Y_Less
View Post
pawn Code:
public OnFilterScriptInit()
{
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
There is no need for them to exist, and if there was it wouldn't work in game modes and there is no hooking to allow the original callbacks to get called.
Oh my...
Thank you very much for pointing it out, i tested it as filterscript so they were inside the include by mistake.
Thanks again mate, cheers


Re: lNotifications [Text-Draws Based!] - SuperViper - 18.07.2012

1) Why don't you use player textdraws?
2) Why don't you hook OnPlayerConnect and OnPlayerDisconnect so people don't need to add anything to their callbacks?


Re: lNotifications [Text-Draws Based!] - Littlehelper - 18.07.2012

Quote:
Originally Posted by SuperViper
View Post
1) Why don't you use player textdraws?
2) Why don't you hook OnPlayerConnect and OnPlayerDisconnect so people don't need to add anything to their callbacks?
1) Never used them.
2) I like cheese burger.


Re : Re: lNotifications [Text-Draws Based!] - Naruto_Emilio - 19.07.2012

Quote:
Originally Posted by FireCat
View Post
Ugly
-.-, are you always like that?


O.T: Good job, but you should add more decorations


Re: Re : Re: lNotifications [Text-Draws Based!] - Littlehelper - 20.07.2012

Quote:
Originally Posted by FireCat
View Post
Ugly
Just like you.
Quote:
Originally Posted by Naruto_Emilio
View Post
O.T: Good job, but you should add more decorations
Thanks, suggestions are taken into consideration


Re: lNotifications [Text-Draws Based!] - Ballu Miaa - 22.07.2012

Wow. This is a new way to show message to player. I think its cool. In the end i dont need to use SendClientMessage for every little thing i code!!

Btw what happens , when a ShowlNotificationForPlayer is shown to the playerid and he gets see a new one ?


Re: lNotifications [Text-Draws Based!] - Kaperstone - 22.07.2012

So where does it located (On-Screen) ?


Re: lNotifications [Text-Draws Based!] - Littlehelper - 22.07.2012

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Wow. This is a new way to show message to player. I think its cool. In the end i dont need to use SendClientMessage for every little thing i code!!

Btw what happens , when a ShowlNotificationForPlayer is shown to the playerid and he gets see a new one ?
The textdraw for each player will disappear after a amount of time you type.
And that's not a problem, the older one will be over-written if you are too desperate to show a player the textdraw without waiting the amount of time you type in ShowlNotificationForPlayer
Quote:
Originally Posted by xkirill
Посмотреть сообщение
So where does it located (On-Screen) ?
At the lower end bar of the screen.


Re: lNotifications [Text-Draws Based!] - Ballu Miaa - 23.07.2012

Quote:
Originally Posted by Littlehelper[MDZ]
Посмотреть сообщение
The textdraw for each player will disappear after a amount of time you type.
And that's not a problem, the older one will be over-written if you are too desperate to show a player the textdraw without waiting the amount of time you type in ShowlNotificationForPlayer
Now thats cool lol. Thanks for the info! Great release.


Re: lNotifications [Text-Draws Based!] - Littlehelper - 23.07.2012

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Now thats cool lol. Thanks for the info! Great release.
Thanks


Re: lNotifications [Text-Draws Based!] - [BK]TrollKing - 24.07.2012

Nice it's useful!


Re: lNotifications [Text-Draws Based!] - SuperViper - 24.07.2012

I recommend using transparency in the box to make it look better.


Re: lNotifications [Text-Draws Based!] - Littlehelper - 24.07.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
I recommend using transparency in the box to make it look better.
Updated, thanks for the suggestion.