DG

Script Que Baixe Promotion De 2 Para 1 Caso Player Esteja Free Account

By dgprado, 03 de jan. de 2010 in Archived

script
7
1.9k
dgpradoD
03 de janeiro de 2010 às 04:50

Primeiro vou explicar a situaçao.No meu server players free account podem comprar promo, porem para os premium account existe um npc em area premium que vende a segunda promotion como no config esta setado free promotion, quando acaba a premium tenho que tirar manualmente a promo de todos os chars da conta, o que e muito inconveniente, pois tenho que ficar sempre cuidando as premiuns que estao prestes a expirar.

 

Seria possvel algum scripter fazer caso ja nao o tenha, um script que sempre que um char loga, verifique o campo premdays da tabela accounts e caso esteja = 0 e o campo promotion da tabela players = 2 setar para = 1 ?

 

Com certeza seia de grande valia nao apenas para mim, mas para muitos adm's.

Obs: uso TFS 0.3.6 8.54 e db mysql xampp

 

Thx

Edited Janeiro 3 by dgprado

KydraiK
03 de janeiro de 2010 às 14:32

Se ja tiver o login.lua pode colocar la dentro, só vai precisar tirar a primeira e ultima linha.

 

function onLogin(cid)
if not(isPremium(cid)) and getPlayerPromotionLevel(cid) == 2 then
	doPlayerSetPromotionLevel(cid, 1)
end
end

Edited Janeiro 3 by kydrai

kkk111K
03 de janeiro de 2010 às 20:49

LOL LOL LOL

 

Em config.lua

 

premiumForPromotion = true

dgpradoD
03 de janeiro de 2010 às 23:41

LOL LOL LOL

 

Em config.lua

 

premiumForPromotion = true

 

LOL LOL LOL digo eu , le direito que vc vai entender, no meu ot o sistema vip e baseado na premium, porem free accounts podem comprar a 1 promotion, e os premiuns podem ter acesso a 2° promo na area premium. entao quando acabar a premium eles seguirao com 2 vocaçao.No meu server vc ja cria o char elite, elder, master, ou royal. dae mesmo free pode comprar epic, e se for premium uma 2° vocaçao.

 

@kydrai

Vou testar, acredito q seja isso mesmo, valeu mano,Depois qeu eu testar posto aki o resultado.

dgpradoD
05 de janeiro de 2010 às 16:43

Ae bro, testei aki e deu o seguinte erro,nenhum char conseguia logar, no gui aparecia:

fulano logue in

fulano logued out

 

beltrano logue in

beltrano logued out

tentei adicionar de varias forma no loguin.lua sempre dando este erro.Vou postar aki o meu loguin.lua se voce poder editar ele para mim , ficaria muito agradecido.

 

local config = {

loginMessage = getConfigValue('loginMessage'),

useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))

}

 

function onLogin(cid)

local loss = getConfigValue('deathLostPercent')

if(loss ~= nil) then

doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)

 

end

 

local accountManager = getPlayerAccountManager(cid)

if(accountManager == MANAGER_NONE) then

local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage

if(lastLogin > 0) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."

else

str = str .. " Please choose your outfit."

doPlayerSendOutfitWindow(cid)

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

elseif(accountManager == MANAGER_NAMELOCK) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")

elseif(accountManager == MANAGER_ACCOUNT) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")

end

 

if(not isPlayerGhost(cid)) then

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

end

 

registerCreatureEvent(cid, "Mail")

registerCreatureEvent(cid, "GuildMotd")

 

registerCreatureEvent(cid, "Idle")

if(config.useFragHandler) then

registerCreatureEvent(cid, "SkullCheck")

end

 

registerCreatureEvent(cid, "ReportBug")

registerCreatureEvent(cid, "AdvanceSave")

registerCreatureEvent(cid, "ArenaKill")

registerCreatureEvent(cid, "KillingInTheNameOf")

return true

end

 

Valeu.

KydraiK
05 de janeiro de 2010 às 16:59

Eu testei aqui no 0.3.5 e funfo.

local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
if not(isPremium(cid)) and getPlayerPromotionLevel(cid) == 2 then
doPlayerSetPromotionLevel(cid, 1)
end
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)

end

local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")

registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end

registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "ArenaKill")
registerCreatureEvent(cid, "KillingInTheNameOf") 
return true
end

dgpradoD
06 de janeiro de 2010 às 16:04

Perfeito cara, muito obrigado.

Problema resolvido.