Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_ini>
- enum EnumMessages
- {
- Messages_TD[128],
- };
- new MessagesData[10][EnumMessages],
- Text:TD_RandomMessages[2],
- LastFrame;
- public OnFilterScriptExit()
- {
- SaveMessages();
- return 1;
- }
- public OnFilterScriptInit()
- {
- LastFrame = 0;
- INI_Load("MensajesRandom.ini");
- TD_RandomMessages[0] =
- TextDrawCreate(660.000000, 430.000000, "_");
- TextDrawBackgroundColor (TD_RandomMessages[0], 255);
- TextDrawFont (TD_RandomMessages[0], 1);
- TextDrawLetterSize (TD_RandomMessages[0], 0.700000, 3.000000);
- TextDrawColor (TD_RandomMessages[0], -1);
- TextDrawSetOutline (TD_RandomMessages[0], 0);
- TextDrawSetProportional (TD_RandomMessages[0], 1);
- TextDrawSetShadow (TD_RandomMessages[0], 1);
- TextDrawUseBox (TD_RandomMessages[0], 1);
- TextDrawBoxColor (TD_RandomMessages[0], 117);
- TextDrawTextSize (TD_RandomMessages[0], -30.000000, 0.000000);
- TextDrawSetSelectable (TD_RandomMessages[0], 0);
- TD_RandomMessages[1] =
- TextDrawCreate(144.000000, 434.000000, "Lorem lalalala...");
- TextDrawBackgroundColor (TD_RandomMessages[1], 255);
- TextDrawFont (TD_RandomMessages[1], 2);
- TextDrawLetterSize (TD_RandomMessages[1], 0.220000, 1.100000);
- TextDrawColor (TD_RandomMessages[1], -1);
- TextDrawSetOutline (TD_RandomMessages[1], 0);
- TextDrawSetProportional (TD_RandomMessages[1], 1);
- TextDrawSetShadow (TD_RandomMessages[1], 1);
- TextDrawSetSelectable (TD_RandomMessages[1], 0);
- SetTimer("ChangeMessage",6000,1);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason){
- for(new m = 0; m < 2; m++)
- {
- TextDrawHideForPlayer(playerid, TD_RandomMessages[m]);
- }
- return 1;
- }
- forward ChangeMessage();
- public ChangeMessage()
- {
- switch(LastFrame)
- {
- case 0 .. 9: TextDrawSetString(TD_RandomMessages[1], MessagesData[LastFrame][Messages_TD]);
- default:
- {
- LastFrame = 0;
- return TextDrawSetString(TD_RandomMessages[1], MessagesData[LastFrame][Messages_TD]);
- }
- }
- if(LastFrame != 9) LastFrame++;
- else LastFrame = 0;
- return 1;
- }
- INI:MensajesRandom[](name[], value[])
- {
- new
- mStr[30];
- for(new m = 0; m < 10; m++)
- {
- format(mStr,sizeof(mStr), "Message_%d", m); INI_String(mStr, MessagesData[m][Messages_TD], 128);
- }
- return 0;
- }
- stock SaveMessages()
- {
- new
- mStr[30],
- INI:ini = INI_Open("MensajesRandom.ini");
- for(new m = 0; m < 10; m++)
- {
- format(mStr,sizeof(mStr), "Message_%d", m); INI_WriteString(ini, mStr, MessagesData[m][Messages_TD]);
- }
- INI_Close(ini);
- }
- public OnPlayerSpawn(playerid)
- {
- for(new m = 0; m < 2; m++)
- {
- TextDrawShowForPlayer(playerid, TD_RandomMessages[m]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement