Advertisement
Guest User

Giacomand

a guest
Sep 14th, 2009
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new ClickedPlayerID[MAX_PLAYERS]; //Every person will have a variable
  4.  
  5. public OnFilterScriptInit()
  6. {
  7. print("\n--------------------------------------");
  8. print(" Blank Filterscript by your name here");
  9. print("--------------------------------------\n");
  10. return 1;
  11. }
  12.  
  13. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  14. {
  15. new dialog[128];
  16. new clickedplayer[MAX_PLAYER_NAME];
  17. GetPlayerName(clickedplayerid, clickedplayer, sizeof(clickedplayer));
  18. format(dialog, sizeof(dialog), "Send a Message to %s", clickedplayer);
  19. ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Private Message",dialog,"Send","Cancel");
  20. ClickedPlayerID[playerid] = clickedplayerid; // This stores clickedplayerid's ID, so we can use it later on.
  21. return 1;
  22. }
  23.  
  24. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  25. {
  26. if(dialogid == 1)
  27. {
  28. if(!response) return 0; // If you cancel this callback stops
  29. new message [128]; // the SencClientMessage
  30. new clickedplayer[MAX_PLAYER_NAME]; // a string to store names
  31. new playername[MAX_PLAYER_NAME];
  32. GetPlayerName(ClickedPlayerID[playerid], clickedplayer, sizeof(clickedplayer)); // get the ClickedPlayerID by recieving it from the variable we stored it in.
  33. GetPlayerName(playerid, playername, sizeof(playername));
  34. format(message, sizeof(message), "You sent %s(%d): %s", clickedplayer, ClickedPlayerID, inputtext); // formated the message
  35. SendClientMessage(playerid, 0xFFFFFFFF, message); // Send the message to the player, to let him know what he sent and who to.
  36. format(message, sizeof(message), "PM from %s(%d): %s", playername, playerid, inputtext); // format the message to the person who recieves the PM
  37. SendClientMessage(ClickedPlayerID[playerid], 0xFFFFFFFF, message); // Send it
  38. return 1;
  39. }
  40. return 0;
  41. }
  42.  
  43. public OnPlayerConnect(playerid)
  44. {
  45. ClickedPlayerID[playerid] = -1; // Safety measure
  46. return 1;
  47. }
  48.  
  49. public OnPlayerCommandText(playerid, cmdtext[])
  50. {
  51. /*if(strcmp(cmdtext, "/pm", false, 3) == 0)
  52. {
  53. SendClientMessage(playerid, 0xFFFFFFFF, "You can send PMs by double clicking on the player's name in the TAB"); // to let players know they can double click
  54. return 1;
  55. }
  56. return 0;*/ // uncomment this if you want to let people know about the way you can send people messages.
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement