FI

[Arquivado]Doplayeraddfrags + Doplayeraddlevel

Por Fir3element, 05 de set. de 2010 em Noticias - Arquivo

5.0 (1)
2
1.2k
05 de setembro de 2010 às 15:48

Exemplo de talkaction:

 

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

 

Créditos: slawkens

 

Em data/lib/function.lua adicione:

 

doPlayerAddFrags(cid, amount)

 

function doPlayerAddFrags(cid, amount)
return doPlayerSetRedSkullTicks(cid, getPlayerRedSkullTicks(cid) + getConfigInfo('timeToDecreaseFrags') * amount)
end

doPlayerAddLevel(cid, amount[, round = FALSE])

 

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

Editado Setembro 5 por fireelement

7 anos depois...
StigalS
25 de abril de 2018 às 16:26
Esta noticia foi arquivada.
Este tópico está fechado e foi movido para Noticia - Arquivo.

+ Caso tenha atualizações você poderá criar outro tópico.