Hello peoples, bring today an exclusive event!!! IS A TOP FRAGGER EVENT!
in talkactions/scripts create a topfragger.lua and put:
now, in talkactions.xml add this line:
NECESSARY TO PARTICIPATE IN THE TOP FRAGGER EVENT:
in talkactions/scripts create a topfragger.lua and put:
Code:
-------------[[System by AbsoluteN]]------[[OTLAND.NET]]---------------------
--------------------------------------------------------------------------------
--[[CONFIG WORDS]]--
local wordsPlayer = "!gotopfragger"
local wordsGm = "!openEvent"
--[[CONFIG NAME]]--
local name = "Top Fragger Event"
--[[CONFIG "PLAYER"]]--
local level = 100
local storagePlayer = 15940 -- 1ª storage
local storagePlayer2 = 153654 -- 2ª storage
local posPlayer = {x= 160, y= 54, z= 7} -- Position where the player will be teleported.
--[[CONFIG "GOD"]]--
local storageGlobal = 17592 -- storage global.
local time = 30 -- time to finish event in minutes
--[[RECOMPENSE]]--
local recompensa = {{2160, 100}, {10107, 1}} -- {{id item, amount} , {id item, amount}}
-------- To add more items follows this pattern : {{1 recompensa}, {2 recompensa}, {...}, {...}}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function fim()
if getGlobalStorageValue(storageGlobal) >= 1 then
local max = 0
local winner = 0
for _, pid in pairs(getPlayersOnline()) do
local sto = getPlayerStorageValue(pid, storagePlayer)
if sto > max then
max = sto
winner = pid
end
end
if isPlayer(winner) then
doBroadcastMessage("The Player ["..getCreatureName(winner).."] killed ["..getPlayerStorageValue(winner, storagePlayer).." Player's] and win a Top Fragger Event.")
for i = 1, #recompensa do
doPlayerAddItem(winner, recompensa[i][1], recompensa[i][2])
end
else
doBroadcastMessage("The event ended and did not have a winner.")
end
setGlobalStorageValue(storageGlobal, 0)
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function onSay(cid, words, param)
--------------------------------------------------------------------------------
if(words == wordsPlayer) then
if getPlayerGroupId(cid) <= 1 then
if getGlobalStorageValue(storageGlobal) >= 1 then
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
if getPlayerLevel(cid) >= level then
local pos1 = getClosestFreeTile(cid, posPlayer, false, true)
doTeleportThing(cid, pos1)
doSendMagicEffect(pos1, 5)
doPlayerSendCancel(cid, "Good Luck and remeber, kill all!.")
doBroadcastMessage("The Player ["..getCreatureName(cid).."] entered the Top Fragger Event, this is your chance to kill him. !gotopfragger to participate.")
if getPlayerStorageValue(cid, storagePlayer2) - os.time() <= 0 then
setPlayerStorageValue(cid, storagePlayer2, os.time()+time*60)
end
else
doPlayerSendCancel(cid, "To participate in the event you need to have level greater than or equal to "..level..".")
end
else
doPlayerSendCancel(cid, "You can not be teleported with Battle. Lose your battle and run the command again.")
end
else
doPlayerSendCancel(cid, "The event is not open.")
end
else
doPlayerSendCancel(cid, "This function is just To Players.")
end
--------------------------------------------------------------------------------
elseif(words == wordsGm) then
if getPlayerGroupId(cid) >= 4 then
if getGlobalStorageValue(storageGlobal) <= 0 then
for _, pid in pairs(getPlayersOnline()) do
setPlayerStorageValue(pid, storagePlayer, 0)
end
doBroadcastMessage("The Event ["..name.."] started, and end in "..time.." Minutes. Say ["..wordsPlayer.."] to participated. (You can die and come back whenever you want, after all who kill moreplayers is the Event winner).")
setGlobalStorageValue(storageGlobal, 1)
addEvent(fim, time*60*1000)
else
doPlayerSendCancel(cid, "The Event ["..name.."] is already open.")
end
else
doPlayerSendCancel(cid, "Just ADMIN use this talkaction.")
end
end
--------------------------------------------------------------------------------
return true
end
--------------------------------------------------------------------------------
---------------------[[I do not authorize the posting on another forum]]-----------------
now, in talkactions.xml add this line:
Code:
<talkaction words="!gotopfragger;!openEvent" script="topfragger.lua"/>
NECESSARY TO PARTICIPATE IN THE TOP FRAGGER EVENT:
NO BATTLE FIGHT
LEVEL 100 OR MORE
LEVEL 100 OR MORE
Tested on tfs 0.3.6 and 0_4
Make a good use!