samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 518
- Solutions
- 3
- Reaction score
- 71
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
LUA:
function onSay(cid, words, param)
if getPlayerGroupId(cid) < 6 then
doPlayerSendCancel(cid, "Você não tem permissão para usar este comando.")
return false
end
if param == "" then
doPlayerSendCancel(cid, "Uso: !banhd <nome do jogador>")
return false
end
local target = getPlayerByName(param)
if not target then
doPlayerSendCancel(cid, "Jogador não encontrado.")
return false
end
local hdId = getPlayerHardwareId(target) -- Essa função precisa estar implementada
if not hdId or hdId == 0 then
doPlayerSendCancel(cid, "Não foi possível obter o Hardware ID do jogador.")
return false
end
local query = string.format("INSERT INTO banned_hd (hardware_id, banned_by, ban_time) VALUES (%d, %d, %d);", hdId, getPlayerGUID(cid), os.time())
if db.executeQuery(query) then
doRemoveCreature(target)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Jogador banido pelo Hardware ID com sucesso.")
else
doPlayerSendCancel(cid, "Erro ao banir o jogador.")
end
return true
end
Code:
CREATE TABLE IF NOT EXISTS `banned_hd` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`hardware_id` BIGINT NOT NULL,
`banned_by` INT NOT NULL,
`ban_time` INT NOT NULL
);
Code:
function onLogin(cid)
local hdId = getPlayerHardwareId(cid) -- Precisa da função implementada
if hdId then
local result = db.storeQuery(string.format("SELECT 1 FROM banned_hd WHERE hardware_id = %d;", hdId))
if result then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você está banido deste servidor.")
return false
end
end
return true
end