[Ajuda] Como criar chat para os players.
#1

Tava precisando de um chat para todos os players do servidor ai passei nesse tуpico : https://sampforum.blast.hk/showthread.php?tid=325602
mais o chat й para gangs.
alguйm pode fazer um chat exemplo : "! [ texto]" para falar e no chat aparecia [ Server - Chat ] : [player] [ texto]
obg +rep pra quem me ajudar :3

@EDIT : USO DCMD.
Reply
#2

Explique direito nгo entendi.
Reply
#3

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Explique direito nгo entendi.
Assim , exemplo um chat de gang mais para todos do server usarem exemplo : ! [player] : [messagem]
dai aparecia no chat para todos verem e ersponderem.
Reply
#4

Pelo que eu entendi vocк quer em comando.

no topo do GM:
pawn Код:
#include sscanf
Caso nгo tenha a include baixe ela.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    if(strcmp(cmd,"/chatg",true) == 0)
    {
        new texto[125],  // new texto[125]; define que pode ter no maximo 125 letras a mensagem
        stryng[300];
        if(sscanf(cmdtext,"s[7]s",cmd,texto))
        {
            SendClientMessage(playerid,-1,"Use: /chatg [texto]");
            return 1;
        }
        format(stryng,sizeof(stryng),"[Server - Chat] %s: %s", GetPlayerNameEx(playerid),texto);
        SendClientMessageToAll(-1,stryng);
        return 1;
    }
    return 0;
}
No final do gm:
pawn Код:
stock GetPlayerNameEx(playerid)
{
    new PlayerNameLevel[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYER_NAME);
    return PlayerNameLevel;
}
Reply
#5

Uso DCMD..
Reply
#6

pawn Код:
dcmd_chatg(playerid, params[])
{
    new texto[125],
    stryng[300];
    if(sscanf(params,"s",texto))
    {
        SendClientMessage(playerid,-1,"Use: /chatg [texto]");
        return 1;
    }
    format(stryng,sizeof(stryng),"[Server - Chat] %s: %s", GetPlayerNameEx(playerid),texto);
    SendClientMessageToAll(-1,stryng);
    return 1;
}
Se eu consegui te ajuda REP+.
Reply
#7

Caso queria fazer um comando que nгo use barra, mas sim qualquer caractere, use OnPlayerText.

Basta fazer uma verificaзгo se o primeiro caractere й o que vocк deseja, aplicando uma condiзгo.

pawn Код:
// OnPlayerText

if(text[0] == '!')
{
    //dosomething
}
Para obter o texto limpo sem conter o "!" na frente, basta obter do vetor inicial o texto apenas a partir da cйlula 1, usando strmid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)