Guest User

[vTc] Onclick PM

a guest
Aug 5th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. /*
  2. Welcome to [vTc] Fs's Thank you for downloading This is a NORMAL and EASY PM System which help's you to send
  3. private messages.Just Press Tab and select NAME where you want to send.
  4. _________________________________DONT REMOVE CREDIT'S! [vTc]Team __________________________________
  5. */
  6.  
  7. #include <a_samp.inc>
  8. #include <zcmd.inc>
  9.  
  10. main(){}
  11.  
  12. #define PMCOLOR 0x48D1CCFF
  13. #define ERROR 0xFF0000AA
  14. #define PMDialog 123
  15.  
  16. new Message[128];
  17. new DialogClicked[MAX_PLAYERS];
  18. new IgnorePM[MAX_PLAYERS];
  19.  
  20. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  21. {
  22. ShowPlayerDialog(playerid,PMDialog,DIALOG_STYLE_INPUT,"Private Message","Please Type your Message to send!","Send","Cancel");
  23. DialogClicked[playerid] = clickedplayerid;
  24. return 1;
  25. }
  26.  
  27. public OnPlayerConnect(playerid)
  28. {
  29. IgnorePM[playerid] = 1;
  30. return 1;
  31. }
  32. public OnPlayerDisconnect(playerid, reason)
  33. {
  34. IgnorePM[playerid] = 0;
  35. return 1;
  36. }
  37.  
  38. CMD:ignorepms(playerid, params[])
  39. {
  40. if(IgnorePM[playerid] == 1)
  41. {
  42. SendClientMessage(playerid, PMCOLOR, "From Now you are NO more recieving any PM's - Type /ignorepms again to receive them.");
  43. IgnorePM[playerid] = 0;
  44. }
  45. else
  46. {
  47. SendClientMessage(playerid, PMCOLOR, "From Now you are recieving PM's - Type /ignorepms to not receive them.");
  48. IgnorePM[playerid] = 1;
  49. }
  50. return 1;
  51. }
  52.  
  53. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  54. {
  55. if(dialogid == PMDialog)
  56. {
  57. if(response)
  58. {
  59. if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, ERROR, "Player not found!");
  60.  
  61. if(DialogClicked[playerid] == playerid) return SendClientMessage(playerid, ERROR, "* Error: You are'nt allowed to PM yourself!");
  62.  
  63. if(IgnorePM[playerid] == 0) return SendClientMessage(playerid, ERROR, "This Player is BLACKLISTED from PM's");
  64.  
  65. if(!inputtext[0])
  66. {
  67. SendClientMessage(playerid, ERROR, "* Error: The BOX is Empty Please re-type Your Message and send!.");
  68. ShowPlayerDialog(playerid,PMDialog,DIALOG_STYLE_INPUT,"Private Message","Entered message was emty - Please enter correcet.","Send","Cancel");
  69. return 1;
  70. }
  71.  
  72. if(!strlen(inputtext))
  73. {
  74. format(Message,sizeof(Message),"Wrong Message\nEnter Correct Message");
  75. ShowPlayerDialog(playerid,PMDialog,DIALOG_STYLE_INPUT,"Incorrect Message - Enter Correct Password To send PM's",Message,"Send","Cancel");
  76. return 1;
  77. }
  78.  
  79. new PMSender[MAX_PLAYER_NAME];
  80. new PMReceiver[MAX_PLAYER_NAME];
  81.  
  82. GetPlayerName(playerid, PMSender, sizeof(PMSender));
  83. GetPlayerName(DialogClicked[playerid], PMReceiver, sizeof(PMReceiver));
  84.  
  85. if(strlen(inputtext))
  86. {
  87. format(Message, 256, "Player %s Sent Private Message To %s - [MESSAGE: %s]", PMSender, PMReceiver, inputtext);
  88. printf("%s", Message);
  89.  
  90. format(Message, sizeof(Message), "[-->] PM To %s (ID: %d): %s", PMReceiver, DialogClicked[playerid], inputtext);
  91. SendClientMessage(playerid, PMCOLOR, Message);
  92.  
  93. format(Message, sizeof(Message), "[<--] PM From %s (ID: %d): %s", PMSender, playerid, inputtext);
  94. SendClientMessage(DialogClicked[playerid], PMCOLOR, Message);
  95. return 1;
  96. }
  97. }
  98. }
  99. return 0;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment