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

Lua Edit string contains

Rebine

New Member
Joined
Feb 10, 2010
Messages
69
Reaction score
2
Location
Chile
Hello!
I need help how can i do this:

I have a string storage, example i use
setPlayerStorageValue(cid,18289,"Demon,3,Dragon,4,Cyclops,5")

How can i make for change this storage but counting the number next the comma, example:
Demon,3,Dragon,4,Cyclops,5

I kill 3 demon so:
Demon,6,Dragon,4,Cyclops,5
(i need for a task system)
Is like a string.gsub or string.explode?

I have this to differenciate one each word by comma:
list = tostring(getPlayerStorageValue(cid,18289)):explode(',')
SO, if i call list[1] it show the word "Demon" and if i call list[5] it show Cyclops

Undestood?
Someone can help me. Thanks
 
this could be used to get the value of the certain monster and raise it by 1, but then you somehow need to construct the string from new again.
Code:
for k, v in pairs(list) do
   if v == "monster name you want to check" then
     count = tonumber(list[k+1])+1
   end
end
 
Mmmm :( Dont u know how to make that?
I wanna change the string jajaja I think is hard:c
https://otland.net/threads/lib-storing-information-items-and-players-tfs-1-2.241873/

Using it in 0.3.6 is easier cause you don't even need the database table cause you can set storage strings.

Example:

Code:
local str = '{["Dragon"] = 4,["Demon"] = 6,["Cyclops"] = 5,}'
local out = {}
unserializeTable(str, out)
out["Dragon"] = out["Dragon"] + 10
print(serializeTable(out))

This will print the resulting string of '{["Dragon"] = 14,["Demon"] = 6,["Cyclops"] = 5,}'
That can be later unserialized/modified/serialized back again as you wish.
 
This works on 0.4? You mean you can do the job easier with that new tables on the database?
Because i have some problems too with my server item-attributes (a lot of attributes) so i cant put a ItemAttribute float, and when it become float it bug the item.

Uhmm anyway, what is the risk of use this new libs? Have errors?
 
This works on 0.4? You mean you can do the job easier with that new tables on the database?
Because i have some problems too with my server item-attributes (a lot of attributes) so i cant put a ItemAttribute float, and when it become float it bug the item.

Uhmm anyway, what is the risk of use this new libs? Have errors?
The serialization part will work in 0.4 because it's Lua. The item attribute won't cause it changed a lot from 0.4, but in 0.4 you should be able to set any attribute in the item as a string, float numbers will work with the serialization.
 
Back
Top