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

Ilość hp/many dla nowego gracza

Sorbal

Member
Joined
Jul 23, 2010
Messages
406
Reaction score
11
Location
Poland
Witajcie, może mi ktoś powiedzieć gdzie ustawię ilość hp/many dla każdej nowo założonej postaci? Używam ModernAcc więc serwer nie posiada sample'ów. Pozdrawiam :$
 
W ostateczności prosty skrypt, który ustawi hp/mane na pierwsze logowanie.
LUA:
local config = 
{
	storage = 10000,
	-- [vocationId] = {health = health points, mana = mana points}
	[0] = {health = 0, mana = 0}
}

function onLogin(cid)
	if (getCreatureStorage(cid, config.storage) < 0) then
		-- health
		setCreatureMaxHealth(cid, config[getPlayerVocation(cid)].health)
		doCreatureAddHealth(cid, config[getPlayerVocation(cid)].health)
		
		-- mana
		setCreatureMaxMana(cid, config[getPlayerVocation(cid)].mana)
		doCreatureAddMana(cid, config[getPlayerVocation(cid)].mana)
		
		doCreatureSetStorage(cid, config.storage, 1)
	end

	return true
end
 
Problem rozwiązany, pomieszałem w bazie danych i już wszystko śmiga. Dzięki za odpowiedzi, pozdrawiam :$
 
LUA:
local config = 
{
	storage = 10000,
	-- [vocationId] = {health = health points, mana = mana points}
	[0] = {health = 0, mana = 0}
}

function onLogin(cid)
	if (getCreatureStorage(cid, config.storage) < 0) then
		-- health
		setCreatureMaxHealth(cid, config[getPlayerVocation(cid)].health)
		doCreatureAddHealth(cid, config[getPlayerVocation(cid)].health)
		
		-- mana
		setCreatureMaxMana(cid, config[getPlayerVocation(cid)].mana)
		doCreatureAddMana(cid, config[getPlayerVocation(cid)].mana)
		
		doCreatureSetStorage(cid, config.storage, 1)
	end

	return true
end

po co się bawić w storage value, dodatkowe rekordy do bazy i po chuju...

lepiej już sprawdzać czy już postać się logowała (last login), jeśli nie, to wtedy ustawi max health i mane, a tak to nie :D
 
po co się bawić w storage value, dodatkowe rekordy do bazy i po chuju...
Od tego są aby je używać - ale masz rację, wolno tutaj użyć lastlogin.
 
Back
Top