Advertisement
Guest User

Ip on connect

a guest
Jun 14th, 2011
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. //----------- Includes ----------------------------------------------------
  2. #include <a_samp>
  3. //----------- Defines ----------------------------------------------------
  4. #define COLOR_WHITE 0xFFFFFFA0
  5.  
  6. //------------------------------------------------------------------------------
  7. public OnFilterScriptInit()
  8. {
  9. print("\nFilterscript loaded by BoBiTza\n");
  10. return true;
  11. }
  12.  
  13. public OnFilterScriptExit()
  14. {
  15. return true;
  16. }
  17.  
  18. public OnPlayerConnect(playerid)
  19. {
  20. new pName[ MAX_PLAYER_NAME ], string[ 128 ];
  21. new pIP[ 15 ];
  22. GetPlayerName( playerid, pName, sizeof (pName) );
  23. GetPlayerIp ( playerid, pIP, sizeof (pIP) );
  24.  
  25. for ( new i = 0; i < MAX_PLAYERS; i++ )
  26. {
  27. if ( IsPlayerConnected( i ) && playerid != i )
  28. {
  29. if ( IsPlayerAdmin( i ) )
  30. {
  31. format( string, sizeof (string), "*** %s (%d) joined the server. (%s)", pName, playerid, pIP );
  32. SendClientMessage(i, COLOR_WHITE, string );
  33. }
  34. }
  35. }
  36. }
  37.  
  38. public OnPlayerDisconnect(playerid, reason)
  39. {
  40. new pName[MAX_PLAYER_NAME];
  41. new string[128], szReason[16];
  42. GetPlayerName(playerid, pName, sizeof(pName));
  43.  
  44. switch ( reason )
  45. {
  46. case 0:
  47. {
  48. szReason = "Timeout";
  49. }
  50. case 1:
  51. {
  52. szReason = "Leaving";
  53. }
  54. case 2:
  55. {
  56. szReason = "Kicked";
  57. }
  58. }
  59. for(new i = 0; i < MAX_PLAYERS; i++)
  60. {
  61. if (IsPlayerConnected(i) && playerid != i )
  62. {
  63. if (IsPlayerAdmin(i))
  64. {
  65. format(string, sizeof(string), "*** %s left the server. (%s)",pName, szReason );
  66. SendClientMessage(i, COLOR_WHITE, string);
  67. }
  68. }
  69. }
  70. return true;
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement