Log in

View Full Version : If attacked Pm Friends



robin950716
03-08-2016, 08:34 PM
Looking for a script that simply sends a message (if possible)with name of the player(s)attacking me to selected friends.
Or just a random message.
Thank you

anoyn
03-08-2016, 08:58 PM
Change playersToPM and huntingLocation


-- PM when attacked by PK
--Version 1.0
--[[ Made by
___ .__ __. ______ ____ ____ .__ __.
/ \ | \ | | / __ \ \ \ / / | \ | |
/ ^ \ | \| | | | | | \ \/ / | \| |
/ /_\ \ | . ` | | | | | \_ _/ | . ` |
/ _____ \ | |\ | | `--' | | | | |\ |
/__/ \__\ |__| \__| \______/ |__| |__| \__|

]]

--------------------------------------------
--[[ ------------ CONFIG -------------- ]]--
--------------------------------------------
--This is where you say you are in the PM
huntingLocation = "Mt Sternum"

--This is who you will PM
playersToPM = {
"Rage",
"Tim"
}

--These are what you may say
helpMessages = {
"Help im being attacked at " .. huntingLocation .. " by ",
"PK at " .. huntingLocation .. "!!! fast compadre! ",
"PLs men, pk at " .. huntingLocation .. "!?! stronk men is named ",
"Im scurred and cold,,, at " .. huntingLocation .. "! keal the pk known as ",
"PK at " .. huntingLocation .. ". "
}

--------------------------------------------
--[[ ----- Script -- No need to edit ---- ]]
--------------------------------------------
function sendPMs( attacker )
for i = 1, #playersToPM do
local messageToUse = math.random(1,#helpMessages)
Self.PrivateMessage( playersToPM[i], helpMessages[messageToUse] .. attacker )
--Delay to pm more
wait(2300,6000)
end
end

playersAttackedMe = {}
function messageProxyCallback(proxy, message)
--Creature hits say by a
--Player hits say by
--If a player hit us
if( not string.find( message, "by a ") ) then
--get the starting index of their name
start, finish = string.find( message, "by ")
--Split the string at the finish of by_ + 1
local playerName = string.sub(message, finish + 1)
--Get the length of the player message
local stringLength = string.len(playerName)
--Cut the . off the string
playerName = string.sub(playerName, 0, stringLength - 1 )

--Check if i already PM'd about this pk
if( not table.find(playersAttackedMe, playerName, false) ) then
--add pk to attacked me list
playersAttackedMe[#playersAttackedMe+1] = playerName
--Dont instantly pm
wait(3000,4000)
sendPMs( playerName )
end
end

end
BattleMessageProxy.OnReceive("BattleMessageProxy", messageProxyCallback)

krille09
03-08-2016, 09:38 PM
http://forums.xenobot.net/showthread.php?40026-Simple-Private-Message-Leaders!

I guess you can think of what to do...

l4z
03-08-2016, 11:53 PM
nice script anoyn
How to set to msg on guild chat?

anoyn
03-09-2016, 12:49 AM
Talking in guild chat not possible. its been on suggestions for awhile.