Quote:
Wie baue ich eine Sperre ein das andere Char´s auf dem Acc den Ring, wenn er aktiv ist NICHT auch nochmal aktivieren können?Code:quest exp_ringe begin state start begin when 72001.use or 72002.use or 72003.use begin local data = {6,12,24} local id = item.vnum - 72000 if get_time() < pc.getqf("expring") then return syschat("Du hast bereits einen Erfahrungsring aktiviert") end mysql_query("update account.account set silver_expire = ADDDATE(NOW(), INTERVAL ".. data[id] .." hour) where id = ".. pc.get_account_id() ..";") pc.setqf("expring", get_time() + data[id]*60) item.remove() syschat("Du hast einen ".. data[id] .." Stunden Erfahrungsring aktiviert") end end end
Code:
ALTER TABLE account.account ADD COLUMN expring_active int(25) NOT NULL DEFAULT 0;
Code:
mysql_query("UPDATE account.account SET expring_active = "..get_time()+HIER_DIE_SEKUNDEN_WIE_LANGE_DER_HÄLT_EINFÜGEN.." WHERE id = "..pc.get_account_id().." LIMIT 1;")
Code:
when 72001.use or 72002.use or 72003.use begin
if tonumber(mysql_query("SELECT expring_active FROM account.account WHERE id = "..pc.get_account_id().." LIMIT 1;").expring_active[1]) > get_time() then
syschat("Du kannst keinen weiteren EXP-Ring aktivieren.")
return
end
[... hier deinen normalen code einfügen]
end
Code:
quest exp_ringe begin
state start begin
when 72001.use or 72002.use or 72003.use begin
if tonumber(mysql_query("SELECT expring_active FROM account.account WHERE id = "..pc.get_account_id().." LIMIT 1;").expring_active[1]) > get_time() then
syschat("Du kannst keinen weiteren EXP-Ring aktivieren.")
return
end
local data = ({6, 12, 24})[item.get_vnum()-72000]
mysql_query("UPDATE account.account SET silver_expire = ADDDATE(NOW(), INTERVAL "..data.." hour), expring_active = "..get_time()+(data*60).." WHERE id = "..pc.get_account_id().." LIMIT 1;")
pc.remove_item(item.get_vnum()) --zufrieden Remix? ;)
syschat("Du hast einen "..data.." Stunden Erfahrungsring aktiviert")
end
end
end