how to clear chat after player connected
#1

i already clear chat on playerconnect but when player connected the 1 message from sa-mp so abuse
Reply
#2

oh got it Yesss!
Quote:

new timerclearconnectchat;
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid, 0xA9C4E400);
Logged[playerid] = 0;
Checkpoint[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "Loading...");
if(IsPlayerConnected(playerid))
{
format(Player[playerid][pName], MAX_PLAYER_NAME, "%s", GetName(playerid));
new ORMrmid = Player[playerid][pORM_ID] = orm_create("players");
orm_addvar_int(ormid, Player[playerid][pID], "ID");
orm_addvar_string(ormid, Player[playerid][pName], MAX_PLAYER_NAME+1, "Name");
orm_addvar_string(ormid, Player[playerid][pPassword], 32, "Password");
orm_addvar_int(ormid, Player[playerid][pAdmin], "Admin");
orm_addvar_int(ormid, Player[playerid][pClass], "Class");
orm_addvar_int(ormid, Player[playerid][pLevel], "Level");
orm_addvar_int(ormid, Player[playerid][pRespect], "Respect");
orm_addvar_int(ormid, Player[playerid][pPoint], "Point");
orm_addvar_int(ormid, Player[playerid][pCash], "Cash");
orm_addvar_int(ormid, Player[playerid][pFac], "Faction");
orm_addvar_int(ormid, Player[playerid][pRank], "Rank");
orm_addvar_int(ormid, Player[playerid][pJob], "Job");
orm_addvar_int(ormid, Player[playerid][pSkill], "Skill");
orm_addvar_int(ormid, Player[playerid][pSkin], "Skin");
orm_setkey(ormid, "Name");
orm_select(ormid, "OnPlayerDataLoad", "d", playerid);
timerclearconnectchat = SetTimerEx("ClearConnectChat", 1000, true, "d", playerid);
}
return 1;
}

forward ClearConnectChat(playerid);
public ClearConnectChat(playerid)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, "z ");
KillTimer(timerclearconnectchat);
}
}

Reply
#3

Instead of making long codes, like this

Код:
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, "z ");
Change it to this:

pawn Код:
for(new i = 0; i < 100; i ++) SendClientMessage(playerid, -1, " ");
You can remove the SA:MP chat thing when the player has been fully connected, use a timer like a 3 second timer? Afterwards clear the chat and finish.
Reply
#4

Quote:
Originally Posted by Zex Tan
Посмотреть сообщение
Instead of making long codes, like this

Код:
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, " ");
SendClientMessage(playerid, COLOR_BLUE3, "z ");
Change it to this:

pawn Код:
for(new i = 0; i < 100; i ++) SendClientMessage(playerid, -1, " ");
You can remove the SA:MP chat thing when the player has been fully connected, use a timer like a 3 second timer? Afterwards clear the chat and finish.
You only need a loop of 21, that will clear that chat. Any more can cause lag.
Reply
#5

pawn Код:
#define CleanChatToPlayer(%0,%1) for(new msg=0; msg<%1; msg++) {SendClientMessage(%0, -1, " ");}
//native CleanChatToPlayer(playerid, cant=100);

#define CleanChatToAll(%0) for(new msg=0; msg<%0; msg++) {SendClientMessageToAll(-1, " ");}
//native CleanChatToAll(cant=100);
Reply
#6

Under OnPlayerConnect.
pawn Код:
for(new Order = 0; Order < 200; Order++)
                SendClientMessageToAll(-1, " ");
Reply
#7

pawn Код:
for(new i = 0; i < 100; i++) SendClientMessage(playerid, -1, " ");
The first guy had it right... there is total of 100 lines saved in a player's chat log on-screen at any time. So 200 would be useless and a waste of data. 29 wouldn't clear the entire chat. Using SendClientMessageToAll would clear everyone's chat, which I'm pretty sure he doesn't want.

pawn Код:
public OnPlayerConnect(playerid)
{
    for(new i = 0; i < 100; i++) SendClientMessage(playerid, -1, " ");
    return 1;
}
Simple...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)