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

Simple Script

Pro Warbringer

Retired with developing
Joined
Sep 23, 2008
Messages
3,582
Reaction score
25
Location
Austria
Well since i started to Lua some again and i forgot a lot and i want to ask you people is this correct :D or ive gotten rusty ;p

XXX - item id..

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == XXXX then
if getplayerLevel (cid) >= 50 then
doPlayerSendTextMessage (cid,21,"You Pulled the Mighty Lever")
else doPlayerSendCancel(cid,"You don't have the required level.")
end
if item.itemid == XXXX then
if getplayerLevel (cid) >= 50 then
doPlayerSendTextMessage (cid,21,"You Pulled the Mighty Lever")
else doPlayerSendCancel(cid,"You don't have the required level.")
end
end
return true
end


Kind Regard's
Pro Warbringer
 
Nice, but it's a simple script as you said. _/

But... what's going to happen after you pulled the mighty lever? :p

Also... did you followed the beginner tutorial? It looks like you did... xD

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doPlayerSendTextMessage(cid,21,"It works !")
	elseif item.itemid == 1946 then
		doPlayerSendTextMessage(cid,21,"You pulled it back!")
	end
	return TRUE
end -- Every Function has to have an own "end" too.
 
Would be better like this :)?

LUA:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
  local config = {
  item1 = XXXX,
  item2 = XXXX
  }
  
if item.itemid == config.item1 and getplayerLevel(cid) >= 50 then
	doPlayerSendTextMessage (cid,21,"You Pulled the Mighty Lever")
else 
	doPlayerSendCancel(cid,"You don't have the required level.")
end
if item.itemid == config.item2 and getplayerLevel(cid) >= 50 then
	doPlayerSendTextMessage (cid,21,"You Pulled the Mighty Lever")
else 
	doPlayerSendCancel(cid,"You don't have the required level.")
	end
		return TRUE
end

I mean, you was working but.. dont make spaces (gap) between the (cid)

and dont make
if ..... then
if .... then
you'll need a end for them both :p
because u can simply do

if .... and ... then :)
only 1 end :)
 
Back
Top