Advertisement
AiRaLoKa

Textdraw MOTD

Dec 17th, 2013
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.47 KB | None | 0 0
  1. // Textdraw MOTD (Message Of The Day)
  2. // Created by AiRa LoKa
  3. // Credits:
  4. // - AiRaLoKa for converting to textdraw
  5. // - SplinteX for the idea
  6. // - Kyle_Olsen for the the original MOTD
  7.  
  8. #define FILTERSCRIPT
  9.  
  10. #include <a_samp>
  11. #include <dini>
  12.  
  13. #define GREEN                   0x21DD00FF
  14.  
  15. #if defined FILTERSCRIPT
  16.  
  17. static Text:RandNewsText;
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     print("\n--------------------------------------");
  22.     print("Textdraw MOTD (Message Of The Day) by AiRa LoKa");
  23.     print("--------------------------------------\n");
  24.  
  25.     RandNewsText = TextDrawCreate(10.000000, 435.000000, " ");
  26.     TextDrawBackgroundColor(RandNewsText, 255);
  27.     TextDrawFont(RandNewsText, 1);
  28.     TextDrawLetterSize(RandNewsText, 0.35, 1.0);
  29.     TextDrawColor(RandNewsText, GREEN);
  30.     TextDrawSetOutline(RandNewsText, 1);
  31.     return 1;
  32. }
  33.  
  34. public OnFilterScriptExit()
  35. {
  36.     return 1;
  37. }
  38.  
  39. #else
  40.  
  41. #endif
  42.  
  43. public OnPlayerConnect(playerid)
  44. {
  45.         new file[128];
  46.         format(file, sizeof(file), "motd.ini");
  47.         if(dini_Exists(file))
  48.         {
  49.             new string[256];
  50.             new thing[256];
  51.             thing = dini_Get(file, "MOTD");
  52.             format(string, sizeof(string), "%s", thing);
  53.             TextDrawSetString(RandNewsText, string);
  54.         }
  55.         else
  56.         {
  57.             dini_Create(file);
  58.             dini_Set(file, "MOTD", "This is your server MOTD. Change it by signing into RCON and using the command /motd");
  59.             new string[256];
  60.             new thing[256];
  61.             thing = dini_Get(file, "MOTD");
  62.             format(string, sizeof(string), "%s", thing);
  63.             TextDrawSetString(RandNewsText, string);
  64.         }
  65.         TextDrawShowForPlayer(playerid, RandNewsText);
  66.         return 1; //Returns
  67. }
  68. public OnPlayerCommandText(playerid, cmdtext[])
  69. {
  70.         new file[128];
  71.         format(file, sizeof(file), "motd.ini");
  72.         if (strcmp("/motd", cmdtext, true, 5) == 0)
  73.         {
  74.                 if(IsPlayerAdmin(playerid))
  75.                 {
  76.                     new string[256];
  77.                     strmid(string, cmdtext, 6, 256);
  78.                     dini_Set(file, "MOTD", string);
  79.                     new thing[256];
  80.                     thing = dini_Get(file, "MOTD");
  81.                     format(string, sizeof(string), "%s", thing);
  82.                     TextDrawSetString(RandNewsText, string);
  83.                 }
  84.                 else
  85.                 {
  86.                     SendClientMessage(playerid, GREEN, "[ERROR]: You are not a RCON administrator!");
  87.                 }
  88.                 return 1;
  89.         }
  90.         return 0;
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement