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

doPlayerAddWisdomSkill

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
I have an error with my function: doPlayerAddWisdomSkill(cid, add)



What's wrong?

Lib:
Code:
SKILL_WISDOM = 5000

function doPlayerAddWisdomSkill(cid, add)
 local skill = getPlayerStorageValue(cid, SKILL_WISDOM)
  setPlayerStorageValue(cid, SKILL_WISDOM, skill+add)
 return TRUE
end

Talkaction:
Code:
function onSay(cid, words, param, channel)
 if(param == '') then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
   return true
    end
     local pid = getPlayerByNameWildcard(param)
      if isPlayer(pid) == TRUE then
     doPlayerAddWisdomSkill(pid, 1)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You gave one skill points to "..param..".")
   doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You advanced to wisdom level "..getPlayerWisdomSkill(pid)..".")
  end
 return TRUE
end

Please help-me :p

Bump.
 
Last edited by a moderator:
Lua:
SKILL_WISDOM = 5000

function doPlayerAddWisdomSkill(uid, add)
 local skill = getPlayerStorageValue(uid, SKILL_WISDOM)
  setPlayerStorageValue(uid, SKILL_WISDOM, skill+add)
 return TRUE
end
test S:
 
Code:
SKILL_WISDOM = 5000

function doPlayerAddWisdomSkill(uid, add)
 local skill = (getPlayerStorageValue(uid, SKILL_WISDOM)>= 0 and getPlayerStorageValue(uid, SKILL_WISDOM) or 0)
  setPlayerStorageValue(uid, SKILL_WISDOM, skill+add)
 return TRUE
end

Code:
SKILL_WISDOM = 5000

function doPlayerAddWisdomSkill(uid, add)
 local skill = getPlayerStorageValue(uid, SKILL_WISDOM)
if skill < 0 then
  setPlayerStorageValue(uid, SKILL_WISDOM, 0)
end
  setPlayerStorageValue(uid, SKILL_WISDOM, skill+add)
 return TRUE
end

Try the first. If it doesn't work the second should work I think. If not post error!
 
use edit button next time.. Bumping is only allowed every 24h.

About the script can u print getPlayerStorageValue(uid, SKILL_WISDOM)?
I think u try to do like -1 + 5 = making error in console.
 
use edit button next time.. Bumping is only allowed every 24h.

About the script can u print getPlayerStorageValue(uid, SKILL_WISDOM)?
I think u try to do like -1 + 5 = making error in console.

But... -1 + 5 is 4, so what's the problem?

@Edit:
Code:
function doPlayerAddWisdomSkill(cid, bonus)
	local level = getPlayerStorageValue(cid, SKILL_WISDOM) > 0 or 0
	setPlayerStorageValue(cid, SKILL_WISDOM, level + bonus)
	return true
end
 
But... -1 + 5 is 4, so what's the problem?

@Edit:
Code:
function doPlayerAddWisdomSkill(cid, bonus)
	local level = getPlayerStorageValue(cid, SKILL_WISDOM) > 0 or 0
	setPlayerStorageValue(cid, SKILL_WISDOM, level + bonus)
	return true
end
local level = getPlayerStorageValue(cid, SKILL_WISDOM) > 0 and getPlayerStorageValue(cid, SKILL_WISDOM) or 0
Otherwise it would be true if it's over 0.
 
But... -1 + 5 is 4, so what's the problem?

@Edit:
Code:
function doPlayerAddWisdomSkill(cid, bonus)
	local level = getPlayerStorageValue(cid, SKILL_WISDOM) > 0 or 0
	setPlayerStorageValue(cid, SKILL_WISDOM, level + bonus)
	return true
end

I know that xD But some programs don't they are bugging then:p
 
Back
Top