MuhammadZeeshan

alias functions

Dec 12th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. else if ( cmd == "ipalias" )
  2. {
  3. if ( status[ player.ID ].Registered == false ) ErrorMessage( "[#FFFFFF]You need to be a part of our community to use this command.", player );
  4. else if ( status[ player.ID ].Logged == false ) ErrorMessage( "[#FFFFFF]You need to be identified to use this command.", player );
  5. else if ( GetLevel( player ) < 5 ) MessagePlayer("[Error] You don't have access to use this Command.", player );
  6. else if ( !text ) ErrorMessage( "Syntax: /" + cmd + " <Nick/ID>", player );
  7. else
  8. {
  9. local plr = GetPlayer( text );
  10. if ( !plr ) ErrorMessage( "Unknown Player.", player );
  11. else ShowAlias( player, plr, "ip" );
  12. }
  13. }
  14.  
  15. else if ( cmd == "subnetalias" )
  16. {
  17. if ( !text ) ErrorMessage( "Syntax: /" + cmd + " <Nick/ID>", player );
  18. else
  19. {
  20. local plr = GetPlayer( text );
  21. if ( !plr ) ErrorMessage( "Unknown Player.", player );
  22. else ShowAlias( player, plr, "subnet" );
  23. }
  24. }
  25.  
  26. else if ( cmd == "uidalias" )
  27. {
  28. if ( !text ) ErrorMessage( "Syntax: /"+ cmd + " <Nick/ID>", player );
  29. else
  30. {
  31. local plr = GetPlayer( text );
  32. if ( !plr ) ErrorMessage( "Unknown Player.", player );
  33. else ShowAlias( player, plr, "uid" );
  34. }
  35. }
  36.  
  37.  
  38. function ShowAlias( player, plr, option )
  39. {
  40. if ( option == "ip" )
  41. {
  42. local i = 0, a = Alias.len(), b;
  43. while( i < a )
  44. {
  45. if ( plr.IP == Alias[i].IP && plr.Name != Alias[i].Nick )
  46. {
  47. if ( b ) b = b + ", " + Alias[i].Nick;
  48. else b = Alias[i].Nick;
  49. }
  50. i ++;
  51. }
  52. if ( !b ) SendMessage( plr.Name + " has no IP alias.", player );
  53. else SendMessage( plr.Name + "'s IP alias: " + b + ".", player );
  54. }
  55. else if ( option == "subnet" )
  56. {
  57. local i = 0, a = Alias.len(), b;
  58. local getsub_1 = split( player.IP, "." ),
  59. sub_1 = getsub_1[0] + getsub_1[1];
  60. while( i < a )
  61. {
  62. local getsub_2 = split( Alias[i].IP, "." ),
  63. sub_2 = getsub_2[0] + getsub_2[1];
  64. if ( sub_1 == sub_2 && plr.Name != Alias[i].Nick )
  65. {
  66. if ( b ) b = b + ", " + Alias[i].Nick;
  67. else b = Alias[i].Nick;
  68. }
  69. i ++;
  70. }
  71. if ( !b ) SendMessage( plr.Name + " has no Subnet alias.", player );
  72. else SendMessage( plr.Name + "'s Subnet alias: " + b + ".", player );
  73. }
  74. else if ( option == "uid" )
  75. {
  76. local i = 0, a = Alias.len(), b;
  77. while( i < a )
  78. {
  79. if ( plr.UniqueID == Alias[i].UID && plr.Name != Alias[i].Nick )
  80. {
  81. if ( b ) b = b + ", " + Alias[i].Nick;
  82. else b = Alias[i].Nick;
  83. }
  84. i ++;
  85. }
  86. if ( !b ) SendMessager( plr.Name + " has no UID alias.", player );
  87. else SendMessage( plr.Name + "'s UID alias: " + b + ".", player );
  88. }
  89. }
Add Comment
Please, Sign In to add comment