· 9 years ago · Jan 16, 2017, 02:26 PM
1PASTE IN GENERIC.CS
2
3
4
5[Command("wear")]
6 public void WearCommand(Client sender, string name)
7 {
8 DataRow Clothing = CommonFunctions.GetClothingItem(name);
9 API.setPlayerClothes(sender, Convert.ToInt32(Clothing["slot"]), Convert.ToInt32(Clothing["drawable"]), Convert.ToInt32(Clothing["texture"]));
10 API.sendChatMessageToPlayer(sender, "Clothes applied successfully!");
11 }
12
13
14
15
16
17PASTE IN COMMONFUNCTIONS.CS
18
19
20
21
22
23public static DataRow GetClothingItem(string Clothing)
24 {
25 List<DataRow> Return = new List<DataRow>();
26
27 using (IQueryAdapter Adapter = Database.GetDatabase().getQueryreactor())
28 {
29 Adapter.setQuery("SELECT id FROM clothes WHERE name = @clothing");
30 Adapter.addParameter("clothing", Clothing);
31
32 DataRow Row = Adapter.getRow();
33
34 if (Row != null)
35 return Row;
36 }
37
38 return null;
39 }
40
41
42PUT IN LOGIN METHOD
43
44
45API.setPlayerSkin(sender, "1885233650");
46
47
48
49
50
51
52
53DB IMPORT
54
55
56
57
58CREATE TABLE IF NOT EXISTS `clothes` (
59 `id` int(11) NOT NULL,
60 `name` varchar(255) NOT NULL,
61 `slot` int(11) NOT NULL,
62 `drawable` int(11) NOT NULL,
63 `texture` int(11) NOT NULL
64) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
65
66
67INSERT INTO `clothes` (`id`, `name`, `slot`, `drawable`, `texture`) VALUES
68(1, 'blue_hoodie', 11, 7, 3);
69
70ALTER TABLE `clothes`
71 ADD PRIMARY KEY (`id`);