Join/Quit Messages FAST
#1

So, how i can make join quit messages only wievable to rcon admins? Like when someone joins the join message only shows for rcon's. Help please!
Reply
#2

Add a loop to OnPlayerConnect and use the same technique at OnPlayerDisconnect.
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i))
  {
    if(IsPlayerAdmin(i))
    {
      format(string,sizeof(string),"%s has joined the server",PlayerName(playerid));
      SendClientMessage(i,COLOR_YELLOW,string);
    }
  }
}
Reply
#3

do a player loop and only send message if player is admin

Code:
public OnPlayerDisconnect(playerid, reason)
{
  new string[64], name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  switch(reason)
  {
    case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
    case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
    case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
  }
  for(new pid=0; pid<GetMaxPlayers(); pid++)
  {
   if(IsPlayerAdmin(pid)) SendClientMessage(pid, 0xFFFFFFAA,string);
  }
  
  return 1;
}
-edit
ettans works too, lol at how many people post so fast.
oh, just noticed that you format the string for each admin? why not do it before the loop.
Reply
#4

Wont work. The messges still shows for all.
Reply
#5

Remove your own messages and use these.
Reply
#6

Yah, you must have reminence of your code somwehere.
Otherwise the only way everyone would be getting the message is if all players were admin,
Reply
#7

I will try and let you know if this works
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)