• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Reward : Premium Points

Fyruz

★★★★★
Joined
Feb 7, 2009
Messages
556
Reaction score
19
Location
127.0.0.1
Hello, I would like to request if someone can edit my script, instead of giving items, give premium points for everyone who win the event.
THX! REp+++
Lua:
local config = {
    rewards_id = {2494, 2472, 2514, 2493, 2470, 2195, 2173, 2160}, -- Rewards ID
    crystal_counts = 5, -- used only if on rewards_id you have crystal coins (ID: 2160).
    }

function onStepIn(cid, item, frompos, item2, topos)
        
local random_item = config.rewards_id[math.random(1, #config.rewards_id)]
local item_name =  getItemNameById(random_item)

if doPlayerSetTown(cid, 1) then
  if(random_item == 2160) then
                        doPlayerAddItem(cid, random_item, config.crystal_counts)
                        doPlayerAddItem(cid, 10138, 1)
		       doPlayerSendTextMessage(cid,25, 'Your team won the dota round! You winner: '.. config.crystal_counts ..' '.. item_name ..'s and dota winner medal!')
                else
                     doPlayerSendTextMessage(cid,25, 'Your team won the dota round! You winner: '.. item_name ..' and dota winner medal!')
                        doPlayerAddItem(cid, random_item, 1)
                        doPlayerAddItem(cid, 10138, 1)
                end
end
return TRUE
end
 
I don't really got the time, but make something like this:

Note: Try to fix the rest self

Lua:
local config = {
    points = 100, --- how many points
    }
 
function onStepIn(cid, item, frompos, item2, topos)
 
local random_item = config.rewards_id[math.random(1, #config.rewards_id)]
local item_name =  getItemNameById(random_item)
 
if doPlayerSetTown(cid, 1) then
  if(random_item == 2160) then
                        db.executeQuery('UPDATE accounts SET premium_points=premium_points+'..config.points..' WHERE id=' .. getPlayerAccountId(cid))
		       doPlayerSendTextMessage(cid,25, 'Your team won the dota round! You winner: '.. config.crystal_counts ..' '.. item_name ..'s and dota winner medal!')

                end
end
return TRUE
end

function getPremiumPoints(cid)
local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
if(res:getID() == -1) then
return 0
end
local ret = res:getDataInt("premium_points")
res:free()
return tonumber(ret)
end
 
Back
Top