Guest User

In-Game Hostname Changer [V1.0]

a guest
Oct 30th, 2014
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define DIALOG_FIRST 1
  5. #define DIALOG_SECOND 2
  6.  
  7. CMD:activatename(playerid,params[])
  8. {
  9. if(IsPlayerAdmin(playerid))
  10. {
  11. ShowPlayerDialog(playerid,DIALOG_FIRST,DIALOG_STYLE_MSGBOX,"{FF0000}Activate","Hello, and Welcome to {15FF00}HY {FF0000}Hostname {FFFF00}Changer\n\n{FFFFFF}Are you sure you want to change your server's name ?\n\nIf {15FF00}Yes {FFFFFF}, write {FF0000}/CHostname {FFFFFF},else click {15FF00}Exit {FFFFFF}!","","Exit");
  12. }
  13. else
  14. {
  15. SendClientMessage(playerid,-1, "{FF0000}ERROR: {15FF00}This command can be used only by {FF0000}RCON {15FF00}!");
  16. }
  17. return 1;
  18. }
  19.  
  20. CMD:chostname(playerid,params[])
  21. {
  22. if(IsPlayerAdmin(playerid))
  23. {
  24. ShowPlayerDialog(playerid,DIALOG_SECOND,DIALOG_STYLE_MSGBOX,"{FF0000}Succesfully","You have {15FF00}succesfully {FFFFFF}changed your hostname with {FF0000}HY's {FFFF00}Hostname {0066CC}Changer\n\n{FFFFFF}Thanks because you used this {FF0000}Filescript {FFFFFF}!","Exit","");
  25. SetTimer("Changer", 3000, true);
  26. SendClientMessage(playerid,-1, "{FF0000}You have succesfully changed your {15FF00}Server's Name{FFFFFF} by using {FF0000}HY's Hostname Changer.");
  27. SendClientMessage(playerid,-1, "{FF0000}Please check if this {15FF00}REALLY WORKS !");
  28. }
  29. else
  30. {
  31. SendClientMessage(playerid,-1, "{FF0000}ERROR: {15FF00}This command can be used only by {FF0000}RCON {15FF00}!");
  32. }
  33. return 1;
  34. }
  35. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  36. {
  37. if(dialogid == DIALOG_FIRST)
  38. {
  39. if(response)
  40. {
  41. if(listitem == 0)
  42. {
  43. SendClientMessage(playerid,-1, "{FF0000}You have succesfully changed your {15FF00}Server's Name{FFFFFF} by using {FF0000}HY's Hostname Changer.");
  44. SendClientMessage(playerid,-1, "{FF0000}Please check if this {15FF00}REALLY WORKS !");
  45. SetTimer("Changer", 3000, true);
  46. }
  47. }
  48. }
  49. return 0;
  50. }
  51.  
  52. public OnGameModeInit()
  53. {
  54. SetTimer("Changer", 3000, false);
  55. }
  56.  
  57. forward Changer();
  58.  
  59. public Changer()
  60. {
  61. new var = random(4);
  62. switch (var)
  63. {
  64. case 0: SendRconCommand("hostname » FIRST HOSTNAME « | • #1 •");
  65. case 1: SendRconCommand("hostname » SECOND HOSTNAME « | • #2 •");
  66. case 2: SendRconCommand("hostname » THIRD HOSTNAME « | • #3 •");
  67. case 3: SendRconCommand("hostname » FOURTH HOSTNAME « | • #4 •");
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment