Text does not send message
#1

I tried to make a few 'group' chats and only sometimes does it work
pawn Код:
if(text[0] == '#' && UGPlayer[playerid] == 1)
    {
        if(muted[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_RED, "ERROR: You are muted.");
            return 0;
        }
        else
        {
            new string[128]; GetPlayerName(playerid,string,sizeof(string));
            format(string,sizeof(string),"[UG Chat]%s: %s",string,text[1]);
            SendMessageToUGMembers(COLOR_NEWB,string);
            return 0;
        }
    }
    if(text[0] == '$')
    {
        if(muted[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_RED, "ERROR: You are muted.");
            return 0;
        }
        if(text[1] == 'l' && text[2] == 'o' && text[3] == 'c')
        {
            if(muted[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "ERROR: You are muted.");
                return 0;
            }
            else
            {
                new name[MAX_PLAYERS];
                new zone[MAX_ZONE_NAME], string[256];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
                format(string,sizeof(string),"%s's location is %s.", name, zone);
                SendClientMessageToAll(COLOR_LOC, string);
                print(string);
                return 0;
            }
        }
        if(text[1] == 'p' && text[2] == 'o' && text[3] == 's')
        {
            if(muted[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "ERROR: You are muted.");
                return 0;
            }
            else
            {
                new name[MAX_PLAYERS], string[256];
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,x,y,z);
                GetPlayerName(playerid,name,sizeof(name));
                format(string,sizeof(string),"%s's position is %f, %f, %f.",name,x,y,z);
                SendClientMessageToAll(COLOR_LOC,string);
                return 0;
            }
        }
    }
    if(text[0] == '@' && Admin[playerid] >= 1)
    {
        if(muted[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_RED, "ERROR: You are muted.");
            return 0;
        }
        else
        {
            new string[128]; GetPlayerName(playerid,string,sizeof(string));
            format(string,sizeof(string),"[ADMIN]%s: %s",string,text[1]); SendMessageToAdmins(COLOR_RED,string);
            return 0;
        }
    }
    if(text[0] == '!')
    {
        if(muted[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_RED, "ERROR: You are muted.");
            return 0;
        }
        else
        {
            new string[128]; GetPlayerName(playerid,string,sizeof(string));
            format(string,sizeof(string),"[NEW CHAT]%s: %s",string,text[1]); SendClientMessageToAll(COLOR_NEWB,string);
            return 0;
        }
    }
Neither of them work, only sometimes.
Reply
#2

What do you mean by "doesn't work"? Does it send the chat even if he is muted?
Reply
#3

You're saying that they work sometimes.
Is this sometimes, often or not? :O
Because this text[1] is a little bit strange in the strings xD ^^
text[1] is just one letter I thought? :O
Reply
#4

It is it detects if the first letter is # or @ or $ or ! and then cancels it and sends the message.

and what I mean by it doesnt work is that it like sometimes it willsend in regular chat "#ohai" but "[The Chat][Name]: ohai" not in what i want..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)