TalkAction [0.3] Guild broadcast

elf

Sing, sing blue silver
Joined
Dec 11, 2007
Messages
3,665
Best answers
1
Reaction score
116
Location
Cracow, Poland
1. data/talkactions/scripts create file guildcast.lua and put to it:
Code:
function onSay(cid, words, param)
	local playerGuild = getPlayerGuildId(cid)
	if playerGuild > 0 then
		local playerGuildLevel = getPlayerGuildLevel(cid)
		if playerGuildLevel >= GUILDLEVEL_VICE then
			local players = getOnlinePlayers()
			local message = "*Guild* " .. getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]:\n" .. param;
			for i,playerName in ipairs(players) do
				local player = getPlayerByName(playerName);
				if getPlayerGuildId(player) == playerGuild then
					doPlayerSendTextMessage(player, MESSAGE_STATUS_WARNING, message);
				end
			end
			doPlayerSendCancel(cid, "Message sent to whole guild.");
		else
			doPlayerSendCancel(cid, "You have to be at least Vice-Leader to guildcast!");
		end
	else
		doPlayerSendCancel(cid, "Sorry, you're not in a guild.");
	end
	doPlayerSendTextMessage(cid, 25, words)
	return FALSE
end
Save and close the file.
2. Open data/talkactions/talkactions.xml and add:
Code:
<talkaction filter="word" words="/bg" script="guildcast.lua"/>
Usage: /bg i r bab00n! sends to all guild members a message in red.
 

zniC

o hio
Joined
Jun 2, 2007
Messages
1,482
Best answers
0
Reaction score
1
Great one, thanks a lot. :)
 

Fare

Well-Known Member
Joined
Apr 3, 2008
Messages
2,386
Best answers
0
Reaction score
92
Location
Ukraine
great work! Elf! Amazing work! thanks!
 

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
The functions required for this script to work doesn't exist in 0.2, that's why it can't be done with 0.2.
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
Was about to make such a script, but why'd I do that if it's already done :eek:

Cheers mate :)
 

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
8
Location
Mexico
Cool, but I think I'll have to wait until 0.3.

Just wondering, which are those functions needed for the script?
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
Ain't you a scripter? You can clearly see in the script which functions are used, huh?
 

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
8
Location
Mexico
Calm down, I didn't know which function wasn't on TFS 0.2
I thought getPlayerGuildLevel was already in 0.2, but I just saw that it was recently released in the latest patch.
 

tae

Active Member
Joined
Oct 7, 2007
Messages
1,284
Best answers
0
Reaction score
29
Location
Trap Block
why does it show what i said when i said /bg?
 

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
8
Location
Mexico
@tae:
Change return FALSE for return TRUE
 

tae

Active Member
Joined
Oct 7, 2007
Messages
1,284
Best answers
0
Reaction score
29
Location
Trap Block
why does it show a green text when i say it now? lol
 
Top