#1

I'm creating a settings panel for players, where they can toggle options on/off.

Lemme take an example:

I've added the option to toggle on/off join messages (The ones like Test has joined the server).

Now i have this code which shows join messages to everyone:

pawn Код:
new string[70];
                switch (Player[playerid][AccountLevel])
                {
                    case 0:
                {
                    format(string, sizeof(string), "* %s %s has joined Los Santos Stories.", JobName(playerid), ReturnName(playerid, 0));
                    SCMTA(COLOR_SILVER, string);
                }

                    case 1 .. 5:
                {
                    format(string, sizeof(string), "* %s %s has joined Los Santos Stories. IP: %s", JobName(playerid), ReturnName(playerid, 0), ReturnPlayerIp(playerid));
                    SendMessageToAdmins(string, COLOR_SILVER);
                }

                }
My question is:

How would you edit it to make this message shows just at who have "JoinMsg" setting enabled?

Player[playerid][JoinMsg] = 1; //Enabled, so they can see join message.

In short words, if a player has JoinMsg enabled and someone connects, he will see the connect message, otherwise not.

Tips are appreciated, thanks.
Reply
#2

What are you trying to achieve? I don't get it.

Also, please get out of the habit of defining SCM and SCMTA. It just looks horrible and can show how incompetent you may (emphasis on the may) be as a developer. Take this as constructive criticism rather than 'showing off'.
Reply
#3

No problem, i like constructive criticism.

About the SCM/SCMTA thing, i don't like writing everytime SendClientMessage/SendClientMessageToAll, it's time consuming for me. (I don't like to slow down on anything...).

And creating a macro for sending a message i don't see how this can be horrible, since it's just a shorten way of renaming something.

Everyone has their scripting habits tho.

Returning in topic, what i'm trying to achieve is simple.

Infin1ty types /settings and enables join messages.

Infin1ty2 joins and Infin1ty can see the message "Infin1ty2 has joined the server".

Infin1ty types /settings and disables join messages.

Infin1ty2 joins and Infin1ty can't see the message "Infin1ty2 has joined the server".

Got it?
Reply
#4

Make a loop for online players who has enabled join msg send them the connect message...
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)