• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TalkAction [0.3] Guild broadcast

elf

Sing, sing blue silver
Senator
Joined
Dec 11, 2007
Messages
3,666
Solutions
1
Reaction score
125
Location
Warsaw, Poland
GitHub
tayandenga
Twitch
tayandenga
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.
 
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.
 
Was about to make such a script, but why'd I do that if it's already done :eek:

Cheers mate :)
 
Cool, but I think I'll have to wait until 0.3.

Just wondering, which are those functions needed for the script?
 
Ain't you a scripter? You can clearly see in the script which functions are used, huh?
 
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.
 
Back
Top