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

[Request] Change voc with item

Lua:
local t = { --- config
	tovoc = 4 --- what vocation the user will get
	}

function onUse(cid,item,fromPosition,toPosition,itemEx)
local v = getThingPos(cid)
	if getPlayerVocation(cid) ~= 4 then
		doPlayerSetVocation(cid,t.tovoc)
		doPlayerSendTextMessage(cid,20,'Your vocation has changed to '.. getPlayerVocationName(cid)..'.')
		doSendMagicEffect(v,12)
	else
		doPlayerSendTextMessage(cid,20,'You are a '.. getPlayerVocationName(cid)..' already!')
		doSendMagicEffect(v,2)
	end
	return true
end
 
i just changed tihs :p

Code:
local t = { --- config
        tovoc = 4 --- what vocation the user will get
        }

function onUse(cid,item,fromPosition,toPosition,itemEx)
local v = getThingPos(cid)
        if getPlayerVocation(cid) ~= 4 then
                doPlayerSetVocation(cid,t.tovoc)
                doPlayerSendTextMessage(cid,20,'Your vocation has changed to '.. getPlayerVocationName(cid)..'.')
		doBroadcastMessage('Player '.. getPlayerName(cid)..' just chagned vocation to '.. getPlayerVocationName(cid)..'!')
                doSendMagicEffect(v,12)
        else
                doPlayerSendTextMessage(cid,20,'You are already '.. getPlayerVocationName(cid)..'!')
                doSendMagicEffect(v,2)
        end
        return true
end
but is it correct? :p
 
Lua:
local t = { --- config
        tovoc = 4 --- what vocation the user will get
        }

function onUse(cid,item,fromPosition,toPosition,itemEx)
local v = getThingPos(cid)
        if getPlayerVocation(cid) ~= 4 then
                doPlayerSetVocation(cid,t.tovoc)
                doPlayerSendTextMessage(cid,20,'Your vocation has changed to '.. getPlayerVocationName(cid)..'.')
	        doBroadcastMessage('Player '..getPlayerByNameWildcard(cid)..' just changed vocation to '.. getPlayerVocationName(cid)..'!')
                doSendMagicEffect(v,12)
        else
                doPlayerSendTextMessage(cid,20,'You are already '.. getPlayerVocationName(cid)..'!')
                doSendMagicEffect(v,2)
        end
        return true
end
 
Back
Top