• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

help with a onlogin message script

Zogesoft

Zatania Developer
Joined
Aug 25, 2016
Messages
13
Reaction score
0
Location
Sweden
hello i have a script that should give message on login but when i log in i just get a message with the getstoragevalue and so on it never convert it to numbers i have tfs 0.4 its a daily task system.

if somebode have some time to just check i would apreciate it :)

regardz
zogesoft

LUA:
local config = {
     ['name'] = {rotworm, count = 20, storage = 5},
     ['name'] = {snake, count = 30, storage = 6},
     ['name'] = {tarantula, count = 50, storage = 10},
     ['name'] = {cyclops, count = 50, storage = 11},
     ['name'] = {giantspider, count = 80, storage = 17},
     ['name'] = {dragon, count = 80, storage = 18},
     ['name'] = {dragonlord, count = 100, storage = 22},
     ['name'] = {hydra, count = 100, storage = 23},
     ['name'] = {behemoth, count = 70, storage = 26},
     ['name'] = {demon, count = 70, storage = 27},
     ['name'] = {demon, count = 100, storage = 30},
     ['name'] = {hellspawn, count = 100, storage = 31},
     ['name'] = {plaguesmith, count = 70, storage = 34},
     ['name'] = {hydra, count = 150, storage = 35},
     ['name'] = {demon, count = 150, storage = 38},
     ['name'] = {wargolem, count = 150, storage = 39},
     ['name'] = {drakenwarmaster, count = 100, storage = 61},
     ['name'] = {grimreaper, count = 100, storage = 62},
     ['name'] = {serpentspawn, count = 200, storage = 41},
     ['name'] = {demon, count = 200, storage = 42},
     ['name'] = {demon, count = 160, storage = 46},
     ['name'] = {behemoth, count = 200, storage = 47},
     ['name'] = {grimreaper, count = 180, storage = 52}
}
function onLogin(cid)
if getPlayerStorageValue(cid,2423) > 2 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Mission]: You have killed '..(getPlayerStorageValue(cid, 2425)+0)..'/ '..config.count..''..config.name..'s.")

elseif 
            getPlayerStorageValue(cid,2423) > 99 then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Task message:You have completed your daily task")               
                else
    doPlayerSendTextMessage(cid,TALKTYPE_PRIVATE, "Task Message:You can start a daily task")
end
return true
end
 
you have to break the string using " not ' since you use " at the start
you also dont need +0 because it's redundant
use ".. (getPlayerStorageValue(cid, 2425) == -1 and 0 or getPlayerStorageValue(cid, 2425)) .." / ".. config.count .." ".. config.name .."s"
 
Last edited:
14:41:33.022] [Error - CreatureScript Interface]
[14:41:33.023] data/creaturescripts/scripts/taskmessage.lua:onLogin
[14:41:33.024] Description:
[14:41:33.024] data/creaturescripts/scripts/taskmessage.lua:28: attempt to concatenate field 'name' (a table value)
[14:41:33.026] stack traceback:
[14:41:33.027] data/creaturescripts/scripts/taskmessage.lua:28: in function <data/creaturescripts/scripts/taskmessage.lua:26>

i think something is wrong with the config table
 
Back
Top