• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Nie zapisuje profesji i coś jeszcze

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hail,

Zmieniłem wczoraj silnik na 0.3.5 i mam dwa problemy.

Pierwszy to ten że nie zapisuje mi profesji, tzn dostaje promocje, relog i już jej nie ma.

Uzywam tego skryptu:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVocation(cid) == 1 then
		doPlayerSetVocation(cid, 5)
		doCreatureSay(cid, "You are now a Master Sorcerer!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	elseif getPlayerVocation(cid) == 2 then
		doPlayerSetVocation(cid, 6)
		doCreatureSay(cid, "You are now a Elder Druid!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	elseif getPlayerVocation(cid) == 3 then
		doPlayerSetVocation(cid, 7)
		doCreatureSay(cid, "You are now a Royal Paladin!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	elseif getPlayerVocation(cid) == 4 then
		doPlayerSetVocation(cid, 8)
		doCreatureSay(cid, "You are now a Elite Knight!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	else
		doPlayerSendCancel(cid,"You need to be promoted in order to use this item.")
	end
end

A drugi problem to ten że używam tego skryptu na spell i nie dodaje mlvla.

LUA:
  --[[
        Spell by Shawak
        winter wolf transform
]]--

local time = 120 * 1000        -- 120 * 1000 = 2 min
local addShielding = 50        -- how much shielding should be added


local winter = {lookType = 52, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, time)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, addShielding)
setConditionParam(condition, CONDITION_PARAM_SKILL_MAGICLEVEL, 25)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setCombatCondition(combat, condition)

local speed = createConditionObject(CONDITION_HASTE)
setConditionParam(speed, CONDITION_PARAM_TICKS, time)
setConditionFormula(speed, 0.7, -56, 0.7, -56)
setCombatCondition(combat, speed)

local outfit = createConditionObject(CONDITION_OUTFIT)
setConditionParam(outfit, CONDITION_PARAM_TICKS, time)
addOutfitCondition(outfit, winter.lookTypeEx, winter.lookType, winter.lookHead, winter.lookBody, winter.lookLegs, winter.lookFeet)
setCombatCondition(combat, outfit)

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, 2)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, time)
setCombatCondition(combat, exhaust)

function onCastSpell(cid, var)
        return doCombat(cid, combat, var)
end

Pomóżcie,

Pzdr
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVocation(cid) <= 4 then
		doPlayerSetPromotionLevel(cid, 1)
		doCreatureSay(cid, "You are now a " .. getVocationInfo(getPlayerVocation(cid)).name .. "!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	end
	return true
end
 
Dzięki.

A jak mam taki skrypt npc?

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local side = {}
local config = {
	cost = 25,
	newVoc = {
		[5] = {9, 10}, -- ms
		[6] = {16, 17}, -- ed
		[7] = {11, 13}, -- rp
		[8] = {14, 15} -- ek
	}
}

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if (msgcontains(msg, 'hyper promotion') or msgcontains(msg, 'promotion')) then
		if (getPlayerStorageValue(cid, config.storage) == -1) then
			selfSay("Please choose between {bad} and {good}.", cid)
			talkState[talkUser] = 1
		else
			selfSay("You already got your extra promotion", cid)
		end
	elseif (msgcontains(msg, 'bad') and talkState[talkUser] == 1) then
		talkState[talkUser] = 2
		side[talkUser] = 1
		selfSay("Bad side, Will you pay ".. config.cost .."?", cid)
	elseif (msgcontains(msg, 'good') and talkState[talkUser] == 1) then
		talkState[talkUser] = 2
		side[talkUser] = 2
		selfSay("Good side, Will you pay ".. config.cost .."?", cid)
	elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
		local result = db.getResult("SELECT * FROM `accounts` WHERE `id` = ".. getPlayerAccountId(cid) ..";")
		if (getPlayerPromotionLevel(cid) == 1) then
			if (result:getDataInt("premium_points") >= config.cost) then
				db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` - ".. config.cost .." WHERE `id` = ".. getPlayerAccountId(cid) ..";")	
				doPlayerSetVocation(cid, config.newVoc[getPlayerVocation(cid)][side[talkUser]])
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
				setPlayerStorageValue(cid, config.storage, 1)
				selfSay("You are extra promoted now.", cid)
				table.remove(talkState, talkUser)
				table.remove(side, talkUser)
			else
				selfSay("You don't have enough premium points in SMS Shop.", cid)
				table.remove(talkState, talkUser)
			end
		else
			selfSay("You have to have normal promotion.", cid)
		end
	elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		selfSay("So no...", cid)
		table.remove(talkState, talkUser)
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Bo u niego sie wybiera czy chce się być dobrym czy złym. Rózne profesje.
 
zrób sobie profesje tak by np zła strona była od 9 - 12 a dobra od 13 - 16, wtedy bedziesz mial dla złej setPlayerPromotionLevel(cid, 2) a dla dobrej setPlayerPromotionLevel(cid, 3)
 
Back
Top