• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Command Buff + SQL Table.

kusanagy

Respected Member
Hi guys

Here I bring you a simple Script Lua, which works by means of SQL Table.

I hope to help those who need it.



SQL TABLE. INSERT IN AUTH
HTML:
 /*
Navicat MySQL Data Transfer
Source Host     : localhost:3306
Source Database : auth
Target Host     : localhost:3306
Target Database : auth
Date: 1/31/2017 2:51:43 AM
*/
 
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for buff
-- ----------------------------
DROP TABLE IF EXISTS `buff`;
CREATE TABLE `buff` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `entry` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
 
-- ----------------------------
-- Records of buff_vip
-- ----------------------------
INSERT INTO `buff` VALUES ('1', '15366');
INSERT INTO `buff` VALUES ('2', '16609');
INSERT INTO `buff` VALUES ('3', '48162');
INSERT INTO `buff` VALUES ('4', '48074');
INSERT INTO `buff` VALUES ('5', '48170');
INSERT INTO `buff` VALUES ('6', '43223');
INSERT INTO `buff` VALUES ('7', '36880');
INSERT INTO `buff` VALUES ('8', '467');
INSERT INTO `buff` VALUES ('9', '69994');
INSERT INTO `buff` VALUES ('10', '33081');
INSERT INTO `buff` VALUES ('11', '24705');
INSERT INTO `buff` VALUES ('12', '26035');
INSERT INTO `buff` VALUES ('13', '48469');


Lua Script Command = #buff

Code:
-- Designed by EmuServers Dev

local function BuffOnChat(event, player, msg, _, lang)
    if (msg == "#buff") then  -- Use #buff
        local result = AuthDBQuery("SELECT id,Entry FROM buff")
        repeat
        local id = result:GetString(0);
        local Entry = result:GetUInt32(1);
            player:AddAura(Entry, player)      
        until not result:NextRow() 
    player:SendBroadcastMessage("You have buffed, enjoy!")
    end
end
 
RegisterPlayerEvent(18, BuffOnChat)
 
Top