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
Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using MySql.Data; using MySql.Data.MySqlClient; using System.Windows.Forms; using Addon; namespace duhhh { public class Class1 : CPlugin { MySqlConnection connection; List<int> connected = new List<int>(); public override void OnPlayerSpawned(ServerClient Client) { foreach (int i in connected) { if (GetClient(i).ClientNum == Client.ClientNum) { ServerSay("Welcome " + Client.Name + " from website!", true); connected.Remove(Client.ClientNum); } } base.OnPlayerSpawned(Client); } public override void OnServerLoad() { 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))); connection.Open(); ServerPrint("MySQL welcome by archit loaded!"); base.OnServerLoad(); } public override void OnPlayerConnect(ServerClient Client) { MySqlCommand command = connection.CreateCommand(); MySqlDataReader Reader; 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); Reader = command.ExecuteReader(); string thisrow = ""; while (Reader.Read()) { for (int i = 0; i < Reader.FieldCount; i++) thisrow += Reader.GetValue(i).ToString(); } if (!string.IsNullOrEmpty(thisrow)) { connected.Add(Client.ClientNum); } Reader.Close(); base.OnPlayerConnect(Client); } } }
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
Code:
using System; using System.Collections.Generic; using MySql.Data.MySqlClient; using Addon; namespace duhhh { public class Class1 : CPlugin { MySqlConnection connection; List<string> connected = new List<string>(); public override void OnPlayerSpawned(ServerClient Client) { foreach (string XUID in connected) { if (XUID == Client.XUID) { ServerSay("Welcome " + Client.Name + " from website!", true); connected.Remove(XUID); } } base.OnPlayerSpawned(Client); } public override void OnServerLoad() { 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))); connection.Open(); ServerPrint("MySQL welcome by archit loaded!"); base.OnServerLoad(); } public override string OnCheckBan(string XUID) { MySqlCommand command = connection.CreateCommand(); MySqlDataReader Reader; command.CommandText = string.Format("select * from {0} WHERE {1} = '{2}'", GetServerCFG("XUID Welcome", "table", string.Empty), GetServerCFG("XUID Welcome", "xuid tab", string.Empty), XUID); Reader = command.ExecuteReader(); string thisrow = ""; while (Reader.Read()) { for (int i = 0; i < Reader.FieldCount; i++) thisrow += Reader.GetValue(i).ToString(); } Reader.Close(); if (!string.IsNullOrEmpty(thisrow)) { connected.Add(XUID); return base.OnCheckBan(XUID); } else { if (GetServerCFG("XUID Welcome", "kick message", null) != null) return GetServerCFG("XUID Welcome", "kick message", null) + " " + XUID; else return null; } } } }
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 6,512 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,606 11-08-2013, 19:13
Last Post: clemi555
  Help Modifying plugin maverigh 5 7,657 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,315 10-19-2013, 06:59
Last Post: iRoNinja
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,663 09-13-2013, 09:31
Last Post: Hallla
  Search Plugin Fluid Killcam N3xT_974 1 3,983 09-10-2013, 20:27
Last Post: Nekochan
  !kill Plugin Hallla 1 3,507 09-07-2013, 22:30
Last Post: axel-le-meilleur
  God Mode Plugin - Everyone has rcon admin srskiller 4 7,845 08-28-2013, 19:03
Last Post: phillipito
  Donator Status Plugin tubwux 1 2,940 08-28-2013, 07:13
Last Post: DidUknowiPwn
  unlock max fps plugin lander 3 4,822 08-20-2013, 15:12
Last Post: Pozzuh

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.