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

gravestone TFS 0.3.4 pleaseee

loginoob

New Member
Joined
Feb 6, 2008
Messages
93
Reaction score
0
Location
Brazil
local roomPos =
{
x = 65,
y = 246,
z = 11
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 30330 then
if getPlayerStorageValue(cid, 20000) == TRUE then
doTeleportThing(cid, roomPos, TRUE)
doSendMagicEffect(roomPos, CONST_ME_TELEPORT)
elseif getPlayerStorageValue(cid, 20000) == FALSE then
doPlayerSendCancel(cid, "Sorry, not possible.")
if getPlayerStorageValue(cid, 20001) == TRUE then
doTeleportThing(cid, roomPos, TRUE)
doSendMagicEffect(roomPos, CONST_ME_TELEPORT)
elseif getPlayerStorageValue(cid, 20001) == FALSE then
doPlayerSendCancel(cid, "Sorry, not possible.")
if getPlayerStorageValue(cid, 20002) == TRUE then
doTeleportThing(cid, roomPos, TRUE)
doSendMagicEffect(roomPos, CONST_ME_TELEPORT)
elseif getPlayerStorageValue(cid, 20002) == FALSE then
doPlayerSendCancel(cid, "Sorry, not possible.")
if getPlayerStorageValue(cid, 20003) == TRUE then
doTeleportThing(cid, roomPos, TRUE)
doSendMagicEffect(roomPos, CONST_ME_TELEPORT)
elseif getPlayerStorageValue(cid, 20003) == FALSE then
doPlayerSendCancel(cid, "Sorry, not possible.")
end
end
end
end
end
return TRUE
end
Convert for TFS 0.3.4 Pleaseeee
 
in storages, don't use TRUE or FALSE, use "== 1" or "== nil" or "> 0" or "< 1".. how you want. Example
Lua:
if getPlayerStorageValue(cid, storage) == nil then --if player don't have the storage
Lua:
if getPlayerStorageValue(cid, storage) == 1 then --if player have storage
Etc...
 
in storages, don't use TRUE or FALSE, use "== 1" or "== nil" or "> 0" or "< 1".. how you want. Example
Lua:
if getPlayerStorageValue(cid, storage) == nil then --if player don't have the storage
Lua:
if getPlayerStorageValue(cid, storage) == 1 then --if player have storage
Etc...

I don't think that's the reason, because they're working fine for me with == TRUE/FALSE

@Ontopic
There could be several reasons:
  1. Gravestone's Unique ID is not 30330
  2. The player does not have the storage values (20000 - 20003) set to 1
  3. roomPos is not a valid position
Changed the script:
Lua:
local roomPos =
{
x = 65,
y = 246,
z = 11
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 30330 then
		if getPlayerStorageValue(cid, 20000) == 1 and getPlayerStorageValue(cid, 20001) == 1 and getPlayerStorageValue(cid, 20002) == 1 and getPlayerStorageValue(cid, 20003) == 1 then
			doTeleportThing(cid, roomPos, TRUE)
			doSendMagicEffect(roomPos, CONST_ME_TELEPORT)
		elseif getPlayerStorageValue(cid, 20000) ~= 1 or getPlayerStorageValue(cid, 20001) ~= 1 or getPlayerStorageValue(cid, 20002) ~= 1 or getPlayerStorageValue(cid, 20003) ~= 1 then
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
	end
	return TRUE
end

You should explain better how the script should work; does the player need all storage values set to 1 to be teleported, or he/she will be teleported if any of them are set to 1?
 
Cykotitians script...
First of all dont use item.uid since u can place this in actions.xml.

For the second, use for i to check more than 1 storage ^^

Script...

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local roomPos = {x = 65, y = 246, z = 11}
local storages = {
20000,
20001,
20002,
20003
}
	for i = 1, #storages do
		if getPlayerStorageValue(cid, storages[i]) == 1 then			
			doSendMagicEffect(cid, CONST_ME_POFF)
			doTeleportThing(cid, roomPos)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
		else
			doPlayerSendCancel(cid, "This is a secret grave")
			end
		end
	return TRUE
end
Not tested.
 
Back
Top