Jump to content
  • 0

[Ajuda] Premium System


zNegativeX

Question

Alguém poderia ajudar meu servidor não tem o comando /addvip, mais sabendo que tem o vip pois tem um tile que a action=5955

e quando tento passar da isso: Somente Premium Accounts. Adquira sua VIP

queria saber como adicionar o comando /addvip para adicionar o vip ao player ;)

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Seria algo assim?

function onSay(cid, words, param)


access = 3 -- não mude
days = 30 -- quantidade de dias


player = getPlayerByName(param)
daysvalue = days*3600*24
storageplayer = getPlayerStorageValue(player,13540)
timenow = os.time()
if storageplayer == -1 or storageplayer == 0 then
time = timenow+daysvalue
else
time = storageplayer+daysvalue
end


if param ~= "" then
if getPlayerGroupId(cid) >= access then
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(player,13540,time)
quantity = math.floor((getPlayerStorageValue(player,13540) - timenow)/(3600*24))
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Somente jogadores com acesso maior que "..access.." podem adicionar vips.")
end

end

end

xml

<talkaction log="yes" words="/vip" access="5" event="script" value="vip/addvipp.lua" />
Link to comment
Share on other sites

  • 0

Amigo deu isto

[16/01/2016 13:44:30] [Error - TalkAction Interface]

[16/01/2016 13:44:30] data/talkactions/scripts/addvip.lua:onSay
[16/01/2016 13:44:30] Description:
[16/01/2016 13:44:30] data/talkactions/scripts/addvip.lua:15: attempt to perform arithmetic on global 'storageplayer' (a boolean value)
[16/01/2016 13:44:30] stack traceback:
[16/01/2016 13:44:30] data/talkactions/scripts/addvip.lua:15: in function <data/talkactions/scripts/addvip.lua:1>
Link to comment
Share on other sites

  • 0

Desculpa é que esqueci de mandar o registro:

 

tenta além do script que te passei usar esse aqui,

 

creaturescript

function onLogin(cid)
        local temple = { x =160, y = 51, z = 7}
        if vip.hasVip(cid) == true then
                if getPlayerStorageValue(cid,55555) ~= 1 then
                        setPlayerStorageValue(cid,55555,1)
                end
        else
                if getPlayerStorageValue(cid,55555) == 1 then
                        doTeleportThing(cid, temple)
                        doPlayerSendTextMessage(cid, 22, "Your VIP Time over!")
                        db.query("UPDATE `accounts` SET `vip_time` = 0 WHERE `id` = ".. getAccountIdByName(getPlayerName(cid)) ..";")
                        setPlayerPromotionLevel(cid, 1)
                        setPlayerStorageValue(cid, 55555, 0)
                end
        end
        return true
end

tag do login

registerCreatureEvent(cid, "FimVip")

tag do xml

 

<event type="login" name="FimVip" event="script" value="vip2.lua"/>
tem mais, coloca mais essa aqui;
function onLogin(cid)
registerCreatureEvent(cid, "Exp_P")
if getPlayerStorageValue(cid, death_tabble.check) >= 1 then
setPlayerStorageValue(cid, death_tabble.after_exp, getPlayerExperience(cid))
setPlayerStorageValue(cid, death_tabble.check, -1)
end
return true
end
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
setPlayerStorageValue(cid, death_tabble.before_exp, getPlayerExperience(cid))
setPlayerStorageValue(cid, death_tabble.check, 1)
return TRUE
end

xml


<event type="preparedeath" name="Exp_P" event="script" value="vipname.lua"/>

acho q agora vai dar, caso persista no erro avisa aqui, ai deve ter q fazer algo na lib

 

Link to comment
Share on other sites

  • 0

Deu o seguinte erro

 

 

[16/01/2016 17:05:05] [Error - CreatureScript Interface]
[16/01/2016 17:05:05] data/creaturescripts/scripts/vip2.lua:onLogin
[16/01/2016 17:05:05] Description:
[16/01/2016 17:05:05] data/creaturescripts/scripts/vip2.lua:3: attempt to index global 'vip' (a nil value)
[16/01/2016 17:05:05] stack traceback:
[16/01/2016 17:05:05] data/creaturescripts/scripts/vip2.lua:3: in function <data/creaturescripts/scripts/vip2.lua:1>

e continua o mesmo erro anterior na hora de dar /addvip

 

Link to comment
Share on other sites

  • 0

Vip tile:

function onStepIn(cid, item, position, fromPosition)
nv = "Mensagem"
if getPlayerVipDays(cid) == 0 then
doTeleportThing(cid, fromPosition, FALSE)
doPlayerSendTextMessage(cid, 22, nv)
end
return true
end

Tag no movemments:

<movevent type="StepIn" actionid="id" event="script" value="arqivo"/> 

Comando:

function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Falta o nick.")
return true
end

local t = string.explode(param, ",")
t[1] = tonumber(t[1])
if(not t[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Falta o numero de dias.")
return true
end

local pid = cid
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nickname " .. t[2] .. " Nao encontrado.")
return true
end
end

if(t[1] > 365) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "So pode adicionar 365 Dias.")
return true
end

sender = getPlayerByNameWildcard(cid)

doAddVipDays(pid, t[1])
doPlayerSendTextMessage(cid, "Voce Adicionou ".. t[1] .." dias de vip para ".. t[2])
doPlayerSendTextMessage(pid, sender .." adicionou ".. t[1] .." dias de vip para você.") 
return true
end

Tag no Talkactions.xml:

<talkaction log="yes" words="/addvip" access="5" event="script" value="nomedoarquivo"/>
Link to comment
Share on other sites

  • 0

Sim eu fiz assim /addvip meu nick,3

e ainda diz que falta o número de dias

 

Um momento.

function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Falta o nick.")
return true
end

local t = string.explode(param, ",")
t[2] = tonumber(t[2])
if(not t[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Falta o numero de dias.")
return true
end

local pid = cid
if(t[1]) then
pid = getPlayerByNameWildcard(t[1])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nickname " .. t[1] .. " Nao encontrado.")
return true
end
end

if(t[2] > 365) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "So pode adicionar 365 Dias.")
return true
end

sender = getPlayerByNameWildcard(cid)

doAddVipDays(pid, t[2])
doPlayerSendTextMessage(cid, "Voce Adicionou ".. t[2] .." dias de vip para ".. t[1])
doPlayerSendTextMessage(pid, sender .." adicionou ".. t[2] .." dias de vip para você.") 
return true
end
Link to comment
Share on other sites

  • 0
[Error - TalkAction Interface]

[30/01/2016 12:29:31] data/talkactions/scripts/addvip.lua:onSay

[30/01/2016 12:29:31] Description:

[30/01/2016 12:29:31] data/talkactions/scripts/addvip.lua:30: attempt to call global 'doAddVipDays' (a nil value)

[30/01/2016 12:29:31] stack traceback:

[30/01/2016 12:29:31] data/talkactions/scripts/addvip.lua:30: in function <data/talkactions/scripts/addvip.lua:1>

Link to comment
Share on other sites

  • 0

 

[Error - TalkAction Interface]
[30/01/2016 12:29:31] data/talkactions/scripts/addvip.lua:onSay
[30/01/2016 12:29:31] Description:
[30/01/2016 12:29:31] data/talkactions/scripts/addvip.lua:30: attempt to call global 'doAddVipDays' (a nil value)
[30/01/2016 12:29:31] stack traceback:
[30/01/2016 12:29:31] data/talkactions/scripts/addvip.lua:30: in function <data/talkactions/scripts/addvip.lua:1>
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Falta o nick.")
return true
end

local t = string.explode(param, ",")
t[2] = tonumber(t[2])
if(not t[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Falta o numero de dias.")
return true
end

local pid = cid
if(t[1]) then
pid = getPlayerByName(t[1])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nickname " .. t[1] .. " Nao encontrado.")
return true
end
end

if(t[2] > 365) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "So pode adicionar 365 Dias.")
return true
end

sender = getPlayerByName(cid)

doAddVipDays(pid, t[2])
doPlayerSendTextMessage(cid, "Voce Adicionou ".. t[2] .." dias de vip para ".. t[1])
doPlayerSendTextMessage(pid, sender .." adicionou ".. t[2] .." dias de vip para você.") 
return true
end
Edited by Danny0
Link to comment
Share on other sites

×
×
  • Create New...