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

A script that changes the player's ID Group after use

Asheex

New Member
Joined
Nov 4, 2016
Messages
31
Reaction score
0
Hello,

I need a script that will change the player ID group after using the item. For example, after using an item with ID 1750 ID, the group from the player will change to Tutor. So from Group 1 to 2


I need a script that will change player group 1 to tutor group 2 Automatically:

<group id="1" name="Player"/>
<group id="2" name="Tutor" flags="16809984" customFlags="2" access="1" violationReasons="4" nameViolationFlags="2"/>
<group id="3" name="Senior Tutor" flags="68736352256" customFlags="14" access="2" violationReasons="10" nameViolationFlags="2" statementViolationFlags="63" maxVips="200" outfit="73" />



Thank you for help :)

Sorry for my imperfect English.
 
This should work:
data/actions/scripts/tutor.lua
LUA:
local groups = {
    [2641] = {group = ACCOUNT_TYPE_TUTOR, message = "You have been granted the position of Tutor!"},
    [2642] = {group = ACCOUNT_TYPE_SENIORTUTOR, message = "You have been granted the position of Senior Tutor!"}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local it, group, msg = groups[item.itemid], groups[item.itemid].group, groups[item.itemid].message
    if player and it ~= nil and group then
        local currentGr = player:getAccountType()
        if currentGr < group then
            player:setAccountType(group)
            return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg) and item:remove() and true
        else
            return player:sendCancelMessage("You already have this position, the item has been removed.") and item:remove() and true
        end
    end
    return false
end

data/actions/actions.xml
XML:
<action fromid="2641" toid="2642" script="tutor.lua" />

Change the item ids "2641" and "2642" to the ones you want.
That's for 1.2, will not work for 0.4.
 
Back
Top