Guest User

Blind script

a guest
Jul 11th, 2013
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf>
  4. #include <foreach>
  5.  
  6. #define D_BLINDED 80001
  7. #define C_RED 0xFF0000FF
  8. #define C_CYAN 0x00FFFFFF
  9.  
  10. new pBlind[MAX_PLAYERS] = 1;
  11. new Text:Blind;
  12. public OnGameModeInit()
  13. {
  14. Blind = TextDrawCreate(641.199951, 1.500000, "usebox");
  15. TextDrawLetterSize(Blind, 0.000000, 49.378147);
  16. TextDrawTextSize(Blind, -2.000000, 0.000000);
  17. TextDrawAlignment(Blind, 3);
  18. TextDrawColor(Blind, -1);
  19. TextDrawUseBox(Blind, true);
  20. TextDrawBoxColor(Blind, 255);
  21. TextDrawSetShadow(Blind, 0);
  22. TextDrawSetOutline(Blind, 0);
  23. TextDrawBackgroundColor(Blind, 255);
  24. TextDrawFont(Blind, 1);
  25. return 1;
  26. }
  27.  
  28. public OnGameModeExit()
  29. {
  30. return 1;
  31. }
  32.  
  33. public OnPlayerConnect(playerid)
  34. {
  35. pBlind[playerid] = 0;
  36. return 1;
  37. }
  38.  
  39. CMD:blinded(playerid,params[])
  40. {
  41. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,C_RED,"You are not authorised to use this command.");
  42. new count = 0, dialogstring[576], namestring[96];
  43. foreach(new i: Player)
  44. {
  45. if(pBlind[playerid] == 1)
  46. {
  47. format(namestring, sizeof(namestring), "Blinded : {FF0000}%s [ID: %d] {CCFFAA}|{FF0000}\n", Name(i), i);
  48. strcat(dialogstring, namestring);
  49. count ++;
  50. }
  51. if(count != 0)
  52. {
  53. ShowPlayerDialog(playerid, D_BLINDED, DIALOG_STYLE_MSGBOX, "----==== Blinded Players ====----", dialogstring, "Close", "");
  54. }
  55. else ShowPlayerDialog(playerid, D_BLINDED, DIALOG_STYLE_MSGBOX, "----==== Blinded Players ====----", "No blinded players.", "Close", "");
  56. }
  57. return 1;
  58. }
  59.  
  60. CMD:blind(playerid,params[])
  61. {
  62. new str[128], targetid;
  63. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,C_RED,"You are not authorised to use this command.");
  64. if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, C_RED, "[USAGE] /blind <Playerid>");
  65. {
  66. if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, C_RED, "[SERVER] Player not connected");
  67. if(IsPlayerAdmin(targetid) && playerid != targetid) return SendClientMessage(playerid,C_RED,"[ERROR] You cannot use this command on higher level admins");
  68. format(str, sizeof(str), "%s has blinded by %s", Name(targetid), Name(playerid));
  69. SendAdminMessage(C_CYAN, str);
  70. TextDrawShowForPlayer(targetid, Blind);
  71. pBlind[playerid] = 1;
  72. }
  73. return 1;
  74. }
  75.  
  76. CMD:unblind(playerid,params[])
  77. {
  78. new str[128], targetid;
  79. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,C_RED,"You are not authorised to use this command.");
  80. if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, C_RED, "[USAGE] /unblind <Playerid>");
  81. {
  82. if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, C_RED, "[SERVER] Player not connected");
  83. if(IsPlayerAdmin(targetid) && playerid != targetid) return SendClientMessage(playerid,C_RED,"[ERROR] You cannot use this command on higher level admins");
  84. format(str, sizeof(str), "%s has unblinded by %s", Name(targetid), Name(playerid));
  85. SendAdminMessage(C_CYAN, str);
  86. TextDrawHideForPlayer(targetid, Blind);
  87. pBlind[playerid] = 0;
  88. }
  89. return 1;
  90. }
  91.  
  92. stock Name(playerid)
  93. {
  94. new name[MAX_PLAYER_NAME];
  95. GetPlayerName(playerid, name, sizeof(name));
  96. return name;
  97. }
  98.  
  99. stock SendAdminMessage(color,string[])
  100. {
  101. foreach(Player,i)
  102. {
  103. if(IsPlayerAdmin(i))
  104. {
  105. SendClientMessage(i, color, string);
  106. }
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment