Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::LUA

Quests::LUA Section regarding LUA scripts, help, questions, answers

Reply
 
Thread Tools Display Modes
  #1  
Old 01-02-2019, 09:09 AM
phate8908
Fire Beetle
 
Join Date: Dec 2018
Posts: 12
Default Anti-MQ2 Reward NPC

credits to poru for the original script wrote in perl

REQUIRES:
MySQL Connect
Client:GetAccountName()

Custom Views .sql (add to you database)
Code:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`127.0.0.1` VIEW `hackers_account` AS SELECT *, COUNT(*) as hack_count FROM hackers WHERE `date` >= now() - INTERVAL 1 DAY and hacked not like "/MQZone%" GROUP BY `account` ORDER BY hack_count DESC;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`127.0.0.1` VIEW `hackers_ip` AS SELECT account_ip.ip, account.name as `account`, hackers.name as `character`, hackers.hacked, hackers.zone, COUNT(*) as hack_count FROM hackers LEFT JOIN (account,account_ip) ON (hackers.account = account.name AND account.id = account_ip.accid) WHERE hackers.`date` >= now() - INTERVAL 1 DAY AND account_ip.lastused >= now() - INTERVAL 1 DAY AND hackers.hacked not like "/MQZone%" GROUP BY account_ip.ip ORDER BY hack_count DESC;
Rewards_Bot.pl (rename to Your_NPC.pl)
Code:
function event_say(e)
	local npcName = e.self:GetCleanName();
	if(e.message:findi("hail")) then
		local hackCheck = 1
		local hackCountAccount = 0
		local hackMessage = ""
		if (hackCheck == 1) then
			local MySQLi = require('MySQLi')
			local connection = MySQLi.Connect()
			local queryhackers_account = string.format("SELECT hack_count FROM hackers_account WHERE account = '%s'",e.other:AccountName())
			connection:query(queryhackers_account)
			result = connection:store_result()
			for v,hack_count in result:rows() do
				hackCountAccount = hack_count
			end
			if (hackCountAccount > 3) then
				hackMessage = string.format("Sorry, %s, your Hack Count is %u for the last 24 hours. I can't reward you until your Hack Count is less than 3. Please check back in an hour or two.",e.other:GetCleanName(),tonumber(hackCountAccount))
			elseif (hackCountAccount > 0) then
				hackMessage = string.format(" By the way, your Hack Count is %u for the last 24 hours, %s. I will be temporarily unable to reward you if your Hack Count becomes greater than 2.",tonumber(hackCountAccount),e.other:GetCleanName())
			end
		end
		if (hackCountAccount <= 2) then
			hackMessage = string.format("I like your style, %s, have a carrot!",e.other:GetCleanName(),hackMessage)
			e.other:SummonItem(1001);
		end
		e.self:Whisper(e.other,hackMessage)
	end
end
Reply With Quote
Reply

Tags
anti, cheat, hack, mq2, quest


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:35 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3