Guest User

mMOTD

a guest
Jan 16th, 2013
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <ocmd>
  4.  
  5. /*====DIALOGE====*/
  6. #define mMOTD 123
  7. #define mAEND 124
  8. /*===============*/
  9.  
  10. public OnFilterScriptInit()
  11. {
  12. print("\n---\nDanke, dass du mMOTD nutzt.\n");
  13. return 1;
  14. }
  15.  
  16. public OnFilterScriptExit()
  17. {
  18. print("\n---\nDanke, dass du mMOTD genutzt hast.\n");
  19. return 1;
  20. }
  21.  
  22. public OnPlayerSpawn(playerid)
  23. {
  24. if(dini_Exists("motd.txt")){
  25. mMOTDshow(playerid);
  26. }
  27. else{
  28. dini_Create("motd.txt");
  29. dini_Set("motd.txt","mMOTD","Dies ist Zeile 1~Dies ist Zeile 2~Und dies ist Zeile 3");
  30. SendClientMessage(playerid,-1,"INFO: MOTD wurde erstellt!");
  31. }
  32. return 1;
  33. }
  34.  
  35. ocmd:motd(playerid){
  36. mMOTDshow(playerid);
  37. return 1;
  38. }
  39.  
  40. ocmd:changemotd(playerid){
  41.  
  42. if(!IsPlayerAdmin(playerid))return 1;
  43. ShowPlayerDialog(playerid,mAEND,DIALOG_STYLE_INPUT,"mMOTD ändern","Tippe deinen Wunschtext ein.\n\"~\"für eine neue Zeile ","Ok","Doch nicht");
  44. return 1;
  45. }
  46.  
  47. stock mMOTDshow(playerid){
  48. new motd[512];
  49. format(motd,sizeof(motd),"%s",dini_Get("motd.txt","mMOTD"));
  50. while(strfind(motd, "~") != -1)
  51. {
  52. new p = strfind(motd, "~"), l2 = strlen("~");
  53. strdel(motd, p, (p+l2));
  54. strins(motd, "\n", p);
  55. }
  56. ShowPlayerDialog(
  57. playerid,mMOTD,DIALOG_STYLE_MSGBOX,"mMOTD",motd,"OK",""
  58. );
  59. return 1;
  60. }
  61.  
  62. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  63. {
  64. if(dialogid==mAEND){
  65. if(response){
  66. dini_Set("motd.txt","mMOTD",inputtext);
  67. }
  68. }
  69. return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment