-RuLing-

RuLing & haroldfinch Pm Okuma Sistemi

Jul 6th, 2017
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. /* Textdraw'lı Pm Okuma Sistemi
  2.  
  3. (¯`·.¸¸.-> °º Copyright haroldfinch - RuLing º° <-.¸¸.·´¯)
  4.  
  5. Sistemin Amacı:
  6. Adminlerin "Pm Okuma, Hile Uyarısı" gibi özellikleri olan sunucu
  7. modlarında chat ekranında doğal olarak chat kirliliği oluyor.
  8. Bu sistem chat ekranının hemen altında o işlevi chat ekranı gibi
  9. yerine getiriyor.
  10.  
  11. İyi Kullanımlar:)
  12.  
  13. (¯`·.¸¸.-> °º V2 º° <-.¸¸.·´¯)
  14. Son Eklenenler:
  15. 1) Türkçe Karakter Problemi Çözüldü.
  16. 2) Otomatik Silme Eklendi.
  17. */
  18. #include <a_samp>
  19. #include <zcmd>
  20. #include <sscanf2>
  21.  
  22. new giveplayerid;
  23.  
  24. new PlayerName[24],
  25. GivePName[24];
  26.  
  27. new tmp_txt[256],
  28. str[256],
  29. PMTXT=-1;
  30.  
  31. new Text:Lines[8];
  32. new LinesText[8][128];
  33.  
  34. main() {}
  35.  
  36. public OnGameModeInit()
  37. {
  38. for(new j = 0; j < 7; j++)
  39. {
  40. Lines[j] = TextDrawCreate(3.000000, 250.000000 - j* 10, "");
  41.  
  42. TextDrawBackgroundColor(Lines[j], 255);
  43. TextDrawFont(Lines[j], 1);
  44. TextDrawLetterSize(Lines[j], 0.200000, 1.100000);
  45. TextDrawTextSize(Lines[j], 640, 480);
  46. TextDrawColor(Lines[j], -1);
  47. TextDrawSetOutline(Lines[j], 1);
  48. TextDrawSetProportional(Lines[j], 1);
  49.  
  50. LinesText[j] = "";
  51. TextDrawSetString(Lines[j], LinesText[j]);
  52. }
  53. return 1;
  54. }
  55.  
  56. public OnPlayerSpawn(playerid)
  57. {
  58. for(new j = 0; j < 7; j++)
  59. {
  60. TextDrawShowForPlayer(playerid, Lines[j]);
  61. }
  62. return 1;
  63. }
  64.  
  65. COMMAND:pm(playerid, params[])
  66. {
  67. if(sscanf(params, "is[256]", giveplayerid, tmp_txt))
  68. return SendClientMessage(playerid, -1, "KULLANIM: /pm ID mesaj");
  69.  
  70. if(!IsPlayerConnected(giveplayerid))
  71. return SendClientMessage(playerid, -1, "HATA: Belirtilen kullanıcı bulunamadı.");
  72.  
  73. if(giveplayerid == playerid)
  74. return SendClientMessage(playerid, -1, "HATA: Kendi kendine PM gönderemezsin!");
  75.  
  76. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  77. GetPlayerName(giveplayerid, GivePName, sizeof(GivePName));
  78.  
  79. format(str, sizeof(str), "%s(%i) -> sen: %s", PlayerName, playerid, tmp_txt);
  80. SendClientMessage(giveplayerid, -1, str);
  81.  
  82. format(str, sizeof(str), "sen -> %s(%i): %s", GivePName, giveplayerid, tmp_txt);
  83. SendClientMessage(playerid, -1, str);
  84.  
  85. new j = 0;
  86. while(tmp_txt[j] != EOS)
  87. {
  88. if(tmp_txt[j] == '~') tmp_txt[j] = ' ';
  89. j++;
  90. }
  91.  
  92. format(str, sizeof(str), "[PM] %s(%d) >> %s(%d): %s", PlayerName, playerid, GivePName, giveplayerid, tmp_txt);
  93. SendPMToBox(ConvertToTurkish(str));
  94. return 1;
  95. }
  96.  
  97. // - Türkçe Karakterleri İngilizceye Çevirme
  98. stock ConvertToTurkish(txt[])
  99. {
  100. new converted_txt[256];
  101. strcat(converted_txt, txt);
  102.  
  103. for (new i = 0; i < 256; i++)
  104. {
  105. switch (converted_txt[i])
  106. {
  107. case 'ğ': converted_txt[i] = 'g';
  108. case 'Ğ': converted_txt[i] = 'G';
  109. case 'ş': converted_txt[i] = 's';
  110. case 'Ş': converted_txt[i] = 'S';
  111. case 'ı': converted_txt[i] = 'i';
  112. case 'ö': converted_txt[i] = 'o';
  113. case 'Ö': converted_txt[i] = 'O';
  114. case 'ç': converted_txt[i] = 'c';
  115. case 'Ç': converted_txt[i] = 'C';
  116. case 'ü': converted_txt[i] = 'u';
  117. case 'Ü': converted_txt[i] = 'U';
  118. case 'İ': converted_txt[i] = 'I';
  119. }
  120. }
  121. return converted_txt;
  122. }
  123.  
  124. stock SendPMToBox(msg[])
  125. {
  126. for(new j = 1; j < 7; j++)
  127. {
  128. format(LinesText[j - 1], 128, "%s", LinesText[j]);
  129. TextDrawSetString(Lines[j - 1], LinesText[j - 1]);
  130. }
  131. format(LinesText[6], 128, "%s", msg);
  132. TextDrawSetString(Lines[6], LinesText[6]);
  133. // - Mesajları Otomatik Silme
  134. if(PMTXT!=-1)KillTimer(PMTXT);
  135. PMTXT = -1;
  136. PMTXT = SetTimerEx("DeletePMToBox",3500,false,"d",0);
  137. }
  138.  
  139. // - Mesajları Otomatik Silme
  140. forward DeletePMToBox(id);
  141. public DeletePMToBox(id)
  142. {
  143. for(new i=0;i<4;i++){
  144. LinesText[id][0] = EOS;
  145. TextDrawSetString(Lines[id],"");
  146. }
  147. if(id >=9)return 1;
  148. PMTXT = SetTimerEx("DeletePMToBox",3500,false,"d",id+1);
  149. return 1;
  150. }
Advertisement
Add Comment
Please, Sign In to add comment