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

random items

mmheo

New Member
Joined
Sep 14, 2017
Messages
157
Reaction score
1
hello guys i use this one Random Item Stats

and i add this function
Lua:
local  function getPlayerGamePoints(cid)
local points = getPlayerStorageValue(cid, 102548)
if(points == -1) then
points = 0
end
return points
end

and chnage function createLoot(i, ext) to be like this function createLoot(i, ext, cid)
and change this line if( math.random(100000) <= v.chance ) to be like this if( math.random(100000) <= v.chance+ getPlayerGamePoints(cid) )
its work fine but in some time give me this error
bug one.png

use tfs r3777
 
Could you post the whole script instead of telling us what you added? it's easier for us to debug
 
line #496
Lua:
local function dropLoot(pos, v, ext, master, cid, target)
    if(not isPlayer(cid) or not isMonster(target)) then
        return false
    end
 
Below "local function dropLoot(pos, v, ext, master, cid, target)" add this
Lua:
 if(not isPlayer(cid) or not isMonster(target)) then
        return false
    end
 
i don't understand
You cant use this points = 0 like "trigger"
u defined "points" as value of storage, then if you wanna change it you must use setStorageValue
Lua:
local  function getPlayerGamePoints(cid)
local points = getPlayerStorageValue(cid, 102548)
if points == -1 then
setPlayerStorageValue(cid, 102548, 1)
end
return points
end
 
You cant use this points = 0 like "trigger"
u defined "points" as value of storage, then if you wanna change it you must use setStorageValue
Lua:
local  function getPlayerGamePoints(cid)
local points = getPlayerStorageValue(cid, 102548)
if points == -1 then
setPlayerStorageValue(cid, 102548, 1)
end
return points
end
It's not about setting the player's storage, its about getting his "points". if the storage is < 0, it should just return 0.
Your code would still return -1 since points has already been set to -1 before you set the new "points"
 
It's not about setting the player's storage, its about getting his "points". if the storage is < 0, it should just return 0.
Your code would still return -1 since points has already been set to -1 before you set the new "points"
Lua:
local  function getPlayerGamePoints(cid)
local points = getPlayerStorageValue(cid, 102548)
if(points == -1) then
return setPlayerStorageValue(cid, 102548, 0)
end
end
 
That wasn't my point..
If you wants make "clean" storage value 0 instead of -1 before "launch any script" register this onLogin in login.lua...
@Rombadr Im pretty dotn get what you mean, and for real that you understand the errors...
and
this return points take values from two sources
1. local points = getPlayerStorageValue(cid, 102548)
2. points = 0
And this cause arithmetic on a boolean value error, i give solve u know better :)
 
Last edited:
If you wants make "clean" storage value 0 instead of -1 before "launch any script" register this onLogin in login.lua...
@Rombadr Im pretty dotn get what you mean, and for real that you understand the errors...
and
this return points take values from two sources
1. local points = getPlayerStorageValue(cid, 102548)
2. points = 0
And this cause arithmetic on a boolean value error, i give solve u know better :)
not work and this function not the problem the problem in add cid to
function creatloot
 
Back
Top