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

A easy script :D

Kaorus

Unleash Dreams Staff
Joined
May 18, 2008
Messages
1,111
Reaction score
41
Hello!
I need this script:

You open a item and this give a storage to open a door, etc, you only can open this item only once and you need other storage and a level (30,60) etc

Rep++ :peace:
 
Maybe i dont get what you want but try this
Put this for the box that you use
Lua:
local Levell = 60
local storage = 9989
function onUse(cid, item, frompos, item2, topos)
   if getPlayerStorageValue(cid,storage) == 1 then
      doPlayerSendTextMessage(cid, 27 , "You can use this only once.")
	return TRUE
   end
   if getPlayerLevel(cid) >= Levell and getPlayerStorageValue(cid,storage) ~= 1 then
     setPlayerStorageValue(cid,storage,1)
	 doPlayerSendTextMessage(cid, 24 , "You are able to open door now.")
	 doSendMagicEffect(getPlayerPosition(cid),14)
    return TRUE
   end
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 local reqStorage = 1234   -- Required storage to use the item.
  if ((getPlayerStorageValue(cid, reqStorage) > 0) and (getPlayerLevel(cid) > 29) and (getPlayerLevel(cid) < 61)) then
   local addStorage = 4321   -- Storage obtained after the use of the item.
   setPlayerStorageValue(cid, addStorage, 1)
  end
 return TRUE
end
 
Code:
local required, used, level = 1234, 5678, 60
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return TRUE, getPlayerStorageValue(cid, used) > 0 and doPlayerSendTextMessage(cid, 27, "You can use this only once.") or getPlayerStorageValue(cid, required) > 0 and getPlayerLevel(cid) >= level and getPlayerStorageValue(cid, used) < 1 and setPlayerStorageValue(cid, used, 1) and doPlayerSendTextMessage(cid, 24 , "You are able to open door now.") and doSendMagicEffect(getPlayerPosition(cid),14)
end
lololool
 
Code:
local required, used, level = 1234, 5678, 60
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return TRUE, getPlayerStorageValue(cid, used) > 0 and doPlayerSendTextMessage(cid, 27, "You can use this only once.") or getPlayerStorageValue(cid, required) > 0 and getPlayerLevel(cid) >= level and getPlayerStorageValue(cid, used) < 1 and setPlayerStorageValue(cid, used, 1) and doPlayerSendTextMessage(cid, 24 , "You are able to open door now.") and doSendMagicEffect(getPlayerPosition(cid),14)
end
lololool

Haha, this looks seriously like a code taken from some next release of TFS! :peace:

PS. International Obfuscated C Code Contest - Wikipedia, the free encyclopedia
 
@slawkens
Ah, okay.
I've been thinking about doing this to my codes lately, the ones I'll have on my OT that will be hosted by someone else.
So that they can't understand them/change them. ^_^
 
Almost readable:
Code:
local required, used, level =
	 1234, 	5678, 60
function onUse(cid, item, fromPosition, itemEx, toPosition)
return
	TRUE,
	getPlayerStorageValue(cid, used) > 0 and
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use this only once.")
	or
	(
		getPlayerStorageValue(cid, required) > 0 and
		getPlayerLevel(cid) >= level and
		getPlayerStorageValue(cid, used) < 1 and
		setPlayerStorageValue(cid, used, 1) and
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You are able to open door now.") and 
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
	)
end
 
Quite readable ._.

Also: linking integers.

Eg:

local zdf = cid
local zkdf = zdf
local zmrd = zkdf

and so on, on different parts of the code.
 
Code:
local required, used, level = 1234, 5678, 60
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return TRUE, getPlayerStorageValue(cid, used) > 0 and doPlayerSendTextMessage(cid, 27, "You can use this only once.") or getPlayerStorageValue(cid, required) > 0 and getPlayerLevel(cid) >= level and getPlayerStorageValue(cid, used) < 1 and setPlayerStorageValue(cid, used, 1) and doPlayerSendTextMessage(cid, 24 , "You are able to open door now.") and doSendMagicEffect(getPlayerPosition(cid),14)
end
lololool

This isn't worth lol'ing for, it's just annoying to read it you know? lol <-- omg o.o
 
Back
Top