Oblivion_UFF

DM

Mar 18th, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. JoinNewDM(playerid, joinid)
  2. {
  3. if(joinid == dm[playerid]) return GameTextForPlayer(playerid,"~g~You are alreday in that deathmatch!", 4500, 3);
  4.  
  5. if(dm[playerid] != 0) // if player is in a dm! Then execute this if statement
  6. {
  7. SendClientMessage(playerid, COLOR_BLUE, "You have left the DM, You will be moved to new DM.. Please wait!");
  8. SendClientMessage(playerid, COLOR_BLUE, "Notification of your exit has been sent to your previous dm players!");
  9. switch(dm[playerid])
  10. {
  11. case 1: //DDM
  12. {
  13. dm[playerid] = 0;
  14. format(string, sizeof(string),"{A9A9A9}[{FF0000}DDM{A9A9A9}]: {FFFFFF}%s (%d) {FF0000}has left! {FFFFFF}(Players: %d)",pname, playerid, CalcDM(1));
  15. SendDMMessage(1, string);
  16. }
  17.  
  18. case 2: //SDM
  19. {
  20. dm[playerid] = 0;
  21. format(string, sizeof(string),"{A9A9A9}[{FF0000}SDM{A9A9A9}]: {FFFFFF}%s (%d) {FF0000}has left! {FFFFFF}(Players: %d)",pname, playerid, CalcDM(2));
  22. SendDMMessage(2, string);
  23. }
  24. case 3: //SDDM
  25. {
  26. dm[playerid] = 0;
  27. format(string, sizeof(string),"{A9A9A9}[{FF0000}SDDM{A9A9A9}]: {FFFFFF}%s (%d) {FF0000}has left! {FFFFFF}(Players: %d)",pname, playerid, CalcDM(3));
  28. SendDMMessage(3, string);
  29. }
  30.  
  31. }
  32. }
  33.  
  34. // Set Player to this requested DM
  35. switch(joinid)
  36. {
  37. case 1: DD(playerid);
  38. case 2: SD(playerid);;
  39. case 3 : SDDM(playerid);
  40. }
  41. return 1;
  42. }
  43.  
  44.  
  45. // Commands
  46. CMD:ddm(playerid, params[])
  47. {
  48. JoinNewDM(playerid, 1);
  49. return 1;
  50. }
  51.  
  52. CMD:sdm(playerid, params[])
  53. {
  54. JoinNewDM(playerid, 2);
  55. return 1;
  56. }
  57.  
  58. CMD:sos(playerid, params[])
  59. {
  60. JoinNewDM(playerid, 3);
  61. return 1;
  62. }
  63.  
  64. CMD:leavedm(playerid, params[])
  65. {
  66. if(dm[playerid] == 0) return GameTextForPlayer(playerid,"~g~You are not in a deathmatch!", 4500, 3);
  67. LeaveDM(playerid);
  68. return 1;
  69. }
  70.  
  71. CMD:dm(playerid,params[])
  72. {
  73. new string[256];
  74. format(string,sizeof(string),
  75. "{00FF00}Map\t{00FF00}Players\n\
  76. {FFFFFF}Deagle Deathmatch\t%d\n\
  77. Sawn-Off Deathmatch\t%d\n\
  78. Sniper Deathmatch\t%d",CalcDM(1),CalcDM(2),CalcDM(3));
  79. ShowPlayerDialog(playerid, DIALOG_DM, DIALOG_STYLE_TABLIST_HEADERS, "{00FF00}Deathmatch List",string, "Select","Cancel");
  80. return 1;
  81. }
  82.  
  83. // Dialog
  84. case DIALOG_DM:
  85. {
  86. if(response)
  87. {
  88. if(listitem == 0)
  89. {
  90. JoinNewDM(playerid , 1);
  91. }
  92. else if(listitem == 1)
  93. {
  94. JoinNewDM(playerid , 2);
  95. }
  96. else if(listitem == 2)
  97. {
  98. JoinNewDM(playerid , 3);
  99. }
  100. }
  101. }
  102.  
  103. stock SendDMMessage(dmid, msg[])
  104. {
  105.  
  106. foreach(new i : Player) if(dm[i] == dmid)
  107. {
  108. SendClientMessage (i, COLOR_BLUE , msg);
  109. }
  110. return 1;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment