• 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!

Simple Function Head Question

Scarlet Ayleid

Advanced OT User
Senator
Joined
Jul 7, 2007
Messages
4,049
Reaction score
238
THIS IS RESOLVED =D

Hey

Its been a while since I last worked with LUA so forgive my ignorance :p

I want to make a function that unless written, it takes a default value, like this:

PHP:
function getPlayerVocationName(cid,short)
	if isSorcerer(cid) then
		if short then
			return "SRC"
		else
			return "Sorcerer"
		end
	elseif isDruid(cid) then
		if short then
			return "DRD"
		else
			return "Druid"
		end
	elseif isPaladin(cid) then
		if short then
			return "PLD"
		else
			return "Paladin"
		end
	elseif isKnight(cid) then
		if short then
			return "KNT"
		else
			return "Knight"
		end
	else
		if short then
			return "NUB"
		else
			return "No Vocation"
		end
	end
end
I know this script is almost useless, its just to demonstrate what I want to ask :p

In this case, I'd like the var short to always take the value false unless I said true when using it

Player is Sorcerer
getPlayerVocationName(cid) - short = false
...return "Sorcerer"

getPlayerVocationName(cid,true) - short = true
...return "SRC"

Hope I made my question clear :)

Thanks in Advance
Quetzalma
 
Last edited:
Back
Top