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

RevScripts set storage onlogin problem

Jeyci

Banned User
Joined
May 6, 2023
Messages
289
Solutions
3
Reaction score
36
Hello i found an script that should give storages when a player logs in. the script is not giving errors or the storages either
Lua:
local storages = {30015,30018,30019,30020,30021,30023,30024,30026,30027,30028,30031,30032,30033,30034,30035,300000,20000,50139,25000,25001,25002,25003,25004,24000,24001,22000,22002,22003,22004,22005,22006,22007,22008,
22009,22010,22011,22012,22013,22014,22015,22016,22017,22018,22019,22020,22021,22022,22023,25580,25581,25582,
25583,25584,25585,25586,25587,25588,25589,25590,25591,25592,35600,35601,35602,35603,


98231521,800,

897,
801, -- ã
802, -- ã
803,
804,
805,
806,
807,
808,
809,


899,
810, -- ã
811, -- ã
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,


898,
824, -- ã
825, -- ã
826, -- ã
827, --
828, --
829, --
830, --
831, --
832, --
833, --
834, --
835, --
836, --
837, --
838, --
839, --
840, --
841,--
842, --
843, --
844,
845,
846,


847,
848,
849,
850,
851,
852,



 853,
 854,
 855,
 856,
 857,
 858,
    

 859,
 860,
 861,
 862,
 863,
 864,
    

 865,
 866,
 867,
 868,
 869,
 870,
    


871,
872,
873,
874,
875,
876,
877,



    17950,

17999,
18000,
18001,
18500,


18002,
     18510,
     18511,
     18512,
18513,
18514,


18003,
18520,
18521,
18522,
18523,
18524,
18525,
18501,


18004,
18530,
18502,


18005,
18503,



18006,
18550,
18551,
18504,



18007,
18540,
18541,
18542,
18505,


18008,
18506,



--
--    34999 - 35100
35000,
35001,
35002,
35003,

35004,
35005,
35006,
35007,

35008,
35009,
35010,

35011,
35012,

35050,
35051,
35052,


    10195,
    10196,
    10197,
    10198,
    10199,
    10200,
    10221,
    10222,
    10223,
    10224,
    10225,
    10226,
    10227,
    10228,
    10229,
    10230,
    10231,
    10232,
    10233,
    10234,
    10235,
    10236,


    10094,


    10068,
    10069,
    10070,


    10076, -- 
    10128,
    10129,
    10078,
    10079,
    10080,
    10081,
    10082,
    10083,
    10084,
    10085,
    10086,
    10087,
    10088,
    10089,
    10090,
    10091,
    10092,
    10111,
    10112,
    10113,
    10114,
    10115,
    54391,
    54392,
    54393,
    54394,
    54395,
    10117,
    10118,
    10119,
    10120,
    10121,
    10122,
    10123,
    10124,
    10125,
 10126,
    10127,
    10116,


    10132,
    10133,
    10134,
    10135,
    10136,
    10137,
    10138,
    10139,
    10140,
    10141,
    10142,
    10143,
    10144,
    10145,
    10146,
    10147,
    10148,
    10149,
    10150,
    10151,
    10152,
    10153,
    10154,
    10155,
    10156,
    10157,
    10158,
    10159,
    10160,
    10161,
    10162,
    10163,
    10164,
    10165,
    10166,
    10167,
    10168,
    10169,


    48,
    49,


    90,
    91,
    92,
    93,
    94,
    95,
    96,
    97,
    98,--  1 -    ,  2 -   
    99,
    100,
    118,
    102,
    103,
    104,
    105,
    106,
    107,
    108,
    109,
    117,
    111,
    112,
    113,
          114,
    115,
    116,


51201,
51202,
51203,
51204,
51205,
51206,
51207,
    52108,



50717,
50718,
50719,


    50720,


-- 

51110,
    51111,
    51112,
51113,
    51114,
51115,
51116,

-- 

51120,
    51121,
    51122,
    51123,
51124,
51125,



    402,


    900,
    901,
    902,
    903,
 904,
 905,
 906,
 907,
 908,
 909,
 910,

    911,

    921,

    930,
    931,
    932,

    933,
    934,
    935,

    936,
    937,
    938,

    939,
    940,
    941,

    942,
    943,
    963,
    944,

    945,
    946,
    947,

    948,
    949,
    950,

    951,
    952,
    953,

    954,
 955,
 956,
 957,

 958,
 959,
 960,
    961,
    962,

 963,
 964,
 965,


    984,
    985,


    3066,


    10000,
    10001,
    10002,


--             
--         .
    9990,
9991,
9992,
9993,
9994,
9995,
9996,
9997,
9998,
 9999,
 9950,
 9951,
 9952,
 9953,
 9954,
 9955,
 9956,
 9957,
 9958,
  9959,
 9960,
 9961,
 9962,
 9963,
 9964,
 9965,
 9966,
 9967,
 9968,
  9969,
 9970,
 9971,
 9972,
 9973,
 9974,
 9975,
 9976,
 9977,
 9978,
 9979,
 9980,
 9981,
 9982,
 9983,
 9984,
  9985,
 9986,
 9987,
 9988,
 9989,
 9920,
 9921,
 9922,
 9923,
 9924,
  9925,
 9926,
 9927,
 9928,
 9929,
 9930,
 9931,
 9932,
 9933,
 9934,
  9935,
 9936,
 9937,
 9938,
 9939,
 9940,
 9941,
 9942,
 9943,
 9944,
  9945,
 9946,
 9947,
 9948,
9949,
9876,


    10060,
    10061,

    20060,
    20061,
    20062,
    20063,


    20080,


    10080,
    10081,

    10082,


    6874100,
    6874101,

6874102,
6874103,
6874104,
6874105,
6874106,


6874107,
6874108,
6874109,
6874110,
6874111,



    12010, --     
    12010,


12005,
12006,
12007,


    
    --     
12009,
12011,

12008,
12012,
12017,


--   
    22029,
    22030,

-- -
    12013,
    12014,
    12020,

-- -
    12015,
    12016,

--
    12018,
    12019,

-- -
12050,
12051,
12052,
12053,
    12054,
    12055,


12054,
12055,



12153,

12154,
12155,
12156,
12160,



12061,
12062,
12063,
12064,
12072,


-- 
    12069,
    12070,

-- -
    12065,

-- -
    12067,
    12068,
    12071,

-- -
    12066,

-- -
    50003,
    50002,
    22034,

-- 
    50080,
    50081,
    18999,

-- 
    52000,

    50083,
    3040,
    50084,
    3044,


15000,
15001,
15002,


    50137,
    50138,


    12100,
    12109,
 50214,
 50215,
 50216,
 50217,
 50218,
 50219,
 50220,


    12120,
    12121, --   
    12128,
    12119,
    12124,
    12125,
    12126,
    12127,
    12128,
    12129,
    12151,
    12152,


    12130, --   
12131,
12132,
12133,
12134,
12135,
12136,
12137,
12138,
  12139,
12140,
    12141,
 12142,
 12143,
 12144,
    12145,
    12146,
    12147,
    12148,
    12149,
    12150,


    12160, --   
12161,
12162,
12163,
12164,
12165,
12166,
12167,
    12170,
    12171,
    12172,
    12173,
    12174,
    12175,
    12176,
    12177,
    12178,


    12190, --   
12191,
12192,
12193,
    12194,
    12195,


    12200, --   
12201, --   
12202, --  1:   
12203, --  2: 
12204, --  3: 
12205, --  4: 
12206, --  5:   
12207, --   
12208, -- 
 12209, --   1: 
 12210, --   2:
12211, --   3: 
12212, --   4:
    12213,
    12214,
    12215,
    12216,
    12217,
    12218,
    12219,
    12220,
12221,
12222,
12223,
12224,
    7814,


    30,


    12240, --   
12241,
12242,
12243,
12244,
12245,
12246,
12247,
12248,
  12249,
 12250,
12251,
12252,
12253,
12254,
    12255,
    12256,
    12257,
    12258,
    12259,
    12260,
    12261,
    12262,
    12263,
    12264,
    12265,
    12266,
    12267,
    12268,
    12269,
    12270,
    12271,
    12272,
    12273,
    12274,
    12275,
    12276,
    12277,
    12278,
    12279,


    12300, --   
12301, --   !
12302,
12303,
12304,
12305,
12306,
12307,
12308,
12309,
    12310,


    12330, --   
12331,
12332,
12333,
12334,
12335,
12336,
    12337,


    12350, --   
12351,
12352,
12353,
12354,
12355,
12356,
12357,
12358,
  12359,
 12360,
12361,
12362,
    12363, --1068
    12364, --1062
    12365, --1066
    12366, --1067
12367, --1070
12368, --1071
12369, --1072
    12370, --1084
    12371, --1090
    12372,
    12373,
    12374,

--     
    1060,


    12400,
    12401,
    12402,
    12403,
    12404,


12450,
12451,
12452,
12453,
12454,
12455,
12456,
12457,
  12458,
 12459,
    12460,
    12461,

    251,
    252,
    253,
    254,

    255,
    256,
    257,
    258,
    259,
    260,


    12501,
12502,
12503,
12504,
12505,
12506,
12507,
12508,
12509,
    12510,
    12513,
    12514,

12540,

    12550,
12551,
12552,
12553,
12554,
12555,
12556,
12557,
12558,
12559,
12560,
12561,
12562,
12563,
12564,
12565,
12566,
12567,
12568,
12569,
    12578,


    12600,
    12601,
    12602,
    12603,
    12604,
    12605,
    12606,
    12607,
    12608,
    12609,
    12610,
    12611,
    12612,
    12613,


    12650,
    12651,
    12652,
    12653,
    12654,
    12690,
    13330,
    3938,
    3939,


3940,
3941,
    
 3942,
 3943,
 3944,
 3945,
 3946,
 3947,
 3948,
 3949,
 3950,
 3951,
 3952,
 3953,
 3954,
 3955,
 3956,
 3957,
    



    12700,
    12701,
    12702,
    12703,
    12704,
    12705,
    12706,
    12707,
    12708,
    12709,
    12710,


    12800,
    12801,
    12802,
    12803,
    12804,
    12805,
    12806,
    12807,
    12808,


    50000,
    65050,
    50001,
    65049,

    22222,
    22555,
    22223,
    22556,



    50013,
    50019,
    50018,
    50016,
    50015,
    50014,
    50021,

    50017,
    50020,


    50022,
    50023,
    50024,
    50028,


    50085,
    50086,
    50087,
    50088,
    50089,
    50090,
    50091,
    50092,
    50097,
    50098,

50095,
2215,

    1010,
    1013,
    1014,

    8288,
    8289,
    8290,
    8291,


    1100,
    13100,

    50140,
    50141,
    50142,

    26300,
    27300,
    28300,

    1103,
    1105,
    1107,

--   
    26101,
    27101,
    28101,


-- :     
    3067,
    3068,

    50093,
    50094,

    2212,
    2213,
    2214,

    3057,
    3058,

--  ,    . ( 2000)
    490,
    491,
    9196,

 3062,
 3064,

    9185,
    2286,

    9155,

    9130,

    9136,

    50057,

    60994,

 9172,
 9173,
 9174,

    3500,
    3501,
    3502,
    3503,
    3504,
    3505,

 3301,
 3302,
 3303,

    64121,
    64131,
    64132,

    50033,
    50034,

    50148,

    19910,


    8819,
    8818,
    50096,

    10544,

    2080,
    2081,
    2082,
    2083,
    2084,
    2085,
    2086,


 50006,
 50007,
 50008,
 50009,
 50010,


    50200,
    50201,
    50202,


    50203,
    50204,
    50205,
    50206,
    50207,
    50208,
    50209,
    50210,
    50211,
    50212,
    50213,


3006,
3007,



    3900,
 3901,
 3902,
 3903,
 3904,
 3905,
 3906,
 3907,
 3908,
 3909,
3910,
3911,
    3912,
    3913,
    3914,
    3915,
    3916,
    3917,
    3918,
    3919,
    3920,
    3921,
    3922,
    3923,
    3924,

3925,
3926,
3927,
3928,
3929,
3930,
3931,
3932,
3933,
3934,

    3935,
    3936,
    3937,



    165163,
    165164,
    165165,
    165166,
    165167,
    165168,



    50250,
 50251,
 50252,
 50253,
    50254,
    50255,



    500,
    501,
    502,
    503,


    --     ,     
30018,

50143,
320,
504,
505,
5556,
83,
258,
330,
1131,
50032,
50079,
50135,
50136,
50139,
50561,
50572,
9054,

50700,
50701,


    50702,
    50703,
    50724,


50704,
50705,
50706,
50707,
50708,
50709,
50710,
50711,
50712,
50713,
50714,
50715,
50716,



50806,
50807,





 50815,
 50816,
 50817,
 50818,
 50819,
 50820,
    9050,



 50801,
 50802,
 50803,
 50804,
 50805,


3250,
50721,
50722,
50723,
100000,
60045,
37,




100,


533000,
533001,
533002,



    984,
    985,


    566039,
    566040,


    566015,
    566026,

     566027,
     566028,
     566029,
     566030,
     566031,
     566032,
     566033,
     566034,
566035,


566064,
566065,
566066,
566067,
566068,
566069,
566070,
566071,
566072,

    566073,

566074,
566075,
566076,
566108,
566077,
566078,



    566079,
    566080,
    566081,
    566082,
    566083,
    566084,
    566085,
    566086,
    566087,
    566088,
    566089,
    566090,
    566091,


    566095,
    566096,
    566097,
    566098,
    566099,
    566100,
    566101,


    982,
 23700,
 23701,

987,
1000,
3143,
3144,

    3147,
    3148,


 8018,
 8019,
 8020,
 8021,


3189,
3190,
3191,
3192,



    10004,

    8568,
    8569,
    8570,
    8578,

 10005,
 10006,
 10007,
 10008,


    200,
    201,
    202,

50058,
51052,
5635,
5634,

--




}

local setStorage = CreatureEvent("setStorage")

function setStorage.onLogin(player)
    for i = 1, #storages do
        player:setStorageValue(PlayerStorageKeys[i], 1)
    end
    return true
end

setStorage:register()
 
Solution
Lua:
local setStorage = CreatureEvent("setStorage")

function setStorage.onLogin(player)
    
    local storageKeys = {
        30015,
        30018,
        30019,
        30020,
    }

    local alreadyReceived = true

    for _, storageKey in ipairs(storageKeys) do
        if player:getStorageValue(storageKey) ~= 1 then
            alreadyReceived = false
            break
        end
    end

    if not alreadyReceived then
      
        for _, storageKey in ipairs(storageKeys) do
            player:setStorageValue(storageKey, 1)
        end
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Welcome to the game! You received all storages.")
    end

    return true
end

setStorage:register()
The storages are very big. So, I did something... Here, you must put each storage in the table, ok? Test if it works before adding all the storages.
Lua:
local setStorage = CreatureEvent("setStorage")

function setStorage.onLogin(player)
 
    local storageKeys = {
        30015,
        30018,
        30019,
        30020,
       
    }

 
    for _, storageKey in ipairs(storageKeys) do
        player:setStorageValue(storageKey, 1)
    end

    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Welcome to the game! You received all storages.")

    return true
end

setStorage:register()
 
The storages are very big. So, I did something... Here, you must put each storage in the table, ok? Test if it works before adding all the storages.
Lua:
local setStorage = CreatureEvent("setStorage")

function setStorage.onLogin(player)
 
    local storageKeys = {
        30015,
        30018,
        30019,
        30020,
      
    }

 
    for _, storageKey in ipairs(storageKeys) do
        player:setStorageValue(storageKey, 1)
    end

    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Welcome to the game! You received all storages.")

    return true
end

setStorage:register()
Worked now
Post automatically merged:

Worked now
edit: it work but it updates the questlog on every log in can be possible to do it just once?
 

Attachments

Last edited:
Lua:
local setStorage = CreatureEvent("setStorage")

function setStorage.onLogin(player)
    
    local storageKeys = {
        30015,
        30018,
        30019,
        30020,
    }

    local alreadyReceived = true

    for _, storageKey in ipairs(storageKeys) do
        if player:getStorageValue(storageKey) ~= 1 then
            alreadyReceived = false
            break
        end
    end

    if not alreadyReceived then
      
        for _, storageKey in ipairs(storageKeys) do
            player:setStorageValue(storageKey, 1)
        end
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Welcome to the game! You received all storages.")
    end

    return true
end

setStorage:register()
 
Solution
You can try this way, not tested(revscript):

Lua:
-- Create an array of storages you want to add
local storages = {1000, 1001, 1002, 1003} 

-- Create an onLogin function that will be called when the player enters the game
local addStorages = CreatureEvent("AddStorages")
function addStorages.onLogin(player) 
    -- Loop through array of storages 
    for i = 1, #storages do 
        -- Get the current storage value 
        local value = player:getStorageValue(storages[i]) 
        -- If the value is lower than 1, it means the player doesn't have that storage(can be negative or 0)
        if value < 1 then 
            -- Assign a positive value to storage, eg 1
            player:setStorageValue(storages[i], 1) 
        end 
    end
    -- Returns true to indicate that the event ran successfully 
    return true 
end 
addStorages:register()
 
the one from @Mateus Robeerto worked good
thanks @pips
I have opened a new thread related to otcv8-android don't know if one of you guys could help me with this?
 
Back
Top