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

Points system.

Ok, here is the talkaction to give someone points using the system you attached in your first post:
Code:
function onSay(cid, words, param)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param. Correct use /addPoints nameOfPlayer, points.")
return true
end

local t = string.explode(param, ",")
if(not t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params. Correct use /addPoints nameOfPlayer, points.")
return true
end

pid = getPlayerByNameWildcard(t[1])
if isCreature(pid) then
local points = getPlayerStorageValue(pid, 14574)
if points == -1 then points = 0 end
points = points + t[2]
doPlayerSetStorageValue(pid, 14574, points)
doCreatureSay(pid, "Yay! I now have "..points.." points!", 1)
end
return true
end

To use this, you will need to add it to talkactions.xml, and you can name it whatever you want (I named it addPoints in the params above).

Now for an item you use and gain points...
Code:
local pointsEarned = 10 -- Put how many points this item gives here

function onUse(cid, item, fromPosition, itemEx, toPosition)
local points = getPlayerStorageValue(pid, 14574)
if points == -1 then points = 0 end
points = points + pointsEarne
doPlayerSetStorageValue(pid, 14574, points)
doCreatureSay(pid, "Yay! I now have "..points.." points!", 1)
return true
end

To use this, add it to actions.xml and set it to an itemid.
Found this error on action script
Code:
[27/03/2015 21:51:29] [Error - Action Interface]
[27/03/2015 21:51:29] data/actions/scripts/points2.lua:onUse
[27/03/2015 21:51:29] Description:
[27/03/2015 21:51:29] data/actions/scripts/points2.lua:6: attempt to perform arithmetic on local 'points' (a boolean value)
[27/03/2015 21:51:29] stack traceback:
[27/03/2015 21:51:30]     data/actions/scripts/points2.lua:6: in function <data/actions/scripts/points2.lua:3>
And thanks for talk action script :)
TFS 0.3.6
 
I fixed a few errors in my post, I only really do stuff here while I am at work, so I don't test them. I had a few errors haha.
 
I fixed a few errors in my post, I only really do stuff here while I am at work, so I don't test them. I had a few errors haha.
Thanks its working good now but i have a question about original script, Is there anyway to make limit of upgrades? like last ml that i can get with command is 100 for voc 1/2/5/6, 10 for 4/8 and 2 for 3/7 its for example cuz i need to make limit cuz of i can upgrade unlimited skills atm :(
 
Hello, your script works for me, da thing is when I level up it doesn't give any points to
the character . Can ya help me out?
 
Tested on Tfs 0.4 works 90%

Magic level not working /trying to fix atm :p
 
Last edited:
@Xeraphus Can u help me in adding magic level to script ? i tried to add ["magic"] = 0, /It gives fist fighting instead of magic level ;p
 
because 0 is fist skill id
do
["magic"] = SKILL_MAGIC
Not working ;o
im using TFS 0.4 tho

i did few edits in script and here it is

local VocPoints = {
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
[5] = 2,
[6] = 2,
[7] = 2,
[8] = 2,
}
function onSay(cid, words, param)
if not (VocPoints[getPlayerVocation(cid)]) then
return false
end

local param = param:lower()
local p2 = string.explode(param, ",")
if (getPlayerStorageValue(cid, 14574) < 0) then
setPlayerStorageValue(cid, 14574, 0)
end

local skillids = {
["magic"] = SKILL_MAGIC,
["shielding"] = 5,
["sword"] = 2,
["axe"] = 3,
["club"] = 1,
["distance"] = 4
}

local attributes = {
["health"] = {np = 8, vl = 4, nm = "Hit Points"}, -- 2 Points to gain 10 hp
["energy"] = {np = 8, vl = 4, nm = "Mana Points"},
["magic"] = {np = 75, vl = 1, nm = "Magic Level"},
["shielding"] = {np = 70, vl = 1, nm = "Shielding Skill"},
["sword"] = {np = 70, vl = 1, nm = "Sword Skill"},
["axe"] = {np = 70, vl = 1, nm = "Axe Skill"},
["club"] = {np = 70, vl = 1, nm = "Club Skill"},
["distance"] = {np = 70, vl = 1, nm = "Distance Skill"},
}
if (param == "check") then
doPlayerPopupFYI(cid, "~*~*~ Add Attributes ~*~*~\n\nPoints Available: ".. getPlayerStorageValue(cid, 14574) .."\nLevel Points: ".. VocPoints

[getPlayerVocation(cid)])
elseif (p2[1] and p2[1] == "add") and (attributes[p2[2]]) and (tonumber(p2[3])) then
if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * attributes[p2[2]].np) then
doPlayerSendCancel(cid, "you do not have enough points to distribute!")
return doSendMagicEffect(getThingPos(cid), 2)
end

if (p2[2] == "health") then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
doCreatureAddHealth(cid, attributes[p2[2]].vl * tonumber(p2[3]))
elseif (p2[2] == "energy") then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
doCreatureAddMana(cid, attributes[p2[2]].vl * tonumber(p2[3]))
elseif(skillids[p2[2]]) then
for a = 1, tonumber(p2[3]) do
doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) +

1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
end
end


doSendMagicEffect(getThingPos(cid), 29)
doSendMagicEffect(getThingPos(cid), 30)
doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * attributes[p2[2]].np, 180)
setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * attributes[p2[2]].np)
else
local msgx = ""
for i, v in pairs(attributes) do
local add = (v.np > 1) and "s" or ""
msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " points".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
end
doPlayerPopupFYI(cid, "~*~*~ Add Attributes ~*~*~\n\nPoints needed for skill:\n\n".. msgx .. "\nExample of Use: ".. words .." add,health, 5\n\nPoints available: ".. getPlayerStorageValue(cid, 14574))
end

return true
end
 
Not working ;o
im using TFS 0.4 tho

i did few edits in script and here it is

local VocPoints = {
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
[5] = 2,
[6] = 2,
[7] = 2,
[8] = 2,
}
function onSay(cid, words, param)
if not (VocPoints[getPlayerVocation(cid)]) then
return false
end

local param = param:lower()
local p2 = string.explode(param, ",")
if (getPlayerStorageValue(cid, 14574) < 0) then
setPlayerStorageValue(cid, 14574, 0)
end

local skillids = {
["magic"] = SKILL_MAGIC,
["shielding"] = 5,
["sword"] = 2,
["axe"] = 3,
["club"] = 1,
["distance"] = 4
}

local attributes = {
["health"] = {np = 8, vl = 4, nm = "Hit Points"}, -- 2 Points to gain 10 hp
["energy"] = {np = 8, vl = 4, nm = "Mana Points"},
["magic"] = {np = 75, vl = 1, nm = "Magic Level"},
["shielding"] = {np = 70, vl = 1, nm = "Shielding Skill"},
["sword"] = {np = 70, vl = 1, nm = "Sword Skill"},
["axe"] = {np = 70, vl = 1, nm = "Axe Skill"},
["club"] = {np = 70, vl = 1, nm = "Club Skill"},
["distance"] = {np = 70, vl = 1, nm = "Distance Skill"},
}
if (param == "check") then
doPlayerPopupFYI(cid, "~*~*~ Add Attributes ~*~*~\n\nPoints Available: ".. getPlayerStorageValue(cid, 14574) .."\nLevel Points: ".. VocPoints

[getPlayerVocation(cid)])
elseif (p2[1] and p2[1] == "add") and (attributes[p2[2]]) and (tonumber(p2[3])) then
if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * attributes[p2[2]].np) then
doPlayerSendCancel(cid, "you do not have enough points to distribute!")
return doSendMagicEffect(getThingPos(cid), 2)
end

if (p2[2] == "health") then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
doCreatureAddHealth(cid, attributes[p2[2]].vl * tonumber(p2[3]))
elseif (p2[2] == "energy") then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
doCreatureAddMana(cid, attributes[p2[2]].vl * tonumber(p2[3]))
elseif(skillids[p2[2]]) then
for a = 1, tonumber(p2[3]) do
doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) +

1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
end
end


doSendMagicEffect(getThingPos(cid), 29)
doSendMagicEffect(getThingPos(cid), 30)
doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * attributes[p2[2]].np, 180)
setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * attributes[p2[2]].np)
else
local msgx = ""
for i, v in pairs(attributes) do
local add = (v.np > 1) and "s" or ""
msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " points".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
end
doPlayerPopupFYI(cid, "~*~*~ Add Attributes ~*~*~\n\nPoints needed for skill:\n\n".. msgx .. "\nExample of Use: ".. words .." add,health, 5\n\nPoints available: ".. getPlayerStorageValue(cid, 14574))
end

return true
end
no idea, i don't bother with old tfs versions anymore
 
no idea, i don't bother with old tfs versions anymore
If you don't know how to write code for a previous distro then why are you part of the support team? Just be honest with yourself and just say you don't know because to the rest of us it is pretty obvious that you don't know much of anything.
 
If you don't know how to write code for a previous distro then why are you part of the support team? Just be honest with yourself and just say you don't know because to the rest of us it is pretty obvious that you don't know much of anything.
I don't know anything at all, and it is quite obvious.
 
Back
Top