SA-MP Forums Archive
Join/Quit Messages FAST - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Join/Quit Messages FAST (/showthread.php?tid=126787)



Join/Quit Messages FAST - Seppo1997 - 10.02.2010

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!


Re: Join/Quit Messages FAST - ettans - 10.02.2010

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);
    }
  }
}



Re: Join/Quit Messages FAST - mansonh - 10.02.2010

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.


Re: Join/Quit Messages FAST - Seppo1997 - 10.02.2010

Wont work. The messges still shows for all.


Re: Join/Quit Messages FAST - ettans - 10.02.2010

Remove your own messages and use these.


Re: Join/Quit Messages FAST - mansonh - 10.02.2010

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,


Re: Join/Quit Messages FAST - Seppo1997 - 10.02.2010

I will try and let you know if this works