Custom OnPlayerText(for teams)
#1

ive got it set so when you type normal text, it sends to your team, but for some reason, it also sends globally, and I cant understand that because it returns 0 like it should

here is the command

pawn Код:
public OnPlayerText(playerid, text[])
    {
    new message[128];
    format(message, sizeof(message), "[Team Chat] %s {%d}: %s", GetName(playerid), playerid, text);
    foreach (new i : Player)
            {
            if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
                {
                SCM(i, COLYELLOW, message);
                return 1;
                }
            }
    return 0; //should stop the problem, no?
    }
I also get no errors or warnings.
Reply
#2

That:
pawn Код:
SCM(i, COLYELLOW, message);
return 1;
will only send the message for the first player in the sender team and then send it globally, cuz simply adding "return" will break out of the loop and exit the function, returning 1 will make the server broadcast the message, so remove the "return 1" line

also using "return 0" at the end of the function will indeed stop the message from being sent globally
Reply
#3

that worked, thanks mate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)