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

TalkAction Teleport Players with Storage Value to Town

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
PHP:
/tp <storage>, <town>
This was requested by somebody and I thought it might be useful for others as well.
It will teleport anyone with that storage value to that town.


data/talkactions/talkactions.xml
Code:
<talkaction log="yes" words="/tp" access="5" event="script" value="tp.lua"/>

data/talkactions/scripts/tp.lua
Code:
function onSay(cid, words, param, channel)
	local p = string.explode(param, ',')
	local storage = tonumber(p[1])
	if storage then
		for _, cid in ipairs(getPlayersOnline()) do
			if(getPlayerStorageValue(cid, storage) == 1) then
				doTeleportThing(cid, getTownTemplePosition(getTownId(p[2])))
			end
		end
	else
		doPlayerSendCancel(cid, "Sorry, you must enter a storage type.")
	end
	return true
end
 
Last edited:
instead TOWN_ID do TOWN_NAME (it is stupid to learning towns id of ur ot)

and use: getTownTemplePosition(getTownId(p[2]))

;)
 
I guess that's simpler, done.
 
Make a script where you get x item and use it to teleport to x pos or town id.

eg. item looted from quest also sets storage, player can use if he has completed the quest.
a player that hasnt done the quest uses the item from another player and cant teleport as they havent got the storage from completing the quest
 
what does storevalue stand for and where can i find it while using TFS 0.3...pl1?
 
what does storevalue stand for and where can i find it while using TFS 0.3...pl1?

Simple terms?

Do you know when you complete the "Anni" quest, it tells you "You can't do it again." That is because you have received that storage for completing that quest. That is why I made this, I thought that maybe there could be an event for "VIP" players and it would be easy to bring them all to one position.

Code:
getPlayerStorageValue(cid, storage)
setPlayerStorageValue(cid, storage)

Regards,
JDB.
 
Code:
function onSay(cid, words, param, channel)
	local p = string.explode(param, ',')
	local target = getPlayerByNameWildcard(p[1])
	return getPlayerStorageValue(target, p[2]) == 1 and doTeleportThing(target, getTownTemplePosition(getPlayerTown(target))) or doPlayerSendCancel(cid, "Sorry, you must enter a storage type.")
end
no need for loop :S
 
Code:
function onSay(cid, words, param, channel)
	local p = string.explode(param, ',')
	local target = getPlayerByNameWildcard(p[1])
	return getPlayerStorageValue(target, p[2]) == 1 and doTeleportThing(target, getTownTemplePosition(getPlayerTown(target))) or doPlayerSendCancel(cid, "Sorry, you must enter a storage type.")
end
no need for loop :S

You fail.
 
Back
Top