• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction !getplayerinfo

Darad

New Member
Joined
Jun 23, 2009
Messages
119
Reaction score
1
!getplayerinfo paladu~

16:00 Paladude [3458] is a paladin and Paladude has a red skull

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Get player info" version="1.0" author="Darad @ Babylon" enabled="yes">
	<config name="gpi_config"><![CDATA[
		config = {
			vocations = {
				[1] = 'sorcerer',
				[2] = 'druid',
				[3] = 'paladin',
				[4] = 'knight',
				[5] = 'master sorcerer',
				[6] = 'elder druid',
				[7] = 'royal paladin',
				[8] = 'elite knight'
			},
			s = {
				1,3,4,5
			},
			skulls = {
				[1] = 'yellow skull',
				[3] = 'white skull',
				[4] = 'red skull',
				[5] = 'black skull'
			}
				
		}
	]]></config>
	<talkaction words="!getplayerinfo" event="script"><![CDATA[
		domodlib('gpi_config')

		local p = getPlayerByNameWildcard(param)
		if (not p) then
			-- Can't this be solved in another way?! if (p) then does not work :(
		else
			if isPlayer(p) and getPlayerAccess(p) < 3 then
				local name = getPlayerName(p)
				local level = getPlayerLevel(p)
				local voc = getPlayerVocation(p)

				local skullmsg = ''
				local skulltype = getCreatureSkullType(p)
				if isInArray(config.s, skulltype) then
					skullmsg = " and " .. name .. " has a " .. config.skulls[skulltype]
				end
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, name .. " [" .. level .. "] is a " .. config.vocations[voc] .. skullmsg)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
				
				return true
			end
		end
		
		doPlayerSendCancel(cid, 'A player with this name is not online.')
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		
		return true
	]]></talkaction>
</mod>
 
Last edited:
Code:
local skulls = {"None", "Yellow", "White", "Red", "Black"}
local skull = skulls[getCreatureSkullType(p)]

local voc = getVocationInfo(getPlayerVocation(p))

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getCreatureName(p) .. " [" .. getPlayerLevel(p) .. "] is a " .. voc.name .. ", skull type: ".. skull)
 
How about I don't wanna say skull_type: none? ;\
 
Code:
local skulls = {"Yellow", "White", "Red", "Black"}
local skull = skulls[getCreatureSkullType(p)] or nil
if (skull ~= nil) then
	skullMsg = ", skull type: ".. skull
end

local voc = getVocationInfo(getPlayerVocation(p))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getCreatureName(p) .. " [" .. getPlayerLevel(p) .. "] is a " .. voc.name .. " .. skullMsg)
 
What are these "mod" for anyways? I really don't get it...
 
You take the code put it in an xml file in the mod folder. It's easier for scripting and using them will give you a better overview over your code.
 
You take the code put it in an xml file in the mod folder. It's easier for scripting and using them will give you a better overview over your code.

It's not easier to scripting 'cause all is in one file and i got a brainfuck! It's easiest way for noobs who don't know how to install script x/
 
Yes tfs, might work for other servers though if you take the code and place it the old way.

@Chojrak
Learn to organize your code then ;)
 
Yes tfs, might work for other servers though if you take the code and place it the old way.

@Chojrak
Learn to organize your code then ;)

But when my code is organized, then it's still all in one file i don't like to have Movements, Creaturescripts, Actions, Talkactions in 1 place ^.-
 
You can seperate that and have the config shared over the seperate mods. First I didn't like mods at all, but when I took a closer look I found they're actually great. Not 10 files to create 1 thing.
 
But what's the problem? I don't like, and it's my opinion about MOD's =S
 
did not like the fact that it has withdrawn many essential and only put about skulltype.

I prefer to use what comes with TFS and just put it to verify the skull that the player is.
 
Lua:
		if (not p) then
			-- Can't this be solved in another way?! if (p) then does not work :(
		else

Maybe
Lua:
		if (not p) then
			return false
		else
 
Back
Top