kito2
www.masteria.net
Like topic name says, how to make an area that check if the player is premium, if he doesnt, he is teleported to x, y, z coords.
Someone please?
Someone please?
function onLogin(cid)
local cfg = {
storage = 1234, -- self explained
premEnd_msg = "Your premium has ended!", -- also self explained xD
msg_type = MESSAGE INFO DESCR, -- Message type when your prem ends
premEnd_town_id = 1, -- Town to get teleported to when your prem ends. Will also set your home town to this id
effect = CONST_ME_TELEPORT, -- Effect when you get teleported
}
if not isPremium(cid) then
if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
doTeleportThing(cid, getTownTemplePosition(cfg.premEnd_town_id), FALSE)
soSendMagicEffect(getCreaturePosition(cid), cfg.effect)
doPlayerSendTextMessage(cid, cfg.msg_type, cfg.premEnd_msg)
setPlayerStorageValue(cid, cfg.storage, 1)
doPlayerSetTown(cid, cfg.premEnd_town_id)
end
end
if isPremium(cid) then
if getPlayerStorageValue(cid, cfg.storage) == 1 then
setPlayerStorageValue(cid, cfg.storage, 0)
end
end
end
<event type="login" name="premEnd" event="script" value="script-name.lua"/>
function onLogin(cid)
local cfg = {
storage = 1234, -- self explained
premEnd_msg = "Your premium has ended!", -- also self explained xD
msg_type = MESSAGE INFO DESCR, -- Message type when your prem ends
premEnd_town_id = 1, -- Town to get teleported to when your prem ends. Will also set your home town to this id
effect = CONST_ME_TELEPORT, -- Effect when you get teleported
}
if not isPremium(cid) then
if getPlayerStorageValue(cid, cfg.storage) ~= 1 then
doTeleportThing(cid, getTownTemplePosition(cfg.premEnd_town_id), FALSE)
soSendMagicEffect(getCreaturePosition(cid), cfg.effect)
doPlayerSendTextMessage(cid, cfg.msg_type, cfg.premEnd_msg)
setPlayerStorageValue(cid, cfg.storage, 1)
doPlayerSetTown(cid, cfg.premEnd_town_id)
end
end
if isPremium(cid) then
if getPlayerStorageValue(cid, cfg.storage) == 1 then
setPlayerStorageValue(cid, cfg.storage, -1)
end
end