Olá galera, tenho um sistema de vip no meu servidor que quando adicionado /addvipdonate PLAYER, DIAS ele adiciona vip ao player e acrescenta [vip] ao nome dele, queria substituir esse comando por um item que fizesse a mesma função!
Uso o seguinte sistema com comando /addvipdonate PLAYER, DIAS
elseif(words == "/addvipdonate") then if getPlayerAccess(cid) == 5 then local t = string.explode(param, ",") if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") end
local player = getPlayerByName(t[1]) local name = getCreatureName(player) local days = t[2] local pid = getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") return TRUE end
local daysvalue = days*3600*24 local storageplayer = getPlayerStorageValue(player, 13555) local timenow = os.time() local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)
if string.find(tostring(getCreatureName(pid)),"[[Vip]]") then
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..days.." dias de VIP no seu character.")
setPlayerStorageValue(player, 13555, time) local quantity = math.floor((getPlayerStorageValue(player,13555) - timenow)/(3600*24))
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem "..quantity.." dias de VIP Donate restantes.") else
setPlayerStorageValue(player, 13555, time)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(player)..";")
doRemoveCreature(player) end end
Eu usei a seguinte action e funcionou:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local days,removeOnUse = 7,true
local daysvalue = days * 24 * 60 * 60
local storageplayer = getPlayerStorageValue(cid, 13555)
local timenow = os.time()
local time = getPlayerStorageValue(cid, 13555) - os.time() <= 0 and timenow + daysvalue or storageplayer + daysvalue
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 13555, time)
local quantity = math.floor((getPlayerStorageValue(cid, 13555) - timenow)/(24 * 60 * 60))
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
if removeOnUse == true then doRemoveItem(item.uid, 1) end
return true
end
Porém ela não adiciona [Vip] ao nome do player que usou o item, ja tentei eu mesmo adicionar as linhas do comando /addvip porém o item não some quando uso, da maior confusão, então queria ajuda de vocês...
Obrigado desde já!