20.10.2012, 05:33
Quote:
tem ctz que isto ainda funciona rjjj?, lembro q testei uma vez e parece que nгo funcionou ;/
|
pawn Код:
#include <a_samp>
#define LINHAS_CHAT 10 //Nъmero de linhas do chat que devem permanecer sendo mostradas ao jogador.
new UltimasMensagens[MAX_PLAYERS][LINHAS_CHAT][128];
new CompletedMsg[MAX_PLAYERS];
new MsgColor[MAX_PLAYERS][LINHAS_CHAT];
new ModifiedLines[MAX_PLAYERS] = {-1, ...};
stock MSGForPlayer(playerid, color, const message[], bool:showing = false)
{
if(!showing)
{
if(CompletedMsg[playerid] == LINHAS_CHAT) CompletedMsg[playerid] = 0;
strmid(UltimasMensagens[playerid][CompletedMsg[playerid]], message, 0, strlen(message), 128);
MsgColor[playerid][CompletedMsg[playerid]] = color;
CompletedMsg[playerid]++;
if(ModifiedLines[playerid] == LINHAS_CHAT - 1) ModifiedLines[playerid] = -1;
ModifiedLines[playerid]++;
}
SendClientMessage(playerid, color, message);
return true;
}
stock MSGToAll(color, const message[], bool:showing = false)
{
if(!showing)
{
for(new x, y = GetMaxPlayers(); x != y; x++)
{
if(CompletedMsg[x] == LINHAS_CHAT) CompletedMsg[x] = 0;
strmid(UltimasMensagens[x][CompletedMsg[x]], message, 0, strlen(message), 128);
MsgColor[x][CompletedMsg[x]] = color;
CompletedMsg[x]++;
if(ModifiedLines[x] == LINHAS_CHAT - 1) ModifiedLines[x] = -1;
ModifiedLines[x]++;
}
}
SendClientMessageToAll(color, message);
return true;
}
#define SendClientMessage MSGForPlayer
#define SendClientMessageToAll MSGToAll
main()
{
print("[GM] Carregado !");
}
public OnPlayerRequestClass(playerid, classid)
{
for(new x = 0; x != 10; x++) SendClientMessage(playerid, -1, " ");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/musica", true))
{
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
HideAudioMessage(playerid);
return 1;
}
return 0;
}
public OnPlayerText(playerid, text[])
{
new NickName[MAX_PLAYER_NAME];
GetPlayerName(playerid, NickName, MAX_PLAYER_NAME);
format(text, 128, "%s diz: %s", NickName, text);
SendClientMessage(playerid, 0x33CCFFAA, text);
return 0;
}
stock HideAudioMessage(playerid)
{
for(new x = ModifiedLines[playerid]; x != LINHAS_CHAT; x++)
{
SendClientMessage(playerid, MsgColor[playerid][x], UltimasMensagens[playerid][x], true);
}
new y = 0;
while(y != ModifiedLines[playerid] + 1)
{
SendClientMessage(playerid, MsgColor[playerid][y], UltimasMensagens[playerid][y], true);
y++;
}
return true;
}
Espero ter ajudado .