SN
dúvida

Value

Por Snowsz, 29 de ago. de 2012 em Scripts

script
5
818
SnowszS
29 de agosto de 2012 às 12:55

Bem galera, estou com uma duvida, em um script que estava fazendo pra um sisteminha meu de boost, mas eu queria por um limite no script

 

function onUse(cid, item, frompos, item2, topos)
setPlayerStorageValue(cid, 159951, getPlayerStorageValue(cid, 159951)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Boosted! You are boosted in '.. (getPlayerStorageValue(cid, 159951)) ..'.')
doSendAnimatedText(getCreaturePosition(cid), 'Boosted + '.. (getPlayerStorageValue(cid, 159951)) ..'', 144)
return true
end

 

toda vez que o usa, ele adiciona +1 de storage value no player, queria por um limite desse value, é que vou fazer outro item com a mesma função.

VodkartV
29 de agosto de 2012 às 13:00

tenta assiM

 

function onUse(cid, item, frompos, item2, topos)
local limit = 10
if getPlayerStorageValue(cid, 159951) < limit then
setPlayerStorageValue(cid, 159951, getPlayerStorageValue(cid, 159951)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Boosted! You are boosted in '.. (getPlayerStorageValue(cid, 159951)) ..'.')
doSendAnimatedText(getCreaturePosition(cid), 'Boosted + '.. (getPlayerStorageValue(cid, 159951)) ..'', 144)
end
return true
end

caoticC
29 de agosto de 2012 às 13:00

Se eu entendi direito e so usar a verificação de valor

assim

 
local value = 6 --- Quantos valores ele pode acrescentar
if getPlayerStorageValue(cid, 159951) == value then
return true
end

 

Agora no scripts

function onUse(cid, item, frompos, item2, topos)

local value = 6 --- Quantos valores ele pode acrescentar

if getPlayerStorageValue(cid, 159951) == value then

return true

end

setPlayerStorageValue(cid, 159951, getPlayerStorageValue(cid, 159951)+1)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Boosted! You are boosted in '.. (getPlayerStorageValue(cid, 159951)) ..'.')

doSendAnimatedText(getCreaturePosition(cid), 'Boosted + '.. (getPlayerStorageValue(cid, 159951)) ..'', 144)

return true

end

SnowszS
29 de agosto de 2012 às 16:48

Dúvida sanada, podem fechar o topico, editei o script do caotic e funcionou, deixei assim

 

function onUse(cid, item, frompos, item2, topos)
local value = 3 --- Quantos valores ele pode acrescentar
if getPlayerStorageValue(cid, 159951) == value then
doSendAnimatedText(getCreaturePosition(cid), 'Limited', 144)
else
setPlayerStorageValue(cid, 159951, getPlayerStorageValue(cid, 159951)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Boosted! You are brutalityed in '.. [/b]
[b](getPlayerStorageValue(cid, 159951)) ..'.')
doSendAnimatedText(getCreaturePosition(cid), 'Brut+'.. (getPlayerStorageValue(cid, 159951)) ..'', 144)
end
return true
end
caoticC
29 de agosto de 2012 às 16:56

Duvida Sanado

 

Topico Movido para area de Pedidos e Duvidas Resolvidos