Odp: Sample
Hmmm... ten skrypt nie dzia?a nawet
a je?eli chodzi o ca?y login i logout to ...
Login.lua :
local VOCATION_STORAGE = 10000
function onLogin(cid)
if(getPlayerStorageValue(cid, VOCATION_STORAGE) > 0) then
doPlayerSetVocation(cid, getPlayerStorageValue(cid, VOCATION_STORAGE))
setPlayerStorageValue(cid, VOCATION_STORAGE, 0)
end
return TRUE
end
logout.lua :
function onLogout(cid)
if (getPlayerVocation(cid) == 1) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 300)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 300)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 1)
elseif (getPlayerVocation(cid) == 2) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 250)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 250)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 2)
elseif (getPlayerVocation(cid) == 3) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 200)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 200)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 3)
elseif (getPlayerVocation(cid) == 4) then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - 250)
setCreatureMaxMana(cid, getPlayerMaxMana(cid) - 250)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 4)
elseif (getPlayerVocation(cid) == 11) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid))
doPlayerSetVocation(cid, 11)
elseif (getPlayerVocation(cid) == 11)
or (getPlayerVocation(cid) == 1)
or (getPlayerVocation(cid) == 2)
or (getPlayerVocation(cid) == 3)
or (getPlayerVocation(cid) == 4) then
return true
end
end
Hmmm... teraz tak my?l?, ?e mo?e co? z tym logout.lua mo?e jest nie tak ?
Prosz? o pomoc ;P