Guest User

MOTD Filterscript by Kyle_Olsen

a guest
Jan 12th, 2011
1,365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.78 KB | None | 0 0
  1. /*
  2. MOTD FilterScript by Kyle_Olsen
  3. Do NOT remove this credit tag.
  4. */
  5.  
  6. #define FILTERSCRIPT //This is a filterscript
  7. #define GREEN           0x21DD00FF //The green color of the MOTD, if you would like another color, just change it
  8.  
  9.  
  10. #include <a_samp> //Including the pawno include. Already in every server, no need to add it
  11. #include <dini> //Including the dini include. NOT INCLUDED. Get it here: http://dracoblue.net/download-release/35/dini_1_6.zip
  12.  
  13. #if defined FILTERSCRIPT //If this is a filterscript, do anything between #if and #endif
  14.  
  15. public OnFilterScriptInit() //When the filterscript initiates
  16. {
  17.     print("\n--------------------------------------"); //Prints something in the server box
  18.     print(" MOTD filterscript by Kyle_Olsen loaded"); //Prints something in the server box
  19.     print("--------------------------------------\n"); //Prints something in the server box
  20.    
  21.     return 1; //Returns
  22. }
  23.  
  24. public OnFilterScriptExit() //On the exit of the filterscript
  25. {
  26.     print("\n--------------------------------------"); //Prints something in the server box
  27.     print(" MOTD filterscript by Kyle_Olsen unloaded"); //Prints something in the server box
  28.     print("--------------------------------------\n"); //Prints something in the server box
  29.     return 1;
  30. }
  31.  
  32. #endif //Ends the if defined filterscript above
  33.  
  34. public OnPlayerConnect(playerid) //When the player connects to the server, all inside of the {} is done
  35. {
  36.     new file[128];
  37.     format(file, sizeof(file), "motd.ini");
  38.     if(dini_Exists(file)){
  39.     new string[256];
  40.     new thing[256];
  41.     thing = dini_Get(file, "MOTD"); //Finds the file
  42.     format(string, sizeof(string), "Server MOTD: %s", thing); //Creates the string
  43.     SendClientMessage(playerid, GREEN, string); //Posts the message
  44.     }else{
  45.     dini_Create(file);
  46.     dini_Set(file, "MOTD", "This is your server MOTD. Change it by signing into RCON and using the command /motd");
  47.     new string[256];
  48.     new thing[256];
  49.     thing = dini_Get(file, "MOTD"); //Finds the file
  50.     format(string, sizeof(string), "Server MOTD: %s", thing);
  51.     SendClientMessage(playerid, GREEN, string); //Posts the message
  52.     }
  53.     return 1; //Returns
  54. }
  55. public OnPlayerCommandText(playerid, cmdtext[])
  56. {
  57.     new file[128];
  58.     format(file, sizeof(file), "motd.ini");
  59.     if (strcmp("/motd", cmdtext, true, 5) == 0)
  60.     {
  61.         if(IsPlayerAdmin(playerid)){
  62.             new string[256];
  63.             strmid(string, cmdtext, 6, 256);
  64.             dini_Set(file, "MOTD", string);
  65.             new thing[256];
  66.             thing = dini_Get(file, "MOTD"); //Finds the file
  67.             format(string, sizeof(string), "Server MOTD: %s", thing);
  68.             SendClientMessage(playerid, GREEN, string); //Posts the message
  69.            
  70.         }else{
  71.         SendClientMessage(playerid, GREEN, "You have to be logged into RCON in order to change the motd!");
  72.         }
  73.         return 1;
  74.     }
  75.     return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment