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

Cap function.

Kekox

Well-Known Member
Joined
Apr 4, 2009
Messages
1,264
Reaction score
60
Location
Venezuela
Its just a function that you can use in your "buy clicking" scripts.. It just return true if the player have enough cap for the item that he will buy and return flase if he have not.
Lua:
function playerFreeCap(cid, toItem, itemCount)
         if getPlayerFreeCap(cid) >= getItemWeightById(toItem, itemCount) then
            return TRUE
         else
            return FALSE
         end
end

You could use like this:
Lua:
if playerFreeCap(cid, 2665, 1) == TRUE then

Instead of:
Lua:
if getPlayerFreeCap(cid) >= X then
With this one ^ you have to check the weigh in items.xml.
 
Last edited:
Did you test it? 'cid' is not declared in your function.

__kthx
 
Lua:
function playerFreeCap(cid, toItem, itemCount)
         return getPlayerFreeCap(cid) >= getItemWeightById(toItem, itemCount) -- and TRUE or FALSE
end

Remove the comment to make it work for old TFS.

I don't realize why people would need such functions :/ Would they be so lazy to make a one line function ?
 
Back
Top