WeenSoares_

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

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