- Dołączył
- Wrzesień 30, 2015
- Posty
- 74
- Liczba reakcji
- 1
Witam, na czym polega ten Event ... oraz kiedy si? w??czy... znalaz?em go, nie jest m?j a bym chcia? wiedzie? tak du?o nie rozczyta?em ze skryptu. xD
[XML]<?xml version="1.0" encoding="utf-8"?>
<mod name="Pvpe" version="1.0" author="Rabbcio" contact="forum.tibia.tv" enabled="yes">
<config name="Pvpe_conf"><![CDATA[
--[[ Storage Settings]]--
poss =
{
{x=645,y=1939,z=7},
{x=589,y=1948,z=7},
{x=559,y=1941,z=7},
{x=523,y=1912,z=7},
{x=534,y=1859,z=7},
{x=626,y=1870,z=7}
}
-- sms pkt --- tickety --exp scrolle---s pot --- g amulet
Min_Join_Level = 70
--Global
NoP = 7200 -- number of players
top10={} -- top10
top = 7201
top_player=7202
top_playerk=7203
--Local
isInPvpEs = 7200
time=7201
-------------------------
function getNoP()
local i = 0
for _,tid in ipairs(getPlayersOnline()) do
if isInPvpE(tid) then
i=i+1
end
end
return i
end
-------------------------
function getTopPlayer()
return getStorage(top_player)
end
function getTopPlayerKills()
return getStorage(top_playerk)
end
function setTopPlayer(cid)
setGlobalStorageValue(7202, getCreatureName(cid))
setGlobalStorageValue(7203, getKills(cid))
return true
end
---------------------------
function getTime(cid)
return getPlayerStorageValue(cid, time)
end
function addTime(cid, secs)
if getPlayerStorageValue(cid, time) < 0 then doPlayerSetStorageValue(cid, time, 0) end
doPlayerSetStorageValue(cid, time, getPlayerStorageValue(cid, time)+secs)
return true
end
function startTime(cid)
doPlayerSetStorageValue(cid, time, getPlayerStorageValue(cid, time)+ os.time())
return true
end
function stopTime(cid)
doPlayerSetStorageValue(cid, time, getPlayerStorageValue(cid, time)- os.time())
return true
end
function isInPvpE(cid)
if getPlayerStorageValue(cid, isInPvpEs)>0 then
return true
else
return false
end
end
function goToPvpE(cid)
setPlayerStorageValue(cid, 7200, 1)
startTime(cid)
local npos=getRandomPos()
doTeleportThing(cid, npos, false, true)
doPlayerSendTextMessage(cid, 21, "You are player number "..getNoP()..". Kill them all.")
doSendMagicEffect(npos,10)
return true
end
function exitPvpE(cid)
setPlayerStorageValue(cid, 7200, 0)
local templepos = {x=1002, y=1001, z=7}
doTeleportThing(cid, templepos, false, true)
doSendMagicEffect(getCreaturePosition(cid),10)
stopTime(cid)
return true
end
function getKills(cid)
local db = db.getResult("SELECT * FROM `players` WHERE `name` = '".. getCreatureName(cid) .."';")
local kills = tonumber(db:getDataInt("pvpe"))
db:free()
return kills
end
function addKill(cid, count)
db.executeQuery("UPDATE `players` SET `pvpe` = pvpe+1 WHERE `name` = '".. getCreatureName(cid) .."' LIMIT 1;")
return true
end
function ResetStats()
db.executeQuery("UPDATE `players` SET `pvpe` = 0;")
setGlobalStorageValue(7202, 0)
setGlobalStorageValue(7203, 0)
return true
end
function getRandomPos()
return poss[math.random(1, #poss)]
end
--------------------------------------
]]></config>
<event type="login" name="pvpe_login" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onLogin(cid)
if getStorage(7442)==getPlayerName(cid) then
local rewardid=getStorage(7443)
local rewardc=getStorage(7444)
for i=1, rewardc do
doPlayerAddItem(cid, rewardid)
end
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have won "..rewardc.." "..getItemNameById(rewardid).."! ")
doSetStorage(7442, '')
end
registerCreatureEvent(cid, "pvpe_death")
return true
end
]]></event>
<event type="logout" name="pvpe_logout" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onLogout(cid)
if not isInPvpE(cid) then
return true
end
doPlayerSendTextMessage(cid,21, "You are on PvpE Island, you cannot logout here. Write '!pvpe exit', and logout then.")
return false
end
]]>
</event>
<event type="statschange" name="pvpe_death" event="script"><![CDATA[
domodlib('Pvpe_conf')
local corpse_ids = {
[0] = 3065, -- female
[1] = 3058 -- male
}
function onStatsChange(cid, attacker, type, combat, value)
if combat == COMBAT_HEALING then
return true
end
if getCreatureHealth(cid) > value then
return true
end
if not isInPvpE(cid) then
return true
end
doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
doCreatureAddHealth(cid,getCreatureMaxHealth(cid), false)
doCreatureAddMana(cid,getCreatureMaxMana(cid), false)
doTeleportThing(cid,getRandomPos(), false, true)
doCreatureSetNoMove(cid, true)
addEvent(doCreatureSetNoMove, 3000, cid, false)
--for i=1, 5 do
--addEvent(doSendAnimatedText, 1000*i, getPlayerPosition(cid),i,math.random(1,100)))
--doSendAnimatedText(getPlayerPosition(cid),i,math.random(1,100))
--end
if(getPlayerLevel(attacker)-getPlayerLevel(cid)>50) then
doPlayerSendTextMessage(attacker,22, "Player's level was too low.[Your: "..getPlayerLevel(attacker)..", His: "..getPlayerLevel(cid).."]")
else
addKill(attacker, 1)
doPlayerSendTextMessage(attacker,21, "It's your "..getKills(attacker).." kills.")
if getTopPlayer() == '' or (getTopPlayerKills()<getKills(attacker)) then
setTopPlayer(attacker)
if getTopPlayer()~=getCreatureName(attacker) then
doPlayerSendTextMessage(attacker,21, "You are Top1 now.")
doBroadcastMessage(getCreatureName(attacker) .. " is now Top1 with "..getTopPlayerKills().." points.")
end
end
end
for _,sid in ipairs(getPlayersOnline()) do
if isInPvpE(sid) then
doPlayerSendTextMessage(sid,22,getCreatureName(cid) .. " has died by "..getCreatureName(attacker)..".")
end
end
return false
end
]]></event>
<movevent type="StepIn" actionid="7200" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getPlayerLevel(cid) < Min_Join_Level then
doTeleportThing(cid,fromPosition, false, true)
doSendMagicEffect(fromPosition,10)
doPlayerSendTextMessage(cid,22,"Only players of level "..Min_Join_Level.." are allowed to pass.")
return true
elseif getTime(cid)<=0 then
doTeleportThing(cid,fromPosition, false, true)
doSendMagicEffect(fromPosition,10)
doPlayerSendTextMessage(cid,22,"Buy a ticket!")
return true
end
goToPvpE(cid)
return true
end
]]></movevent>
<talkaction words='!pvpe' event='script'><![CDATA[
domodlib('Pvpe_conf')
function onSay(cid, words, param, channel)
if not isInPvpE(cid) then
return false
end
if param=='exit' then
if isPlayerPzLocked(cid) then
doPlayerSendTextMessage(cid, 22, "You can't exit now.")
return true
end
exitPvpE(cid)
elseif param=='info' or param=='' then
if getTopPlayer() ~= '' then
doPlayerSendTextMessage(cid, 22, "There is "..getNoP().." players. Top1 is "..getTopPlayer().." with "..getTopPlayerKills().." points.")
else
doPlayerSendTextMessage(cid, 22, "There is "..getNoP().." players and no Top1 now.")
end
end
return true
end
]]></talkaction>
<action itemid='12466' event='script'><![CDATA[
domodlib('Pvpe_conf')
function onUse(cid, item, frompos, item2, topos)
addTime(cid, 3600)
if isInPvpE(cid) then
doPlayerSendTextMessage(cid, 22, "You added 1h, so you have now "..getClock(getTime(cid)).." time.")
else
doPlayerSendTextMessage(cid, 22, "You added 1h, so you have now "..getClock(getTime(cid)+os.time()).." time.")
end
doSendMagicEffect(getPlayerPosition(cid), 30)
doSendAnimatedText(getPlayerPosition(cid),"PVPE +1h",102)
doRemoveItem(item.uid, 1)
return true
end
]]></action>
<globalevent name="pvpe_removetime" interval="1000" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onThink(interval)
for _,cid in ipairs(getPlayersOnline()) do
if isInPvpE(cid) then
if getTime(cid)>0 then
doPlayerSendCancel(cid, "Time: ".. getClock(getTime(cid))..", Kills: "..getKills(cid)..".")
end
end
end
return true
end
]]></globalevent>
<globalevent name="pvpe_reset" time="16:55" event="script"><![CDATA[
domodlib('Pvpe_conf')
function isTopPlayer()
for _,sid in ipairs(getPlayersOnline()) do
if getCreatureName(sid)==getTopPlayer() then
return sid
end
end
return false
end
function PvpeReset()
local rewards={
[1]={id=12659, c=5},
[2]={id=12466, c=30},
[3]={id=9004, c=2},
[4]={id=7888, c=1} }
local winner = isTopPlayer()
local reward = rewards[math.random(1, 4)]--
doBroadcastMessage("The winner is "..getTopPlayer().." with "..getTopPlayerKills().." points! He won very cheap items: "..reward.c.." "..getItemNameById(reward.id)..".")
addEvent(doBroadcastMessage, 10000, "The stats are reset now, so today you can be the best on the PvPE Island and win very cheap rewards.")
if winner then
for i=1, reward.c do
doPlayerAddItem(winner, reward.id)
end
doPlayerSendTextMessage(winner,MESSAGE_INFO_DESCR, "You have won "..reward.c.." "..getItemNameById(reward.id).."! ")
else
setGlobalStorageValue(7442, getTopPlayer())
doSetStorage(7443, reward.id)
doSetStorage(7444, reward.c)
end
addEvent(ResetStats, 10000)
return true
end
function onTime()
doBroadcastMessage("Remain 5 min to the reset PvPE Island statistic, now Top1 is "..getTopPlayer().." with "..getTopPlayerKills().." points!")
addEvent(PvpeReset, 60*5*1000)
return true
end
]]></globalevent>
</mod>[/XML]
[XML]<?xml version="1.0" encoding="utf-8"?>
<mod name="Pvpe" version="1.0" author="Rabbcio" contact="forum.tibia.tv" enabled="yes">
<config name="Pvpe_conf"><![CDATA[
--[[ Storage Settings]]--
poss =
{
{x=645,y=1939,z=7},
{x=589,y=1948,z=7},
{x=559,y=1941,z=7},
{x=523,y=1912,z=7},
{x=534,y=1859,z=7},
{x=626,y=1870,z=7}
}
-- sms pkt --- tickety --exp scrolle---s pot --- g amulet
Min_Join_Level = 70
--Global
NoP = 7200 -- number of players
top10={} -- top10
top = 7201
top_player=7202
top_playerk=7203
--Local
isInPvpEs = 7200
time=7201
-------------------------
function getNoP()
local i = 0
for _,tid in ipairs(getPlayersOnline()) do
if isInPvpE(tid) then
i=i+1
end
end
return i
end
-------------------------
function getTopPlayer()
return getStorage(top_player)
end
function getTopPlayerKills()
return getStorage(top_playerk)
end
function setTopPlayer(cid)
setGlobalStorageValue(7202, getCreatureName(cid))
setGlobalStorageValue(7203, getKills(cid))
return true
end
---------------------------
function getTime(cid)
return getPlayerStorageValue(cid, time)
end
function addTime(cid, secs)
if getPlayerStorageValue(cid, time) < 0 then doPlayerSetStorageValue(cid, time, 0) end
doPlayerSetStorageValue(cid, time, getPlayerStorageValue(cid, time)+secs)
return true
end
function startTime(cid)
doPlayerSetStorageValue(cid, time, getPlayerStorageValue(cid, time)+ os.time())
return true
end
function stopTime(cid)
doPlayerSetStorageValue(cid, time, getPlayerStorageValue(cid, time)- os.time())
return true
end
function isInPvpE(cid)
if getPlayerStorageValue(cid, isInPvpEs)>0 then
return true
else
return false
end
end
function goToPvpE(cid)
setPlayerStorageValue(cid, 7200, 1)
startTime(cid)
local npos=getRandomPos()
doTeleportThing(cid, npos, false, true)
doPlayerSendTextMessage(cid, 21, "You are player number "..getNoP()..". Kill them all.")
doSendMagicEffect(npos,10)
return true
end
function exitPvpE(cid)
setPlayerStorageValue(cid, 7200, 0)
local templepos = {x=1002, y=1001, z=7}
doTeleportThing(cid, templepos, false, true)
doSendMagicEffect(getCreaturePosition(cid),10)
stopTime(cid)
return true
end
function getKills(cid)
local db = db.getResult("SELECT * FROM `players` WHERE `name` = '".. getCreatureName(cid) .."';")
local kills = tonumber(db:getDataInt("pvpe"))
db:free()
return kills
end
function addKill(cid, count)
db.executeQuery("UPDATE `players` SET `pvpe` = pvpe+1 WHERE `name` = '".. getCreatureName(cid) .."' LIMIT 1;")
return true
end
function ResetStats()
db.executeQuery("UPDATE `players` SET `pvpe` = 0;")
setGlobalStorageValue(7202, 0)
setGlobalStorageValue(7203, 0)
return true
end
function getRandomPos()
return poss[math.random(1, #poss)]
end
--------------------------------------
]]></config>
<event type="login" name="pvpe_login" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onLogin(cid)
if getStorage(7442)==getPlayerName(cid) then
local rewardid=getStorage(7443)
local rewardc=getStorage(7444)
for i=1, rewardc do
doPlayerAddItem(cid, rewardid)
end
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have won "..rewardc.." "..getItemNameById(rewardid).."! ")
doSetStorage(7442, '')
end
registerCreatureEvent(cid, "pvpe_death")
return true
end
]]></event>
<event type="logout" name="pvpe_logout" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onLogout(cid)
if not isInPvpE(cid) then
return true
end
doPlayerSendTextMessage(cid,21, "You are on PvpE Island, you cannot logout here. Write '!pvpe exit', and logout then.")
return false
end
]]>
</event>
<event type="statschange" name="pvpe_death" event="script"><![CDATA[
domodlib('Pvpe_conf')
local corpse_ids = {
[0] = 3065, -- female
[1] = 3058 -- male
}
function onStatsChange(cid, attacker, type, combat, value)
if combat == COMBAT_HEALING then
return true
end
if getCreatureHealth(cid) > value then
return true
end
if not isInPvpE(cid) then
return true
end
doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
doCreatureAddHealth(cid,getCreatureMaxHealth(cid), false)
doCreatureAddMana(cid,getCreatureMaxMana(cid), false)
doTeleportThing(cid,getRandomPos(), false, true)
doCreatureSetNoMove(cid, true)
addEvent(doCreatureSetNoMove, 3000, cid, false)
--for i=1, 5 do
--addEvent(doSendAnimatedText, 1000*i, getPlayerPosition(cid),i,math.random(1,100)))
--doSendAnimatedText(getPlayerPosition(cid),i,math.random(1,100))
--end
if(getPlayerLevel(attacker)-getPlayerLevel(cid)>50) then
doPlayerSendTextMessage(attacker,22, "Player's level was too low.[Your: "..getPlayerLevel(attacker)..", His: "..getPlayerLevel(cid).."]")
else
addKill(attacker, 1)
doPlayerSendTextMessage(attacker,21, "It's your "..getKills(attacker).." kills.")
if getTopPlayer() == '' or (getTopPlayerKills()<getKills(attacker)) then
setTopPlayer(attacker)
if getTopPlayer()~=getCreatureName(attacker) then
doPlayerSendTextMessage(attacker,21, "You are Top1 now.")
doBroadcastMessage(getCreatureName(attacker) .. " is now Top1 with "..getTopPlayerKills().." points.")
end
end
end
for _,sid in ipairs(getPlayersOnline()) do
if isInPvpE(sid) then
doPlayerSendTextMessage(sid,22,getCreatureName(cid) .. " has died by "..getCreatureName(attacker)..".")
end
end
return false
end
]]></event>
<movevent type="StepIn" actionid="7200" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getPlayerLevel(cid) < Min_Join_Level then
doTeleportThing(cid,fromPosition, false, true)
doSendMagicEffect(fromPosition,10)
doPlayerSendTextMessage(cid,22,"Only players of level "..Min_Join_Level.." are allowed to pass.")
return true
elseif getTime(cid)<=0 then
doTeleportThing(cid,fromPosition, false, true)
doSendMagicEffect(fromPosition,10)
doPlayerSendTextMessage(cid,22,"Buy a ticket!")
return true
end
goToPvpE(cid)
return true
end
]]></movevent>
<talkaction words='!pvpe' event='script'><![CDATA[
domodlib('Pvpe_conf')
function onSay(cid, words, param, channel)
if not isInPvpE(cid) then
return false
end
if param=='exit' then
if isPlayerPzLocked(cid) then
doPlayerSendTextMessage(cid, 22, "You can't exit now.")
return true
end
exitPvpE(cid)
elseif param=='info' or param=='' then
if getTopPlayer() ~= '' then
doPlayerSendTextMessage(cid, 22, "There is "..getNoP().." players. Top1 is "..getTopPlayer().." with "..getTopPlayerKills().." points.")
else
doPlayerSendTextMessage(cid, 22, "There is "..getNoP().." players and no Top1 now.")
end
end
return true
end
]]></talkaction>
<action itemid='12466' event='script'><![CDATA[
domodlib('Pvpe_conf')
function onUse(cid, item, frompos, item2, topos)
addTime(cid, 3600)
if isInPvpE(cid) then
doPlayerSendTextMessage(cid, 22, "You added 1h, so you have now "..getClock(getTime(cid)).." time.")
else
doPlayerSendTextMessage(cid, 22, "You added 1h, so you have now "..getClock(getTime(cid)+os.time()).." time.")
end
doSendMagicEffect(getPlayerPosition(cid), 30)
doSendAnimatedText(getPlayerPosition(cid),"PVPE +1h",102)
doRemoveItem(item.uid, 1)
return true
end
]]></action>
<globalevent name="pvpe_removetime" interval="1000" event="script"><![CDATA[
domodlib('Pvpe_conf')
function onThink(interval)
for _,cid in ipairs(getPlayersOnline()) do
if isInPvpE(cid) then
if getTime(cid)>0 then
doPlayerSendCancel(cid, "Time: ".. getClock(getTime(cid))..", Kills: "..getKills(cid)..".")
end
end
end
return true
end
]]></globalevent>
<globalevent name="pvpe_reset" time="16:55" event="script"><![CDATA[
domodlib('Pvpe_conf')
function isTopPlayer()
for _,sid in ipairs(getPlayersOnline()) do
if getCreatureName(sid)==getTopPlayer() then
return sid
end
end
return false
end
function PvpeReset()
local rewards={
[1]={id=12659, c=5},
[2]={id=12466, c=30},
[3]={id=9004, c=2},
[4]={id=7888, c=1} }
local winner = isTopPlayer()
local reward = rewards[math.random(1, 4)]--
doBroadcastMessage("The winner is "..getTopPlayer().." with "..getTopPlayerKills().." points! He won very cheap items: "..reward.c.." "..getItemNameById(reward.id)..".")
addEvent(doBroadcastMessage, 10000, "The stats are reset now, so today you can be the best on the PvPE Island and win very cheap rewards.")
if winner then
for i=1, reward.c do
doPlayerAddItem(winner, reward.id)
end
doPlayerSendTextMessage(winner,MESSAGE_INFO_DESCR, "You have won "..reward.c.." "..getItemNameById(reward.id).."! ")
else
setGlobalStorageValue(7442, getTopPlayer())
doSetStorage(7443, reward.id)
doSetStorage(7444, reward.c)
end
addEvent(ResetStats, 10000)
return true
end
function onTime()
doBroadcastMessage("Remain 5 min to the reset PvPE Island statistic, now Top1 is "..getTopPlayer().." with "..getTopPlayerKills().." points!")
addEvent(PvpeReset, 60*5*1000)
return true
end
]]></globalevent>
</mod>[/XML]
