AdamsiQ
New Member
Hello at start i say im from Poland and my English is on medium level ^^.
I done my new ots script. It is advanced lottery system, it have options to add VIP days, premium days or item from configuration. This script is 100% by me.
Version : 1.0
Author : AdamsiQ
Ok lets start
At first step you add this line :
To :
Configuration :
Second step :
Create file :
In :
And add to this file script :
Script is the beta version i write it 5 minutes, it is tested and works good .
After you ask
Q: What is the tfs:MOD by AdamsiQ ?
A: It is my mod to tfs, all scripts created from 0. I deleted not useful scripts and create better server. I add my mod to this forum in few days.
Q: This script is the beta ?
A: Yes it is the first version my lottery. I edit this and replace in some days.
I done my new ots script. It is advanced lottery system, it have options to add VIP days, premium days or item from configuration. This script is 100% by me.
Version : 1.0
Author : AdamsiQ
Ok lets start
At first step you add this line :
Code:
<globalevent name="MOD:lotto" interval="3600" event="script" value="lotto.lua"/>
Code:
/data/globalevents/globalevents.xml
Code:
interval=""
There you write the time while script working, 3600 seconds is 1h.
Second step :
Create file :
Code:
lotto.lua
Code:
data/globalevents/scripts/
Code:
----------------------- onThink -------------------------
function onThink(cid, interval, lastExecution)
----------------------- onThink -------------------------
-- AdamsiQ Works -- AdamsiQ tfs.MOD v5.1 --
local c = {
prizes = {{2160,10},{2160,100}}, -- There you can add prizes :)
-- -- -- -- -- -- -- -- -- -- --
vipDaysPrize = true, -- Player can vin Vip days only for vip witch Data Base :-)
vipDaysCount = 2, -- Count of vip days to win :)
-- -- -- -- -- -- -- -- -- -- --
premiumDaysPrize = true, -- Player can win premium days ? ;]
premiumDaysCount = 5, -- How many premium days player win.
-- -- -- -- -- -- -- -- -- -- --
lotteryTime = "1h",
forAdmins = false, -- true/false can admins (group 2 + ...) get item or bonus in lottery ?
messages = true -- Send console message information ?
}
local script = { -- It is AdamsiQ tfs.MOD feature ^^
author = "AdamsiQ",
version = "1.0",
testedOn = "TFS 0.3.6",
name = "Lottery System"
}
local online = getPlayersOnline()
if #online == 0 then
if c.messages == true then
print("["..script.name.."]: Server dont have online players to create lottery.")
end
return true
end
local cid = online[math.random(#online)]
local g = {
level = getPlayerLevel(cid),
group = getPlayerGroupId(cid),
premium = getPlayerPremiumDays(cid)
}
local item = c.prizes[math.random(#c.prizes)]
if c.vipDaysPrize == false and c.premiumDaysPrize == false then
rand = 32
elseif c.vipDaysPrize == true then
rand = math.random(1,66)
elseif c.premiumDaysPrize == true then
rand = math.random(1,100)
end
if isPlayer(cid) == true then
if c.forAdmins == true and g.group >= 1 then
if rand >= 1 and rand <= 33 then
doPlayerAddItem(cid,item[1],item[2] or 1)
doBroadcastMessage(""..script.name..": The player "..getPlayerName(cid).." has won the random prize.\n(item or premium or vip days)\nNext lotto: in "..c.lotteryTime.."")
if c.messages == true then
print("["..script.name.."]: The player "..getPlayerName(cid).." has won the item. (ID:"..item[1].." COUNT:"..item[2]..")")
end
return true
elseif rand >= 33 and rand <= 66 then
doAddVipDays(cid, c.vipDaysCount)
doBroadcastMessage(""..script.name..": The player "..getPlayerName(cid).." has won the random prize.\n(item or premium or vip days)\nNext lotto: in "..c.lotteryTime.."")
if c.messages == true then
print("["..script.name.."]: The player "..getPlayerName(cid).." has won the "..c.vipDaysCount.." VIP days.")
end
return true
elseif rand > 66 then
doPlayerAddPremiumDays(cid, c.premiumDaysCount)
doBroadcastMessage(""..script.name..": The player "..getPlayerName(cid).." has won the random prize.\n(item or premium or vip days)\nNext lotto: in "..c.lotteryTime.."")
if c.messages == true then
print("["..script.name.."]: The player "..getPlayerName(cid).." has won the "..c.premiumDaysCount.." PREMIUM days.")
end
return true
end
end
end
return true
end
Script is the beta version i write it 5 minutes, it is tested and works good .
After you ask
Q: What is the tfs:MOD by AdamsiQ ?
A: It is my mod to tfs, all scripts created from 0. I deleted not useful scripts and create better server. I add my mod to this forum in few days.
Q: This script is the beta ?
A: Yes it is the first version my lottery. I edit this and replace in some days.