• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent System to lose premiums privileges

Shalk

Royal Angels ATS
Joined
Sep 19, 2007
Messages
214
Reaction score
4
Location
Brazil
Hello guys, this script will change town to "1", teleport player to temple and clean your house and send your items to depot.
Is a simple script, I know that is large and could be reduced, if anyone has any idea to improve it post here.
Tested on TFS 0.4 put should work on others for its simplicity!


add this to your lib/function.lua:
Code:
function doRemoveHouse(cid)
local pid = getPlayerGUID(cid)
cleanHouse(getHouseByPlayerGUID(pid))
setHouseOwner(getHouseByPlayerGUID(pid), NO_OWNER_PHRASE,true)
return TRUE
end

add in data/creaturescripts/scripts/login.lua after function onLogin(cid)
Code:
if(getPlayerPremiumDays(cid) >= 1 and getPlayerStorageValue(cid, 759759) <= 0) then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Activate premium privileges.")
setPlayerStorageValue(cid, 759759, 1)
doSendMagicEffect(getCreaturePosition(cid), 50)

end
local pid = getPlayerGUID(cid)
[COLOR="#0000FF"]local pos = {x = 674, y = 588, z = 7} -- position that the player will be teleported[/COLOR]
[COLOR="#FF0000"]local town = 1 -- City of free town.[/COLOR]
if(getHouseByPlayerGUID(pid) and getPlayerPremiumDays(cid) == 0 and getPlayerStorageValue(cid, 759759) >= 1) then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You loose a premium privileges, items were  of your home sent for your  depot.")
setPlayerStorageValue(cid, 759759, -1)
doTeleportThing(cid, pos)
doPlayerSetTown(cid, town)
doSendMagicEffect(getCreaturePosition(cid), 50)
cleanHouse(getHouseByPlayerGUID(pid))
setHouseOwner(getHouseByPlayerGUID(pid), NO_OWNER_PHRASE,true)

end

if(getPlayerPremiumDays(cid) == 0 and getPlayerStorageValue(cid, 759759) >= 1) then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You loose a premium privileges.")
setPlayerStorageValue(cid, 759759, -1)
doTeleportThing(cid, pos)
doPlayerSetTown(cid, town)
doSendMagicEffect(getCreaturePosition(cid), 50)
end


Configuration:
local pos = position that the player will be teleported
local town = id of free town

Credits
  • Shalk (formulate the script)
  • Vodkart (Xtibia forum, For LIB funcion)


Sorry for my bad english, REP ++
 
Last edited:
Nice I've been looking for something like this, but... it doesn't work.
When premium player login for the first time it does make the tera effect but when a free player logs in it doesn't remove their house nor send their things to the depot.
Could you fix this? I'm using TFS .4
 
I hate codes without tabs, and also i added a missing 'end'

Pd: You created function 'doRemoveHouse' but you still use 'cealnHouse' and 'setHouseOwner', used the function now.

Lua:
function doRemoveHouse(cid)
	local pid = getPlayerGUID(cid)
	cleanHouse(getHouseByPlayerGUID(pid))
	setHouseOwner(getHouseByPlayerGUID(pid), NO_OWNER_PHRASE, true)
	return true
end
Lua:
function doRemoveHouse(cid)
	local pid = getPlayerGUID(cid)
	cleanHouse(getHouseByPlayerGUID(pid))
	setHouseOwner(getHouseByPlayerGUID(pid), NO_OWNER_PHRASE, true)
	return true
end

if getPlayerPremiumDays(cid) >= 1 and getPlayerStorageValue(cid, 759759) <= 0 then
	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Activate premium privileges.")
	setPlayerStorageValue(cid, 759759, 1)
	doSendMagicEffect(getCreaturePosition(cid), 50)
end

local pid = getPlayerGUID(cid)
local town = 1 -- City of free town.
local pos = getTownTemplePosition(town) -- position that the player will be teleported
if getHouseByPlayerGUID(pid) and getPlayerPremiumDays(cid) < 1 and getPlayerStorageValue(cid, 759759) >= 1 then
	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You loose a premium privileges, items were  of your home sent for your  depot.")
	setPlayerStorageValue(cid, 759759, -1)
	doTeleportThing(cid, pos)
	doPlayerSetTown(cid, town)
	doSendMagicEffect(getCreaturePosition(cid), 50)
	cleanHouse(getHouseByPlayerGUID(pid))
	setHouseOwner(getHouseByPlayerGUID(pid), NO_OWNER_PHRASE,true)
end

if getPlayerPremiumDays(cid) < 1 and getPlayerStorageValue(cid, 759759) >= 1 then
	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You loose a premium privileges.")
	setPlayerStorageValue(cid, 759759, -1)
	doTeleportThing(cid, pos)
	doPlayerSetTown(cid, town)
	doSendMagicEffect(getCreaturePosition(cid), 50)
end
 
Nice I've been looking for something like this, but... it doesn't work.
When premium player login for the first time it does make the tera effect but when a free player logs in it doesn't remove their house nor send their things to the depot.
Could you fix this? I'm using TFS .4

friend, try using the script that neomaximus13 posted, the version I used this script was the tfs 0.4 [8.7], strange error.
 
Back
Top