• 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 Buying Cap

yoger

New Member
Joined
Oct 26, 2008
Messages
26
Reaction score
0
I need some help with doing option in shop to buy capacity for character. How should it be done?
 
doPlayerSetMaxCapacity(cid, cap)

but actually, I can't see function for getting total player capacity, only free getPlayerFreeCap(cid).
 
Last edited:
i got a idea =)

i can script it but no time :s

doPlayerSetMaxCapacity(cid, cap)
this=)

make example
u walk on a tile u will need 100cc then u lose them and get max cap =)

but if u wait 1 week i can script it cuz i dont got my own computer yet :S

so mmaybe someone see that and know how i told the script will was..

then he will script or maybe she..

;)
 
I've made the function azzap.

The base Capacity might not be right so correct it if it's wrong.

Lua:
function getPlayerMaxCap(cid)
local capacity =
{
[0] = {base = 100, gain = 5}, -- Calculated for level 1 // I'm unsure about this, base might not be right, so correct it, if it's wrong.
[1] = {base = 135, gain = 5}, -- Calculated for level 8
[2] = {base = 135, gain = 5}, -- Calculated for level 8
[3] = {base = 135, gain = 10}, -- Calculated for level 8
[4] = {base = 135, gain = 15}, -- Calculated for level 8
[5] = {base = 135, gain = 5}, -- Calculated for level 8
[6] = {base = 135, gain = 5}, -- Calculated for level 8
[7] = {base = 135, gain = 10}, -- Calculated for level 8
[8] = {base = 135, gain = 15} -- Calculated for level 8
}
	if getPlayerVocation ~= 0 then
		if getPlayerLevel(cid) > 8 then
			maxCap = (capacity[getPlayerVocation(cid)].base + ((getPlayerLevel(cid) -8) * capacity[getPlayerVocation(cid)].gain))
		else
			maxCap = capacity[getPlayerVocation(cid)].base
		end
	elseif getPlayerVocation(cid) == 0 then
		if getPlayerLevel(cid) > 1 then
			maxCap = (capacity[getPlayerVocation(cid)].base + ((getPlayerLevel(cid) -1) * capacity[getPlayerVocation(cid)].gain))
		else
			maxCap = capacity[getPlayerVocation(cid)].base
		end
	end
	return maxCap
end

Had to edit a few times, due to bug fixes but should be fully bug free now...

kind regards, Evil Hero
 
Last edited:
Where the freak should I put the script?
Answear me fast please I have bean trying to fix cap 100 everytime but never could.
So where should I put it
example "/warot/data/action/scripts/XXX.lua/

  1. function getPlayerMaxCap(cid)
  2. local capacity =
  3. {
  4. [0] = {base = 100, gain = 5}, -- Calculated for level 1 // I'm unsure about this, base might not be right, so correct it, if it's wrong.
  5. [1] = {base = 135, gain = 5}, -- Calculated for level 8
  6. [2] = {base = 135, gain = 5}, -- Calculated for level 8
  7. [3] = {base = 135, gain = 10}, -- Calculated for level 8
  8. [4] = {base = 135, gain = 15}, -- Calculated for level 8
  9. [5] = {base = 135, gain = 5}, -- Calculated for level 8
  10. [6] = {base = 135, gain = 5}, -- Calculated for level 8
  11. [7] = {base = 135, gain = 10}, -- Calculated for level 8
  12. [8] = {base = 135, gain = 15} -- Calculated for level 8
  13. }
  14. if getPlayerVocation ~= 0 then
  15. if getPlayerLevel(cid) > 8 then
  16. maxCap = (capacity[getPlayerVocation(cid)].base + ((getPlayerLevel(cid) -8) * capacity[getPlayerVocation(cid)].gain))
  17. else
  18. maxCap = capacity[getPlayerVocation(cid)].base
  19. end
  20. elseif getPlayerVocation(cid) == 0 then
  21. if getPlayerLevel(cid) > 1 then
  22. maxCap = (capacity[getPlayerVocation(cid)].base + ((getPlayerLevel(cid) -1) * capacity[getPlayerVocation(cid)].gain))
  23. else
  24. maxCap = capacity[getPlayerVocation(cid)].base
  25. end
  26. end
  27. return maxCap
  28. end
 
in script which has function onUse or in libs function cause this is only function which returns actual max cap
 
Back
Top