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

Vocation tile

KrychaXX

New Member
Joined
Apr 22, 2008
Messages
91
Reaction score
0
Hi all i have thf 0.3.6 and i search script (probably movements) vocation tile, this tile admits only players with vocation id example: 1,2,3,4

For help rep+++ :)
 
so all what you do is puting action id on the tile or anything , and only vocation you typed in script will be allowed to pass.

Lua:
--each aid you add here plz go add in the line in movement.xml 
local tile = {
              --[actionid] = {vocation id}
                
                [7890] = {voca = 1 }, --please make sure the action id isnt used before
	        [7891] = {voca = 2 }
			  }
function onStepIn(cid, item, position, fromPosition)
          local r = tile[item.actionid]
		            if getPlayerVocation(cid) ~= r.voca then
					   doTeleportThing(cid, fromPosition, false)
	                   doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
					   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, only "..getVocationInfo(r.voca).name.."s are allowed.")
					
					end
					
	return true
	end

movement.xml
Code:
<movevent type="StepIn" actionid="7890-7891" event="script" value="xxxx.lua" />
 
Code:
function onStepIn(cid, item, position, fromPosition)
         if isPlayer(cid) and not isKnight(cid) then
             doTeleportThing(cid, fromPosition, FALSE)
         end
return true
end
sumthing
 
correctly modified?

PHP:
local tile = {
              --[actionid] = {vocation id}
               
                [65535] = {voca = 9 },
                [65535] = {voca = 10 },
                [65535] = {voca = 11 },
                [65535] = {voca = 12 }
                          }
function onStepIn(cid, item, position, fromPosition)
          local r = tile[item.actionid]
                            if getPlayerVocation(cid) ~= r.voca then
                                           doTeleportThing(cid, fromPosition, false)
                           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
                                           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wejsc moga tylko "..getVocationInfo(r.voca).name.."s .")
                                       
                                        end
                                       
        return true
        end
 
not correct, this are action id , so you need to make a new action id to each vocation id , and add them in movement.xml so be like that
Lua:
local tile = { 
              --[actionid] = {vocation id} 
                
                [65535] = {voca = 9 }, 
                [65536] = {voca = 10 }, 
                [65537] = {voca = 11 }, 
                [65538] = {voca = 12 } 
                          } 
function onStepIn(cid, item, position, fromPosition) 
          local r = tile[item.actionid] 
                            if getPlayerVocation(cid) ~= r.voca then 
                                           doTeleportThing(cid, fromPosition, false) 
                           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) 
                                           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wejsc moga tylko "..getVocationInfo(r.voca).name.."s .") 
                                        
                                        end 
                                        
        return true 
        end

Code:
<movevent type="StepIn" actionid="65535-65536-65537-65538" event="script" value="xxxx.lua" />
 
Last edited:
try this

Code:
local vocations = {9,10,11,12} --- allowed vocations.
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tpos,v = {x=1,y=1,z=1},getThingPos(cid) -- {x=1,y=1,z=1} is the position you teleport to, don't change getThingPos(cid).
	if isInArray(vocations,getPlayerVocation(cid)) then
		doTeleportThing(cid,tpos)
		doSendMagicEffect(v,10)
	else
		doTeleportThing(cid,fromPosition)
		doPlayerSendTextMessage(cid,27,'You aren\'t the right vocation.')
		doSendMagicEffect(v,2)
	end
	return true
end
 
Back
Top