Skrypty & Kody Problem z transform - je?li gracz si? wyloguje nie zabiera mu hp/mana

Status
Zamknięty.

KiritoWOT

User
Zarejestrowany
Dołączył
Sierpień 22, 2014
Posty
34
Liczba reakcji
1
Witam ot?? mam problem posaidam skrypt na transform oraz revert, skrypt og?lnie jest genialny, bardzo ?adnie wszystko ?miga, ale posiada jedn? bardzo du?? wad?. Kiedy gracz wyloguje sie zostaj? mu hp oraz mana po czym zn?w mo?e si? zalogowa? i zn?w u?y? "transform" i po raz kolejny dodaje mu hp/mane i tak w k??ko. Ma kto? jaki? pomys? by to naprawi? ?
Skrypty:

revert.lua
[LUA]function onCastSpell(cid, var)

for i = 1, #Trans do
if getPlayerVocation(cid) == Trans.newVoc then
if not Trans.constant then
if (getCreatureHealth(cid) > Trans.addHp) and (getCreatureMana(cid) > Trans.addKi) then

doPlayerSetVocation(cid,Trans.voc)
doCreatureChangeOutfit(cid, {lookType=Trans.revertLooktype})
doSendMagicEffect(getCreaturePosition(cid), 6)
doPlayerSendCancel(cid,"You have reverted.")

setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - Trans.addHp)
setCreatureMaxMana(cid, getCreatureMaxMana(cid) - Trans.addKi)
doCreatureAddHealth(cid, -Trans.addHp, false)
doCreatureAddMana(cid, -Trans.addKi, false)
return true
else
doPlayerSendCancel(cid, "You do not have enough health or ki.")
doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end
else
--doPlayerSendCancel(cid, "You cannot revert.")
--doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end
end
end

doPlayerSendCancel(cid, "You cannot revert.")
doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end[/LUA]

transform.lua
[LUA]function onCastSpell(cid, var)

for i = 1, #Trans do
if getPlayerVocation(cid) == Trans.voc then
if getPlayerLevel(cid) >= Trans.level then
if getPlayerSoul(cid) >= Trans.rage then
if getPlayerMana(cid) >= Trans.kiToTrans then
if(Trans.constant) then
doCreatureChangeOutfit(cid, {lookType=Trans.looktype})
else
doSetCreatureOutfit(cid, {lookType=Trans.looktype}, -1)
end
--doPlayerAddSoul(cid, -Trans.rage)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + Trans.addHp)
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + Trans.addKi)
doCreatureAddHealth(cid, Trans.addHp)
doCreatureAddMana(cid, Trans.addKi)

doSendMagicEffect(getCreaturePosition(cid), Trans.effectOn)
doPlayerSendCancel(cid,"You have transformed.")
doPlayerSetVocation(cid,Trans.newVoc)

return true
else
doPlayerSendCancel(cid, "You need " .. Trans.kiToTrans .. " KI to transform!")
doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end
else
doPlayerSendCancel(cid, "You need " .. Trans.rage .. " rage to transform!")
doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end
else
doPlayerSendCancel(cid, "You need " .. Trans.level .. " level to transform!")
doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end
end
end

doPlayerSendCancel(cid, "You cannot transform.")
doSendMagicEffect(getCreaturePosition(cid), 2)
return true
end[/LUA]

oraz linijki w lib\000-constant.lua
[LUA]Trans = {
{["voc"] = 1, ["newVoc"] = 2, ["looktype"] = 3, ["revertLooktype"] = 2, ["level"] = 30, ["rage"] = 0, ["kiToTrans"] = 10, ["addHp"] = 300, ["addKi"] = 200, ["effectOn"] = 3, ["chakraCost"] = 0, ["piorunki"] = 0, ["constant"] = false},
{["voc"] = 2, ["newVoc"] = 3, ["looktype"] = 4, ["revertLooktype"] = 3, ["level"] = 70, ["rage"] = 0, ["kiToTrans"] = 10, ["addHp"] = 300, ["addKi"] = 200, ["effectOn"] = 3, ["chakraCost"] = 0, ["piorunki"] = 0, ["constant"] = false},
{["voc"] = 3, ["newVoc"] = 4, ["looktype"] = 5, ["revertLooktype"] = 4, ["level"] = 120, ["rage"] = 0, ["kiToTrans"] = 10, ["addHp"] = 300, ["addKi"] = 200, ["effectOn"] = 3, ["chakraCost"] = 0, ["piorunki"] = 0, ["constant"] = false},
{["voc"] = 4, ["newVoc"] = 5, ["looktype"] = 6, ["revertLooktype"] = 6, ["level"] = 220, ["rage"] = 0, ["kiToTrans"] = 10, ["addHp"] = 300, ["addKi"] = 200, ["effectOn"] = 3, ["chakraCost"] = 0, ["piorunki"] = 0, ["constant"] = true}
}[/LUA]
constant - true = sta?y, false = tymczasowy
addKi = addMana
Funkcje takie jak "piorunki" s? nie istotne wi?c nie b?d? t?umaczy? co robi? :)
Bardzo prosz? o pomoc, pozdrawiam :)

TFS 0.3.6pl1 - ver. 8.54
 
Odp: Problem z transform - je?li gracz si? wyloguje nie zabiera mu hp/mana

Trzeba storage dac
Na poczatek dodaj:
[LUA]if getPlayerStorageValue(cid, 23575) == -1 then
return true
end[/LUA]

I tam gdzies, gdzie daje mane itp
[LUA]setPlayerStorageValue(cid, 23575, 1)[/LUA]
 
Odp: Problem z transform - je?li gracz si? wyloguje nie zabiera mu hp/mana

Dodaj sobie do creaturescripts
[LUA]local transform = {

[1] = {180, 35},-- voc, hp, mana
}

function onLogout(cid)
local Player = transform[getPlayerVocation(cid)]
if (Player == nil) then
return true
end

setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-Player[1])
doCreatureAddHealth(cid, -Player[1])
setCreatureMaxMana(cid, getCreatureMaxMana(cid)-Player[2])
doCreatureAddMana(cid, -Player[2])
return true
end[/LUA]
 
Odp: Problem z transform - je?li gracz si? wyloguje nie zabiera mu hp/mana

[MENTION=390032]Restles[/MENTION] nie dzia?a mi to :(

#edit
Jednak dzia?a :) po prostu pomyli?em funkcj? i zamiast "logout" ustawi?em "login". Wielkie dzi?ki stary leci rep + :)
 
Ostatnia edycja:
Status
Zamknięty.
Back
Do góry