Log in

View Full Version : Requesting Pm script when attacked by player!



undead mage
12-09-2015, 08:05 PM
Like it says in the title can someone please make a script that messages character X when im getting attacked by a player.
If it's possible it would be great if I could make my own message that it sends to character X and also if possible to send it to multiple characters without spamming of course so I wont get muted. Thanks in advance!

undead mage
12-10-2015, 07:10 PM
Syntax shadowart anoyn Joshwa534 Aristeus jo3bingham

undead mage
12-12-2015, 02:21 AM
Bumpp anyone?

anoyn
12-12-2015, 04:24 AM
--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)

Elvang
12-12-2015, 05:15 AM
Like it says in the title can someone please make a script that messages character X when im getting attacked by a player.
If it's possible it would be great if I could make my own message that it sends to character X and also if possible to send it to multiple characters without spamming of course so I wont get muted. Thanks in advance!

http://forums.xenobot.net/showthread.php?39301-shAdOwArt-s-Lua-Scripts&p=460853&posted=1#post460853

undead mage
12-13-2015, 12:56 AM
--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)

Thx anoyn I will test it out tomorrow but I don't get how you're getting the pk's name


http://forums.xenobot.net/showthread.php?39301-shAdOwArt-s-Lua-Scripts&p=460853&posted=1#post460853
Elvang ?:P

Elvang
12-13-2015, 01:55 AM
Thx anoyn I will test it out tomorrow but I don't get how you're getting the pk's name


Elvang ?:P

Yeah I didn't notice the PM part.