[HELP] HOW ADD A CLAN CHAT
#1

I have a command for CLAN CHAT BUT DON'T WORK:

pawn Код:
if(strcmp(cmd, "/c", true) == 0 || strcmp(cmd, "/clanchat", true) == 0)
    {
    if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/c)lanchat [testo]");
                return 1;
            }
            format(string, sizeof(string), "*** [CLANCHAT] %s *** %s",sendername, result);
            SendClanMessage(playerid, string);
            printf("ClanChat %s: %s", sendername, result);
        }
    return 1;
    }
My clan tag is [DSR]

Please help me
Reply
#2

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(i, name, sizeof(name));
    if(strfind(name,"[DSR]", true) != -1)
    {
        SendClanMessage(i, "...");
    }
}
Loops through all players, checks if any players has the [DSR] tag.
Sends clan message to all players with [DSR] tag.
Reply
#3

Quote:
Originally Posted by [NWA]Hannes
Посмотреть сообщение
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(i, name, sizeof(name));
    if(strfind(name,"[DSR]", true) != -1)
    {
        SendClanMessage(i, "...");
    }
}
Loops through all players, checks if any players has the [DSR] tag.
Sends clan message to all players with [DSR] tag.
don't work

look

pawn Код:
if (strcmp(cmdtext, "/c", true)==0)
    {
    if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/c)lanchat [testo]");
                return 1;
            }
            format(string, sizeof(string), "*** [CLANCHAT] %s *** %s",sendername, result);
            SendClanMessage(playerid, string);
            printf("ClanChat %s: %s", sendername, result);
        }
    return 1;
    }

for(new i=0; i<MAX_PLAYERS; i++)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(i, name, sizeof(name));
    if(strfind(name,"[DSR]", true) != -1)
    {
        SendClanMessage(i, "...");
    }
}
IMG:

/imageshack/img826/1623/samp010v.png

I typing /c lol and dont work look the screen ''...'' is the chat od /c lol
Reply
#4

Do It Like this; Easier and less code;

Anywhere in ur script;
pawn Код:
SendMessageToClan(const str[])
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new playername[MAX_PLAYER_NAME];
            GetPlayerName(i, playername, sizeof(playername));
            if(strfind(playername, "[CLANTAG]", true) == 1){
            {
                SendClientMessage(i, COLOR_WHITE, str);
            }
        }
    }
}
Then use

pawn Код:
format(string, sizeof(string), "Message");
SendMessageToClan(string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)