Hi, my friend gave this idea to me.
Main purpose is checking PM's for any insulting. I have a TDM server online count nearby 30-40 so I did with textdraws because in chat you can miss what they write. There is no player variable in it. You have to edit it if you'll use.
Pastebin: https://pastebin.com/tK1nQnyV
NOTE: If you find any bug, just post it.
Main purpose is checking PM's for any insulting. I have a TDM server online count nearby 30-40 so I did with textdraws because in chat you can miss what they write. There is no player variable in it. You have to edit it if you'll use.
Pastebin: https://pastebin.com/tK1nQnyV
Code:
/*
Copyright haroldfinch
*/
#include <a_samp>
#include <izcmd>
#include <sscanf2>
new giveplayerid;
new PlayerName[24],
GivePName[24];
new tmp_txt[256],
str[256];
new Text:Lines[8];
new LinesText[8][128];
public OnFilterScriptInit()
{
for(new j = 0; j < 7; j++)
{
Lines[j] = TextDrawCreate(3.000000, 250.000000 - j* 10, "");
TextDrawBackgroundColor(Lines[j], 255);
TextDrawFont(Lines[j], 1);
TextDrawLetterSize(Lines[j], 0.200000, 1.100000);
TextDrawTextSize(Lines[j], 640, 480);
TextDrawColor(Lines[j], -1);
TextDrawSetOutline(Lines[j], 1);
TextDrawSetProportional(Lines[j], 1);
LinesText[j] = "";
TextDrawSetString(Lines[j], LinesText[j]);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
for(new j = 0; j < 7; j++)
{
TextDrawShowForPlayer(playerid, Lines[j]);
}
return 1;
}
stock SendPMToBox(msg[])
{
for(new j = 1; j < 7; j++)
{
format(LinesText[j - 1], 128, "%s", LinesText[j]);
TextDrawSetString(Lines[j - 1], LinesText[j - 1]);
}
format(LinesText[6], 128, "%s", msg);
TextDrawSetString(Lines[6], LinesText[6]);
}
COMMAND:pm(playerid, params[])
{
if(sscanf(params, "is[256]", giveplayerid, tmp_txt))
return SendClientMessage(playerid, -1, "USAGE: /pm ID msg");
if(!IsPlayerConnected(giveplayerid))
return SendClientMessage(playerid, -1, "ERROR: The speficied ID is not found.");
if(giveplayerid == playerid)
return SendClientMessage(playerid, -1, "ERROR: You can not PM yourself!");
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
GetPlayerName(giveplayerid, GivePName, sizeof(GivePName));
format(str, sizeof(str), "%s(%i) -> you: %s", PlayerName, playerid, tmp_txt);
SendClientMessage(giveplayerid, -1, str);
format(str, sizeof(str), "You -> %s(%i): %s", GivePName, giveplayerid, tmp_txt);
SendClientMessage(playerid, -1, str);
new j = 0;
while(tmp_txt[j] != EOS)
{
if(tmp_txt[j] == '~') tmp_txt[j] = ' ';
j++;
}
format(str, sizeof(str), "[PM] %s(%d) > %s(%d) - %s", PlayerName, playerid, GivePName, giveplayerid, tmp_txt);
SendPMToBox(str);
return 1;
}