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

Gain skill ticks at first login

Triggah

TrigCore
Joined
Aug 1, 2007
Messages
436
Reaction score
2
anyone have an idea for a script that when a player logs in for first time, depending on vocation that player willg et specific skills/ml
 
creatureEvents
login.lua
if(isSorcerer(cid)) then
addplayerskill(cid, magic, 100)

something like that, try the search function and some imagination :)
 
hello triggah
try this script: (by me)
in data/creaturescripts/scripts add a file named gainSkills.lua
and put this inside:
PHP:
local storage = 1234 -- storage id for players.
local config = { -- config for gain skills
	[1]={sword = 0,axe = 0,club = 0,distance = 0,shield = 0,fishing = 0,magiclevel = 10}, -- sorcerers id 1
	[2]={sword = 0,axe = 0,club = 0,distance = 0,shield = 0,fishing = 0,magiclevel = 10}, -- druids id 2
	[3]={sword = 0,axe = 0,club = 0,distance = 40,shield = 40,fishing = 0,magiclevel = 0}, -- paladins id 3
	[4]={sword = 40,axe = 40,club = 40,distance = 0,shield = 40,fishing = 0,magiclevel = 0} -- knights id 4
}

function onLogin(cid)
	if getPlayerStorageValue(cid, storage) < 1 then
		if config[getPlayerVocation(cid)] then
			for i = 1, 7 do
				if config[getPlayerVocation(cid)].i > 0 then then
					if i > 0 and i < 7 then
						for j = 1, config[getPlayerVocation(cid)].i do
							doPlayerAddSkillTry(cid, i, getPlayerRequiredSkillTries(cid, i, getPlayerSkillLevel(cid, i)))
						end
					elseif i == 7 then
						for l = 1, config[getPlayerVocation(cid)].i do
							doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)))
						end
					end
				end
			end
			setPlayerStorageValue(cid, storage, 1)
		end
	end
	return true
end

in data/creaturescripts/creaturescripts.xml add this line:
PHP:
	<event type="login" name="gainSkills" event="script" value="gainSkills.lua"/>

ok???
:)
try this and post here, bye
 
Last edited:
@Up,
You need to register the creature event.

Login.lua
PHP:
registerCreatureEvent(cid, "gainSkills")
 
Back
Top