Advertisement
WeenSoares_

[FilterScript]Sistema de Private Message(PM) - ZCMD

Jan 4th, 2012
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. /*
  2.  
  3. FilterScript Sistema de Private Message(PM)
  4. Direito autoriais: WeenSoares
  5. Contato: weensoares@live.com
  6.  
  7. */
  8. #include <a_samp>
  9. #include <zcmd>
  10. #include <sscanf2>
  11. new bool:LerPms[MAX_PLAYERS];
  12. new bool:PmBlock[MAX_PLAYERS];
  13. new string[128];
  14. new playername[MAX_PLAYER_NAME];
  15. new giveplayername[MAX_PLAYER_NAME];
  16. new giveplayerid;
  17. new texto;
  18. //==============================/*FILTERSCRIPTINIT*/==============================//
  19. public OnFilterScriptInit()
  20. {
  21.  
  22. print("•\n");
  23. print("******************************************************");
  24. print("* [FilterScript] Sistema de Private Message(PM) *\n");
  25. print("* Carregando... *\n\n");
  26. print("* Carregado 100%. *");
  27. print("******************************************************");
  28. print("•\n");
  29. return 1;
  30. }
  31. //==============================/*ONPLAYERCONNECT*/==============================//
  32. public OnPlayerConnect(playerid)
  33. {
  34. LerPms[playerid] = false;
  35. PmBlock[playerid] = false;
  36. return 1;
  37. }
  38. public OnPlayerCommandText(playerid, cmdtext[])
  39. {
  40. return 1;
  41. }
  42. //==============================/*INICIO DOS COMANDOS*/==============================//
  43. CMD:pm(playerid, params[])
  44. {
  45. if(sscanf(params, "us", giveplayerid, texto))
  46. {
  47. SendClientMessage(playerid, 0x33AA33AA, "Uso correto: /pm [id do player] [menssagem]");
  48. }
  49. else
  50. {
  51. if(IsPlayerConnected(playerid))
  52. {
  53. if(IsPlayerConnected(giveplayerid))
  54. {
  55. GetPlayerName(playerid, playername, sizeof(playername));
  56. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  57. if(PmBlock[playerid])
  58. {
  59. format(string,sizeof(string),"[Private Message]: Você não pode enviar uma menssagem pois a sua PM está bloqueada!");
  60. SendClientMessage(playerid, 0xFF80808B, string);
  61. return 1;
  62. }
  63. if(PmBlock[giveplayerid])
  64. {
  65. format(string,sizeof(string),"[Private Message]: Você não pode enviar uma menssagem para %s pois ele está com o PM Bloqueado!", giveplayername);
  66. SendClientMessage(playerid, 0xFF80808B, string);
  67. return 1;
  68. }
  69. format(string,sizeof(string),">> Enviada para: %s (%d): %s", giveplayername, giveplayerid, texto);
  70. SendClientMessage(playerid,0xFFD500FF,string);
  71. format(string,sizeof(string),"** Recebida de: %s (%d): %s", playername, playerid, texto);
  72. GameTextForPlayer(giveplayerid, "~w~MENSAGEM ~r~RECEBIDA", 3000, 1);
  73. SendClientMessage(giveplayerid,0xFF80808B,string);
  74. PlayerPlaySound(giveplayerid, 1085, 0.0, 0.0, 0.0);
  75. printf("[Private Message]: %s envio para %s: %s", playername, giveplayername, texto);
  76. for(new i; i < MAX_PLAYERS; i++)
  77. {
  78. if(IsPlayerAdmin(playerid) && LerPms[i] == true)
  79. {
  80. format(string, sizeof(string), "** %s envio para %s: %s", playername, giveplayername, texto);
  81. SendClientMessage(i, 0xFF80808B, string);
  82. }
  83. }
  84. }
  85. else
  86. {
  87. format(string, sizeof(string), "* O ID %d não está online.", giveplayerid);
  88. SendClientMessage(playerid, 0x00FFFFAA, string);
  89. }
  90. }
  91. else
  92. {
  93. SendClientMessage(playerid, 0x00FFFFAA, "Você tem que está logado para usar este comando!");
  94. }
  95. }
  96. return 1;
  97. }
  98. CMD:bpm(playerid)
  99. {
  100. if(!PmBlock[playerid])
  101. {
  102. SendClientMessage(playerid, 0xFF80808B, "[Private Message]: Private Message bloqueada!");
  103. PmBlock[playerid] = true;
  104. }
  105. else
  106. {
  107. SendClientMessage(playerid, 0xFF80808B, "[Private Message]: Private Message já bloqueada!");
  108. return 1;
  109. }
  110. return 1;
  111. }
  112. CMD:lpm(playerid)
  113. {
  114. if(IsPlayerConnected(playerid))
  115. {
  116. if(PmBlock[playerid])
  117. {
  118. SendClientMessage(playerid, 0xFF80808B, "[Private Message]: Private Message liberada!");
  119. PmBlock[playerid] = false;
  120. }
  121. else
  122. {
  123. SendClientMessage(playerid, 0xFF80808B,"[Private Message]: Private Message já liberada!");
  124. }
  125. }
  126. return 1;
  127. }
  128. CMD:lerpms(playerid)
  129. {
  130. if(IsPlayerConnected(playerid))
  131. {
  132. if(IsPlayerAdmin(playerid))
  133. {
  134. if(!LerPms[playerid])
  135. {
  136. SendClientMessage(playerid, 0xFF80808B, "AdmCMD: Você está lendo as [Private Message].");
  137. LerPms[playerid] = true;
  138. }
  139. else
  140. {
  141. SendClientMessage(playerid, 0xFF80808B, "AdmCMD: Você parou de ler as [Private Message].");
  142. LerPms[playerid] = false;
  143. return 1;
  144. }
  145. }
  146. else
  147. {
  148. SendClientMessage(playerid, 0x00FFFFAA, "Você não tem permissão para usar este comando!");
  149. }
  150. }
  151. else
  152. {
  153. SendClientMessage(playerid, 0x00FFFFAA, "Você tem que está logado para usar este comando!");
  154. }
  155. return 1;
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement