Jako, ?e Rahim'a na tym ju? nie przebywa, a liczba temat?w na temat tranform nie maleje wychodz? z inicjatyw? do u?ytkownik?w. Jest to prosty skrypt transform z konfiguracj? dla wielu profesji itd
U?ytkownik?w interesuje ta cz???
Tutaj zawarte jest konfiguracja, ja wrzuci?em przyk?adow?. Teraz t?umacz? jak to dzia?a:
Je?eli macie jakie? pomys? do ulepszenia skryptu lub dodania czego? ciekawego do niego, piszcie, komentujcie na pewno dodam.
Kod:
local configs =
{
[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22, addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}
function onSay(cid, words, param)
local informations = {voc = getPlayerVocation(cid), outfit = getCreatureOutfit(cid), mana = getCreatureMaxMana(cid), health = getCreatureMaxHealth(cid)}
local config = configs[voc]
if(config ~= nil) then
if(getCreatureMana(cid) >= config.needMana) then
if(getPlayerLevel(cid) >= config.needLevel) then
setPlayerVocation(cid, config.transformVocation)
setCreatureMaxMana(cid, config.addMaxMana)
setCreatureMaxHealth(cid, config.addMaxHealth)
setCreatureOutfit(cid, config.newOutfit)
doCreatureAddMana(cid, -config.needMana)
sendEventEffect(cid, config.transEffect, config.removingMana, config.transformVocation, informations, config.delay)
return true
end
end
end
doPlayerSendTextMessage(cid, 22 ,"You cannot transform")
return true
end
function sendEventEffect(cid, effect, removeMana, voc, informations, delay)
if(getPlayerVocation(cid) == voc) then
if(getCreatureMana(cid) >= removeMana) then
doSendMagicEffect(getPlayerPosition(cid), effect)
doCreatureAddMana(cid, -removeMana)
addEvent(sendEventEffect, 1000 * delay, {cid, effect, removeMana, voc, informations, delay})
else
setPlayerVocation(cid, informations.voc)
setCreatureMaxMana(cid, informations.mana)
setCreatureMaxHealth(cid, informations.health)
setCreatureOutfit(cid, informations.outfit)
end
end
return true
end
U?ytkownik?w interesuje ta cz???
Kod:
local configs =
{
[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22, addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}
Tutaj zawarte jest konfiguracja, ja wrzuci?em przyk?adow?. Teraz t?umacz? jak to dzia?a:
Kod:
[1] - Mi?dzy nawiasami wpisujemy numery profesji jaka mo?e transformowa?
needMana - to warto?? many jak? potrzebujemy na transformacj?
needLevel - to level jaki potrzebujemy
transformVocation - numer profesji w jak? tranformuje
newOutfit - jest to nowy wygl?d, wype?niamy warto?ci mi?dzy klamrami
transEffect - efekt jaki b?dzie na postaci
addMaxMana - ile ma dodawa? maksymalnej many po transie
addMaxHealth - ile ma dodawa? maksymalnego ?ycia po transie
effectDelay - czas mi?dzy pokazywaniem efektu i zabieraniem many
removingMana -ile many po by? zabieranem podczas transu
Kod:
[1] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22, addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}
[2] = {needMana = 1, needLevel = 1, transformVocation = 2, newOutfit = {lookType = 59, lookTypeEx = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, transEffect = 22, addMaxMana = 1, addMaxHealth = 1, effectDelay = 5, removingMana = 1}
}
Je?eli macie jakie? pomys? do ulepszenia skryptu lub dodania czego? ciekawego do niego, piszcie, komentujcie na pewno dodam.


wtedy spradzi czy cos w configu jest tzn jak tak to return true a jak nie to nic