• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Request] register plugin
#11
(09-18-2012, 19:25)OzonE Wrote:
Code:
WebClient wc = new WebClient();
                string download = wc.DownloadString("http://yourhost.com/RegisteredXUIDs.txt");
                string[] downloads = download.Split(',');

        OnCheckBan()
   if downloads does not  Contain Client.XUID
   dropclient client.name

Maybe?

Thank you but i must add all xuid to txt files i want the plugin check my data base automaticaly.

In pesian:

dastet talla dadash mamnomn vali in oni nist ke man mikham intori vasam sakhte yekari kon ke be data base vasl beshe az to data base bekhob dagifan mesle hamoni ke to poste aval dadam.

mer30
  Reply
#12
Compile this
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using MySql.Data;
  6. using MySql.Data.MySqlClient;
  7. using System.Windows.Forms;
  8. using Addon;
  9.  
  10. namespace duhhh
  11. {
  12. public class Class1 : CPlugin
  13. {
  14. MySqlConnection connection;
  15.  
  16. List<int> connected = new List<int>();
  17. public override void OnPlayerSpawned(ServerClient Client)
  18. {
  19. foreach (int i in connected)
  20. {
  21. if (GetClient(i).ClientNum == Client.ClientNum)
  22. {
  23. ServerSay("Welcome " + Client.Name + " from website!", true);
  24. connected.Remove(Client.ClientNum);
  25. }
  26. }
  27. base.OnPlayerSpawned(Client);
  28. }
  29. public override void OnServerLoad()
  30. {
  31. connection = new MySqlConnection(string.Format("SERVER={0};DATABASE={1};UID={2};PASSWORD={3};", GetServerCFG("XUID Welcome", "SERVER", string.Empty), GetServerCFG("XUID Welcome", "DB", string.Empty), GetServerCFG("XUID Welcome", "USER", string.Empty), GetServerCFG("XUID Welcome", "PASSWORD", string.Empty)));
  32. connection.Open();
  33. ServerPrint("MySQL welcome by archit loaded!");
  34. base.OnServerLoad();
  35. }
  36. public override void OnPlayerConnect(ServerClient Client)
  37. {
  38. MySqlCommand command = connection.CreateCommand();
  39. MySqlDataReader Reader;
  40. command.CommandText = string.Format("select * from {0} WHERE {1} = '{2}'", GetServerCFG("XUID Welcome", "table", string.Empty), GetServerCFG("XUID Welcome", "xuid tab", string.Empty), Client.XUID);
  41. Reader = command.ExecuteReader();
  42. string thisrow = "";
  43. while (Reader.Read())
  44. {
  45. for (int i = 0; i < Reader.FieldCount; i++)
  46. thisrow += Reader.GetValue(i).ToString();
  47. }
  48. if (!string.IsNullOrEmpty(thisrow))
  49. {
  50. connected.Add(Client.ClientNum);
  51. }
  52. Reader.Close();
  53.  
  54. base.OnPlayerConnect(Client);
  55. }
  56.  
  57. }
  58. }

Add this to sv_config.ini
Code:
[XUID Welcome]
SERVER=localhost
//server of mysql
DB=b3_mw3
//databse name
USER=test1
//user
PASSWORD=test1
//password
table=clients
//table containing xuid
xuid tab=guid
//the whatever it is called containing xuids
  Reply
#13
Thank you very much.

in compile i have this error:

Error 1 'duhhh.Class1.OnPlayerSpawned(Addon.ServerClient)': no suitable method found to override C:\Visual Studio 2008\Projects\register\register\Class1.cs 16 30 register



by using last version its solved
  Reply
#14
Thanks

and is it possible to add a code for:

when player xuid not matched or not exist in data base them the player kicked and after kicked this message shown to him:

message : your xuid not exist in our database pleas register in my-site then save your xuid -- "playexuid" -- in your profile.

as you know in mw3 its not easy for everyone to find his XUID so after the player kicked if the xuid showed to him in message then players can save his XUID with easy way .


thank you.
  Reply
#15
Done
CHSARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using MySql.Data.MySqlClient;
  4. using Addon;
  5.  
  6. namespace duhhh
  7. {
  8. public class Class1 : CPlugin
  9. {
  10. MySqlConnection connection;
  11.  
  12. List<string> connected = new List<string>();
  13. public override void OnPlayerSpawned(ServerClient Client)
  14. {
  15. foreach (string XUID in connected)
  16. {
  17. if (XUID == Client.XUID)
  18. {
  19. ServerSay("Welcome " + Client.Name + " from website!", true);
  20. connected.Remove(XUID);
  21. }
  22. }
  23. base.OnPlayerSpawned(Client);
  24. }
  25. public override void OnServerLoad()
  26. {
  27. connection = new MySqlConnection(string.Format("SERVER={0};DATABASE={1};UID={2};PASSWORD={3};", GetServerCFG("XUID Welcome", "SERVER", string.Empty), GetServerCFG("XUID Welcome", "DB", string.Empty), GetServerCFG("XUID Welcome", "USER", string.Empty), GetServerCFG("XUID Welcome", "PASSWORD", string.Empty)));
  28. connection.Open();
  29. ServerPrint("MySQL welcome by archit loaded!");
  30. base.OnServerLoad();
  31. }
  32. public override string OnCheckBan(string XUID)
  33. {
  34. MySqlCommand command = connection.CreateCommand();
  35. MySqlDataReader Reader;
  36. command.CommandText = string.Format("select * from {0} WHERE {1} = '{2}'", GetServerCFG("XUID Welcome", "table", string.Empty), GetServerCFG("XUID Welcome", "xuid tab", string.Empty), XUID);
  37. Reader = command.ExecuteReader();
  38. string thisrow = "";
  39. while (Reader.Read())
  40. {
  41. for (int i = 0; i < Reader.FieldCount; i++)
  42. thisrow += Reader.GetValue(i).ToString();
  43. }
  44. Reader.Close();
  45. if (!string.IsNullOrEmpty(thisrow))
  46. {
  47. connected.Add(XUID);
  48. return base.OnCheckBan(XUID);
  49. }
  50. else
  51. {
  52. if (GetServerCFG("XUID Welcome", "kick message", null) != null)
  53. return GetServerCFG("XUID Welcome", "kick message", null) + " " + XUID;
  54. else
  55. return null;
  56. }
  57. }
  58.  
  59. }
  60. }

UNTESTED and also add this to sv_config section of XUID Welcome
Code:
kick message = add xuid to website
//change this message according to what you want XUID will be included at end
  Reply
#16
Thank you your plugin is work perfectly .
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 3,885 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 4,342 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 38,161 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 5,245 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 4,604 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 57,441 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 17,344 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 2,524 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 30,302 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 2,840 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread: 1 Guest(s)