slaw
Software Developer
Warning:
These functions works only in TFS 0.3.
Both accepts negative values, so you can use ex.:
doPlayerAddFrags(cid, -5) -- removing 5 frags
and
doPlayerAddLevel(cid, -30) --removing 30 levels
Place it in data/lib/function.lua file.
doPlayerAddFrags(cid, amount)
doPlayerAddLevel(cid, amount[, round = FALSE])
Example talkaction: (Remove 1 frag for 1cc)
doPlayerAddLevel has also additional parameter - round (default: FALSE), if you set it to TRUE, ex:
doPlayerAddLevel(cid, 3, TRUE) - if player have 30% to next level, then he'll only get these 30% so he have next level and 0%.
These functions works only in TFS 0.3.
Both accepts negative values, so you can use ex.:
doPlayerAddFrags(cid, -5) -- removing 5 frags
and
doPlayerAddLevel(cid, -30) --removing 30 levels
Place it in data/lib/function.lua file.
doPlayerAddFrags(cid, amount)
Code:
function doPlayerAddFrags(cid, amount)
return doPlayerSetRedSkullTicks(cid, getPlayerRedSkullTicks(cid) + getConfigInfo('timeToDecreaseFrags') * amount)
end
doPlayerAddLevel(cid, amount[, round = FALSE])
Code:
function doPlayerAddLevel(cid, amount, round)
local newExp = 0
local currentLevel = getPlayerLevel(cid)
if(amount > 0) then
newExp = getExperienceForLevel(currentLevel + amount) - (round == TRUE and getPlayerExperience(cid) or getExperienceForLevel(currentLevel))
else
newExp = -((round == TRUE and getPlayerExperience(cid) or getExperienceForLevel(currentLevel)) - getExperienceForLevel(currentLevel + amount))
end
return doPlayerAddExp(cid, newExp)
end
Example talkaction: (Remove 1 frag for 1cc)
Code:
local config =
{
cost = 10000
}
function onSay(cid, words, param)
if(doPlayerRemoveMoney(cid, config.cost) ~= TRUE) then
doPlayerSendCancel(cid, "Not enought money, remove frag cost " .. config.cost .. "gp.")
return TRUE
end
doPlayerAddFrags(cid, -1) --remove 1 frag
return TRUE
end
doPlayerAddLevel has also additional parameter - round (default: FALSE), if you set it to TRUE, ex:
doPlayerAddLevel(cid, 3, TRUE) - if player have 30% to next level, then he'll only get these 30% so he have next level and 0%.