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

Lua How to make this script to check vocation?

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hey I've got:

Lua:
--------------------
---- CONDITION -----
--------------------
local wolfCondition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(wolfCondition, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(wolfCondition, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})
--------------------
----- config -------
--------------------
local t = {
    [7443] = {article='a' ,name='wolf', text='Mount, wolf!', dtext='Demount, wolf!', s=100, condition=wolfCondition},
}     
------------------------------------
--- don't change if you are noob ---
------------------------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v, r = getCreaturePosition(cid), t[item.itemid]
    local s = r.s
    local pos = {x = v.x, y = v.y, z = v.z}
    if r then
        if getPlayerStorageValue(cid, s) <= 0 then
            doSendMagicEffect(pos, 10)
            doCreatureSay(cid, r.text, 19)
            setPlayerStorageValue(cid, s, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. r.article .. ' '.. r.name .. '.')
            return doAddCondition(cid, r.condition) 
        elseif getPlayerStorageValue(cid, s) == 1 then
            doSendMagicEffect(pos, 10)
            doCreatureSay(cid, r.dtext, 19)
            setPlayerStorageValue(cid, s, 0)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have demounted ' .. r.article .. ' '.. r.name .. '.')
            return doRemoveCondition(cid, CONDITION_OUTFIT)
        else
            return doPlayerSendCancel(cid, 'You can\'t do this.')
        end
    else
        return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
    end
end

And how to make, that it will the outfit but depending on vocation? For example. Knight will be {lookType = 4, palladin 5 etc
 
Code:
--------------------
---- CONDITION -----
--------------------
local sorcerer = createConditionObject(CONDITION_OUTFIT)
setConditionParam(sorcerer, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(sorcerer, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})

local druid = createConditionObject(CONDITION_OUTFIT)
setConditionParam(druid, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(druid, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})

local paladin = createConditionObject(CONDITION_OUTFIT)
setConditionParam(paladin, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(paladin, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})

local knight = createConditionObject(CONDITION_OUTFIT)
setConditionParam(knight, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(knight, {lookType = 4, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})
--------------------
----- config -------
--------------------
local t = {
    [7443] = {article='a' ,name='wolf', text='Mount, wolf!', dtext='Demount, wolf!', s=100},
}   
------------------------------------
--- don't change if you are noob ---
------------------------------------
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v, r = getCreaturePosition(cid), t[item.itemid]
    local s = r.s
    local pos = {x = v.x, y = v.y, z = v.z}
    if r then
        if getPlayerStorageValue(cid, s) <= 0 then
            doSendMagicEffect(pos, 10)
            doCreatureSay(cid, r.text, 19)
            setPlayerStorageValue(cid, s, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted ' .. r.article .. ' '.. r.name .. '.')
            if isSorcerer(cid) then
                return doAddCondition(cid, sorcerer)
            elseif isDruid(cid) then
                return doAddCondition(cid, druid)
            elseif isPaladin(cid) then
                return doAddCondition(cid, paladin)
            elseif isKnight(cid) then
                return doAddCondition(cid, knight)
            end
        elseif getPlayerStorageValue(cid, s) == 1 then
            doSendMagicEffect(pos, 10)
            doCreatureSay(cid, r.dtext, 19)
            setPlayerStorageValue(cid, s, 0)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have demounted ' .. r.article .. ' '.. r.name .. '.')
            return doRemoveCondition(cid, CONDITION_OUTFIT)
        else
            return doPlayerSendCancel(cid, 'You can\'t do this.')
        end
    else
        return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
    end
end
 
Last edited by a moderator:

Similar threads

Back
Top