Guest User

Vip System v1.2

a guest
Dec 20th, 2012
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.67 KB | None | 0 0
  1. /*
  2. #
  3. # # ###### System by
  4. # # # # # HavingGood
  5. # # # ######
  6. ### # #
  7. -------------------------------
  8. Version v 1.2!
  9. -------------------------------
  10. ' Do not remove the author ;) '
  11. -------------------------------
  12. */
  13. //---include---
  14. #include <a_samp>
  15. #include <sscanf2>
  16. #include <zcmd>
  17. //-------------
  18. //---define---
  19. #define FILTERSCRIPT
  20. #define COLOR_GREEN 0x33AA33AA
  21. #define COLOR_RED 0xFF0000AA
  22. #define COLOR_YELLOW 0xFFFF00AA
  23. //-----------
  24. //---new---
  25. new bool:vip[MAX_PLAYERS];
  26. //---------
  27. //---public---
  28. public OnPlayerText(playerid,text[])
  29. {
  30. new te[128];
  31. if(vip[playerid]) {
  32. format(te, sizeof(te), "(Vip [ID:%d]): %s", playerid, text);
  33. SendPlayerMessageToAll(playerid, te);
  34. return 0;
  35. } else {
  36. format(te, sizeof(te), "(Player [ID:%d]): %s", playerid, text);
  37. SendPlayerMessageToAll(playerid, te);
  38. return 0;
  39. }
  40. }
  41. //-------------------------------------------------------------
  42. CMD:givevip(playerid,cmdtext[]){
  43. new player;
  44. if(strcmp(PlayerName(playerid), "Admin1", false) != 0 && strcmp(PlayerName(playerid), "Admin2", false) != 0 && strcmp(PlayerName(playerid), "Admin3", false) != 0)
  45. return SendClientMessage(playerid,COLOR_RED, "You can not use this command!"); //Command on nickname
  46. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_YELLOW,"You're not the administrator");
  47. if(sscanf(cmdtext,"u",player)){
  48. SendClientMessage(playerid, -1, "Use: /givevip [player id]");
  49. return 1;
  50. }
  51. return Activevip(player);}
  52.  
  53. CMD:delvip(playerid,cmdtext[]){
  54. new player;
  55. if(strcmp(PlayerName(playerid), "Admin1", false) != 0 && strcmp(PlayerName(playerid), "Admin2", false) != 0 && strcmp(PlayerName(playerid), "Admin3", false) != 0)
  56. return SendClientMessage(playerid,COLOR_RED, "You can not use this command!"); //Command on nickname
  57. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_YELLOW,"You're not the administrator");
  58. if(sscanf(cmdtext,"u",player)){
  59. SendClientMessage(playerid, -1, "Use: /delvip [player id]");
  60. return 1;
  61. }
  62. return Deactivevip(player);}
  63.  
  64. CMD:vipme(playerid, params[]){
  65. if(vip[playerid]) SendClientMessage(playerid, COLOR_YELLOW,"You are vip!");
  66. else SendClientMessage(playerid, COLOR_YELLOW, "You are not vip!");
  67. return 1;}
  68.  
  69. CMD:vheal(playerid, params[]){ //A typical vip command (Health)
  70. if(!vip[playerid]) SendClientMessage(playerid, COLOR_RED, "You are not vip!");
  71. SetPlayerHealth(playerid, 100);
  72. return 1;}
  73.  
  74. CMD:varmour(playerid, params[]){ //A typical vip command2 (Armor)
  75. if(!vip[playerid]) SendClientMessage(playerid, COLOR_RED, "You are not vip!");
  76. SetPlayerArmour(playerid, 100);
  77. return 1;}
  78.  
  79. CMD:vnight(playerid, params[]){
  80. if(!vip[playerid]) SendClientMessage(playerid, COLOR_RED, "You are not vip!");
  81. new time;
  82. SetPlayerTime(playerid,time,0);
  83. return 1;}
  84.  
  85. CMD:vday(playerid, params[]){
  86. if(!vip[playerid]) SendClientMessage(playerid, COLOR_RED, "You are not vip!");
  87. new time;
  88. SetPlayerTime(playerid,time,12);
  89. return 1;}
  90.  
  91. CMD:vch(playerid, params[]){ //vip chat
  92. new tmp[256];
  93. new string[256];
  94. if(!strlen(tmp)) {
  95. SendClientMessage(playerid, COLOR_RED, "Use: /vch [text]");
  96. return 1;
  97. }
  98. new name[MAX_PLAYER_NAME];
  99. GetPlayerName(playerid,name, sizeof(name));
  100. if(IsPlayerAdmin(playerid)){
  101. format(string, sizeof(string), "*vip %s: %s",name, tmp);
  102. SendMessageTovip(COLOR_YELLOW, string);
  103. }
  104. return 1;}
  105.  
  106. CMD:about(playerid, params[]){ //Don't delete
  107. if(!vip[playerid]) SendClientMessage(playerid, COLOR_RED, "You are not vip!");
  108. new about[1000];
  109. strcat(about, "{CCFF99}The script was created by HavingGood\n");
  110. strcat(about, "{99FF99}Creation date: 20.12.12y\n");
  111. strcat(about, "{66FF66}Version: 1.2\n");
  112. strcat(about, "{FF6633}Merry Christmas!\n");
  113. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "About",about , "Ok", "");
  114. return 1;}
  115.  
  116. CMD:vcmd(playerid, params[]){ //Don't delete
  117. if(!vip[playerid]) SendClientMessage(playerid, COLOR_RED, "You are not vip!");
  118. new vcmd[1000];
  119. strcat(vcmd, "{FFFFFF}vip Commands\n");
  120. strcat(vcmd, "{FFFFFF}Admin Commands:\n");
  121. strcat(vcmd, " \n");
  122. strcat(vcmd, "{FF0000}/givevip [player id] - You give vip\n");
  123. strcat(vcmd, "{FF0000}/delvip [player id] - You delete vip\n");
  124. strcat(vcmd, " \n");
  125. strcat(vcmd, "{FF0000}Users Commands:\n");
  126. strcat(vcmd, " \n");
  127. strcat(vcmd, "{FF0000}/about - information about the script\n");
  128. strcat(vcmd, "{FF0000}/vipme - You check whether you have a vip account\n");
  129. strcat(vcmd, "{FF0000}/vheal - vip Heal\n");
  130. strcat(vcmd, "{FF0000}/varmour - vip armour\n");
  131. strcat(vcmd, "{FF0000}/vnight - Change the weather\n");
  132. strcat(vcmd, "{FF0000}/vday - Change the weather\n");
  133. strcat(vcmd, "{FF0000}/vch [text] - vipChat\n");
  134. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "VIP COMMANDS",vcmd , "Ok", "");
  135. return 1;}
  136.  
  137. forward Activevip(playerid);
  138. public Activevip(playerid){
  139.  
  140. if(vip[playerid]) return 0;
  141.  
  142. vip[playerid]=true;
  143. SendClientMessage(playerid, COLOR_GREEN, "You received a vip account!");
  144. return 1;}
  145.  
  146. forward Deactivevip(playerid);
  147. public Deactivevip(playerid){
  148.  
  149. if(vip[playerid]) return 0;
  150.  
  151. vip[playerid]=false;
  152. SendClientMessage(playerid, COLOR_GREEN, "Yours vip account has been deleted!");
  153. return 1;}
  154.  
  155. stock SendMessageTovip(color, const message[]) {
  156. for(new a=0; a<GetMaxPlayers(); a++) {
  157. if(IsPlayerConnected(a)) {
  158. if(vip[a]) {
  159. SendClientMessage(a, color, message);
  160. }
  161. }
  162. }
  163. }
  164. stock PlayerName(playerid)
  165. {
  166. new Name[MAX_PLAYER_NAME];
  167. GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  168. return Name;
  169. }
Advertisement
Add Comment
Please, Sign In to add comment