• 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!

Area check if player is premium or not, is he doesnt - teleported.

Status
Not open for further replies.

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
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?
 
LUA:
function onStepIn(cid, item, position, fromPosition)
	local newPos = {x = 1000, y = 1000, z = 7, stackpos = 1}
	if isPremium(cid) == false then
		doTeleportThing(cid, newPos)
	end
	return true
end
 
couldn't find so I made one for you instead :p

I think this is more simple instead of checking an area too :p. But maybe you just want it to react on a certain area? :s

data/creaturescripts/scripts/script-name.lua
Code:
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
data/creaturescripts/creaturescripts.xml
Code:
<event type="login" name="premEnd" event="script" value="script-name.lua"/>
 
Last edited:
@Slaktaren
Thanks, the idea of adding a storage would be if the player is not premmy, and already have the storage, he wont teleport, but what will happen if the player has premium for second time, then the storage value will be 1, so if the premium is over, it won't teleport him, so Im guessing that there is a missing part that should be:

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

Or Im wrong?
 
soSendMagicEffect(getCreaturePosition(cid), cfg.effect)

it should be doSendMagicEffect(getCreaturePosition(cid), cfg.effect)
 
Status
Not open for further replies.
Back
Top