What's new

Talkactions !hp, !mp

Status
Not open for further replies.

DanJ93

ElfBot Helper
Joined
Jan 18, 2009
Messages
2,631
Reaction score
200
Komenda: !hp na ilo??
talkactions.xml
[lua]<talkaction words="!hp;!mp" event="script" value="procentowo.lua"/>[/lua]
procentowo.lua
[lua]function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 2800) <= os.time() then
local kk = os.time()+5
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "HP: " .. getCreatureHealth(cid) .. " / " .. getCreatureMaxHealth(cid) .. " MP: " .. getPlayerMana(cid) .. " / " .. getPlayerMaxMana(cid) .. "")
setPlayerStorageValue(cid, 2800, kk)
else
doPlayerSendCancel(cid, "You are exhausted.")
end
return true
end[/lua]
##################################



Je?li mamy source do swojego silnika HP i MANA w procentach
Komenda: !hp na procenty (tak w razie jak kto? nie ma source)
talkactions.xml
[lua]<talkaction words="!hp;!mp" event="script" value="procentowo.lua"/>[/lua]
procentowo.lua
[lua]function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 2800) <= os.time() then
local hpp = (getCreatureHealth(cid) * 100 / getCreatureMaxHealth(cid))
local mpp = (getPlayerMana(cid) * 100 / getPlayerMaxMana(cid))
local kk = os.time()+5
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "HP: " .. hpp .. "% and " .. mpp .. "%")
setPlayerStorageValue(cid, 2800, kk)
else
doPlayerSendCancel(cid, "You are exhausted.")
end
return true
end[/lua]
 

elo1989

Advanced User
Joined
Feb 12, 2009
Messages
211
Reaction score
6
Odp: !hp, !mp

Witam, a jeste? w stanie przerobi? ten kod:
[XML]<talkaction words="!exp;!mana" event="buffer">
<![CDATA[
local t = 1
if(words:sub(2, 2) == "e") then
t = 2
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. (t == 2 and (getExperienceForLevel(getPlayerLevel(cid) -1) - getPlayerExperience(cid)) or getPlayerRequiredMana(cid, getPlayerMagLevel(cid))) .. " " .. (t == 2 and "experience" or "mana") .. " points to " .. (t == 2 and "" or "mana") .. "level " .. (t == 2 and (getPlayerLevel(cid) + 1) or (getPlayerMagLevel(cid) -1)))
return true
]]></talkaction> [/XML]

w tym momencie pokazuje nam on ile potrzebujemy spali? many do next mlvl, natomiast czy my mamy 20% czy 88% wbitego mlvl pokazuje nam to samo, a chodzi mi o to by odlicza? spalan? mane i pokazywa? prawdziw? warto??. Aha i jeszcze jedno gdy zak?adamy itemek kt?ry daje nam +10 mlvl to ta warto?? ro?nie fajnie by?oby gdyby pobiera? dane z bazy danych a nie z gracza.

Pozdrawiam.
 

Placek

Blue Waffle
Joined
Sep 30, 2008
Messages
6,793
Reaction score
672
Age
9
Odp: !hp, !mp

@up
Co do many:
[LUA]mlv = db.getResult("SELECT `maglevel` FROM `players` WHERE `id` = getPlayerGUID(cid);")
mp = getPlayerRequiredMana(cid, mlv)-getPlayerSpentMana(cid)
[/LUA]
I w linijce doPlayerSendTextMessage w takim miejscu zeby ci bylo wygodnie i zeby to wygladalo wrzucasz "..mp..", ktore ci zwraca odpowiednia liczbe.
Rozwiazanie do dupy, bo pytanie bazy o cokolwiek to slaby pomysl, ale masz o co prosiles xD
 

elo1989

Advanced User
Joined
Feb 12, 2009
Messages
211
Reaction score
6
Odp: !hp, !mp

to jak by? to rozwi?za?, otwarty na propozycj? jestem/ :)
 
Status
Not open for further replies.
Top