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

Error ;(

Marcinek123

Badboy
Joined
Jan 21, 2008
Messages
49
Reaction score
0
Location
Poland
I have this::thumbup:
Code:
function onUse(cid, item, fromPos, itemEx, toPos)
	text1 = ""
	text2 = ""
				
		if playerStorage(cid, getPlayerStorage) == 12345 
		doSetItemText(item.itemid, text1)
		doShowTextDialog(item.itemid, 0,0)
	end
		elseif
		doSetItemText(item.itemid, text2)
		doPlayerAddExp(cid, 5000)
		setPlayerStorage(cid, 12345)
		doShowTextDialog(item.itemid, 0,0)
	end
return 1
end
:blink:
What is wrong? :confused:
I have this error in console :
Warning: [Event::loadScript] Can not load script. data/actions/scripts/other/x.lua
[24/10/2008 21:12:20] data/actions/scripts/other/x.lua:6: 'then' expected near 'doSetItemText'
:eek:
Please fix it... :huh:
 
Code:
function onUse(cid, item, fromPos, itemEx, toPos)
text1 = ""
text2 = ""
   if playerStorage(cid, getPlayerStorage) == 12345 
      doSetItemText(item.itemid, text1)
      doShowTextDialog(item.itemid, 0,0)
   else
      doSetItemText(item.itemid, text2)
      doPlayerAddExp(cid, 5000)
      setPlayerStorage(cid, 12345)
      doShowTextDialog(item.itemid, 0,0)
   end
   return 1
end

This is my first real LUA try. :p So it could be wrong... :p Probably it's wrong :p
 
@up
nope

Code:
function onUse(cid, item, fromPos, itemEx, toPos)
    local getPlayerStorage = 1111
    local playerStorage = getPlayerStorageValue(cid, getPlayerStorage)
text1 = ""
text2 = ""
   if playerStorage(cid, getPlayerStorage) == 12345 [b]then[/b]
      doSetItemText(item.itemid, text1)
      doShowTextDialog(item.itemid, 0,0)
   else
      doSetItemText(item.itemid, text2)
      doPlayerAddExp(cid, 5000)
      setPlayerStorage(cid, 12345)
      doShowTextDialog(item.itemid, 0,0)
   end
   return 1
end

also, playerStorage and getPlayerStorage were nil.
 
@up

you made it so it trys to call the function playerStorage.

Also teh set Storage is wrong

This one should work
PHP:
function onUse(cid, item, fromPos, itemEx, toPos)
    local getPlayerStorage = 1111
    text1 = ""
    text2 = ""
   if getPlayerStorageValue(cid, getPlayerStorage) == 12345 then
      doSetItemText(item.itemid, text1)
      doShowTextDialog(item.itemid, 0,0)
   else
      doSetItemText(item.itemid, text2)
      doPlayerAddExp(cid, 5000)
      setPlayerStorageValue(cid, getPlayerStorage, 12345)
      doShowTextDialog(item.itemid, 0,0)
   end
   return 1
end
 
Back
Top