• 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!

[Help] CTF Rewards

Aldo Axel

New Member
Joined
Jul 14, 2014
Messages
70
Reaction score
4
Greetings and good day, someone could help me to modify this line, since when winning only grants 1 token, and the purpose is to give 100:

Code:
rewards_random = {
                                                [60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there
                                                                        items = {12411,12411,12411}
                                                                },

                                                [30] = { -- Rewards of 30%
                                                                        items = {12411,12411,12411}
                                                                },


                                                [10] = { -- Rewards of 10%
                                                                        items = {12411,12411,12411}
                                                                }
                                        }

Full mod is not posted because it does not needed :), cuz is the most common mod.
 
yeah bro, the rest is needed.
we need the part were rewards_random is called, so we can determine item and quantity, you don't need to set every item to the same on a "random" function.
 
Cannot put full mod but, this is the part on has i think will be need edited:
Code:
<?xml version="1.0" encoding="utf-8"?>

<mod name="CTF" version="1.0" author="Doggynub" contact="otland.net" enabled="yes">
  <config name="toto"><![CDATA[

--[[ Storage Settings]]--


Owner = 1900 -- put empty storage

FLAG2_INn = 4000 -- put empty storage

FLAG_IN = 4001 -- put empty storage

TEAM1_FLAGS = 3030 -- put empty storage

TEAM2_FLAGS = 3031 -- put empty storage

Event_Start = 3032 -- put empty storage

Event_timeend = 3033 -- put empty storage

Event_Tile_Close = 3039 -- put empty storage

joined = 2023 --put empty storage

Timer = 1010 --put empty storage

--------------------------------------


--[[ Places setting ]]--


BLUE_FLAG = {x = 32010, y = 32250, z = 7} -- Lugar Bandera azul

RED_FLAG = {x = 32053, y = 32216, z = 7} -- Lugar Bandera roja

Tp_Place = {x = 32150, y = 32276, z = 7} -- Lugar donde el telepuerto evento se va a crear.

Wait_Place = {x = 32088, y = 32230, z = 7} -- Los jugadores de posiciones del teleport seran enviado cuando el evento empieze

frompos = {x = 32083, y = 32227, z = 7} --empezar a metros cuadrados en la sala de espera (1 piso)

topos = {x = 32093, y = 32234, z = 7} -- finales metros cuadrados en la sala de espera (1 piso)

Red_Position = {x = 32053, y = 32219, z = 7} -- Red team temple pos

Blue_Position = {x = 32013, y = 32250, z = 7} -- Blue team temple pos



---------------------------------------


--[[Event setting ]]--


Event_WaitTime = 5 -- tiempo para la coleccion de jugador el evento se iniciara (en minutos)

Event_MaxTime = 10 --- en minutos (este es el tiempo maximo para un evento de funcionamiento bb)

Players_Speed = 2000 -- poner el nivel de velocidad de base en el evento (como si desea que la velocidad de lvl 300 entonces Wright 300)

  Flag_Holder_Speed = 2000 -- [Old-Style caracteristica] de velocidad para el jugador cuando tienen la bandera mejor no aumentar.

TEAM2_NAME = "Red" -- team 2 name

TEAM1_NAME = "Green" -- team 1 name

FLAG_SCORE = 3 -- anotar cuando el equipo se gana

Teleport_On_Score = false -- este transportara a todos los de su posicion en el equipo principal cuando una veintena uno una bandera, realizar manifestaciones falsas para desactivarlo.

Players_Least_Number = 2 -- esto significa que si hay menos de 2 jugadores se unieron al evento sera cancelado

Min_Join_Level = 200 -- min lvl para un jugador a unirse al evento

rewards_random = {
                                                [60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there
                                                                        items = {12411,12411,12411}
                                                                },

                                                [30] = { -- Rewards of 30%
                                                                        items = {12411,12411,12411}
                                                                },


                                                [10] = { -- Rewards of 10%
                                                                        items = {12411,12411,12411}
                                                                }
                                        }


]]></config>
  <lib name="CTF-lib"><![CDATA[
function isTeamTwo(cid)
        return (isPlayer(cid) and getPlayerStorageValue(cid,5054) > -1)
end
function isTeamOne(cid)
        return (isPlayer(cid) and getPlayerStorageValue(cid,5055) > -1)
end
function resetTheTeams(cid)
        return (isPlayer(cid) and setPlayerStorageValue(cid,5054,-1) and setPlayerStorageValue(cid,5055,-1))
end
function setflagOwner(cid)
        return setPlayerStorageValue(cid,Owner,1)
end
function flagOwner(cid)
        return (isPlayer(cid) and getPlayerStorageValue(cid,Owner) > 0)
end
function releaseBF(cid)
        setGlobalStorageValue(FLAG_IN,-1)
        setPlayerStorageValue(cid,103, 0)
        setPlayerStorageValue(cid,Owner,-1)
return true
end
function releaseRF(cid)
        setGlobalStorageValue(FLAG2_INn,-1)
        setPlayerStorageValue(cid,103, 0)
        setPlayerStorageValue(cid,Owner,-1)
return true
end
function setFirstTeam(cid)
        return setPlayerStorageValue(cid,5055,1)
end
function setSecondTeam(cid)
        return setPlayerStorageValue(cid,5054,2)
end
function addToRed()
        return setGlobalStorageValue(TEAM2_FLAGS,getGlobalStorageValue(TEAM2_FLAGS)+1)
end
function addToBlue()
        return setGlobalStorageValue(TEAM1_FLAGS,getGlobalStorageValue(TEAM1_FLAGS)+1)
end
function getBlueScore()
        return getGlobalStorageValue(TEAM1_FLAGS)
end
function getRedScore()
        return getGlobalStorageValue(TEAM2_FLAGS)
end
function getTheSpeed(level)
        value = (220 +(2 *(level -1)))
        return value
end

function resetTheStorage()
        setGlobalStorageValue(Event_Start,-1)
        setGlobalStorageValue(Event_timeend,-1)
        setGlobalStorageValue(TEAM1_FLAGS,0)
        setGlobalStorageValue(FLAG2_INn,-1)
        setGlobalStorageValue(FLAG_IN,-1)
        setGlobalStorageValue(TEAM2_FLAGS,0)
return true
end
function blueStolen()
        return getGlobalStorageValue(FLAG_IN)
end
function redStolen()
        return getGlobalStorageValue(FLAG2_INn)
end
function giveReward(cid)
        local t = math.random(1,100)
        if t <= 10 then
                local rare = rewards_random[10].items[math.random(1,#rewards_random[10].items)]
                doPlayerAddItem(cid,rare,1)
                doPlayerSendTextMessage(cid,25,"Rare rate Reward : you won "..getItemNameById(rare)..".")

        elseif t > 10 and t <= 40 then
                local semi = rewards_random[30].items[math.random(1,#rewards_random[30].items)]
                doPlayerAddItem(cid,semi,1)
                doPlayerSendTextMessage(cid,25,"Semi rate Reward : you won "..getItemNameById(semi)..".")


        elseif t > 40 then
                local aver = rewards_random[60].items[math.random(1,#rewards_random[60].items)]
                doPlayerAddItem(cid,aver,1)
                doPlayerSendTextMessage(cid,25,"Averege rate Reward : you won "..getItemNameById(aver)..".")
        end
        return true
end
]]></lib>
  <event type="login" name="Tutorial Login" event="script"><![CDATA[
domodlib('toto')
domodlib('CTF-lib')
function onLogin(cid)
        if getGlobalStorageValue(Event_Start) < 1 then
                if isTeamOne(cid) or isTeamTwo(cid) then
                        resetTheTeams(cid)
                end
        end
        registerCreatureEvent(cid, "Attk")
        registerCreatureEvent(cid, "ctff")
        registerCreatureEvent(cid, "prepare")
return true
end
</mod>
 
Let's do it the easy way.
We could remove all the random part since you only use one item.
But you don't gave me the part where giveReward(cid) is called

Just search for:
doPlayerAddItem(cid,rare,1)
doPlayerAddItem(cid,semi,1)
doPlayerAddItem(cid,aver,1)

Change all the 1 to 100.
 
@DukeeH
And the correct finally code will be this?
Code:
function giveReward(cid)
       local t = math.random(1,100)
        if t <= 100 then
                local rare = rewards_random[100].items[math.random(1,#rewards_random[10].items)]
                doPlayerAddItem(cid,rare,100)
                doPlayerSendTextMessage(cid,25,"Rare rate Reward : you won "..getItemNameById(rare)..".")
end
      return true
end
? correct me if i'm wrong :)
 
if you want to make it easier and cleaner.

Code:
function giveReward(cid)
        doPlayerAddItem(cid,12411,100)
        doPlayerSendTextMessage(cid,25,"Reward : you won "..getItemNameById(12411)..".")
      return true
end

and feel free to remove:
Code:
rewards_random = {
                                                [60] = { -- Rewards of 60% , if it is then it will randomly give one of the items in the items verible if there you put more than one item there
                                                                        items = {12411,12411,12411}
                                                                },

                                                [30] = { -- Rewards of 30%
                                                                        items = {12411,12411,12411}
                                                                },


                                                [10] = { -- Rewards of 10%
                                                                        items = {12411,12411,12411}
                                                                }
 
Back
Top