SendClientMessageToAll
#1

Ok, so when someone logs in, I want to send a message to everyone saying that person logged in. Do I use SendClientMessageToAll? How do I do it?

By the way.. I'm making my first GM, so don't call me a noob : D
Reply
#2

pawn Код:
new
    szDest[128];
GetPlayerName(playerid, szDest, sizeof (szDest));
format(szDest, sizeof (szDest), "** %s logged in", szDest);
SendClientMessageToAll(0x00FF00FF, szDest);
Reply
#3

SendClientMessageToAll(color, message[]);

EDIT:
Too late
Reply
#4

Quote:
Originally Posted by MrDeath
Посмотреть сообщение
pawn Код:
new
    szDest[128];
GetPlayerName(playerid, szDest, sizeof (szDest));
format(szDest, sizeof (szDest), "** %s logged in", szDest);
SendClientMessageToAll(0x00FF00FF, szDest);
In which section do I put this is? OnPlayerConnect?
Reply
#5

https://sampwiki.blast.hk/wiki/Creating_...Leave_Messages
Reply
#6

Quote:
Originally Posted by ZaaRawwR
Посмотреть сообщение
In which section do I put this is? OnPlayerConnect?
On the part where the player login
Reply
#7

in your case at OnPlayerConnect, as I doubt you already have a login system
Reply
#8

Quote:
Originally Posted by Sascha
Посмотреть сообщение
in your case at OnPlayerConnect, as I doubt you already have a login system
What if I do already have one?
Reply
#9

Put it under OnPlayerConnect then try it out, it should work fine.
Also, you can use a similar code for OnPlayerDisconnect, just edit the string.

If you want to say when someone has LOGGED IN, as in, they have entered their password, put the same code, but in the place where the other things happen when a player logs in (in other words, depends on the type of login system you are using and such)
Reply
#10

pawn Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "**%s connected**", name);
    SendClientMessageToAll(0x00FF00FF, string);
    return 1;
}
that should work, just edit the string to say what you want it to say, just remember the %s is the player's name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)