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?
 

Hermes

dziwki kola gramy w lola
Joined
Nov 17, 2007
Messages
1,867
Reaction score
12
Location
Poland
doPlayerSetMaxCapacity(cid, cap)

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

legend1337

New Member
Joined
Aug 26, 2009
Messages
64
Reaction score
0
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..

;)
 

Evil Hero

Legacy Member
Joined
Dec 12, 2007
Messages
1,102
Reaction score
467
Location
Germany
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:

leonidhasani

New Member
Joined
Jan 9, 2017
Messages
10
Reaction score
0
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
 

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Reaction score
27
in script which has function onUse or in libs function cause this is only function which returns actual max cap
 

leonidhasani

New Member
Joined
Jan 9, 2017
Messages
10
Reaction score
0
thanks dude.
Are you scripter? I could need some help with some scripts it would be nice if you could help me sms below and I will answear you :D
 
Top