• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

LUA Problem

Synergy

New Member
Joined
Nov 24, 2011
Messages
334
Reaction score
0
Whats wrong with this script?



function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
config = {
storage = 34344,


if(getPlayerStorageValue(cid, config.storage) > 0) then
doCreatureSay(cid, "Welcome adventurer!", TALKTYPE_MONSTER)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
setPlayerStorageValue(cid, config.storage, 1)
end
end
 
You didn't close config, but if you have one variable, you don't need it to be a table.

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
storage = 34344

if(getPlayerStorageValue(cid, storage) > 0) then
doCreatureSay(cid, "Welcome adventurer!", TALKTYPE_MONSTER)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
setPlayerStorageValue(cid, storage, 1)
end
end

Else, if you want it to be a table, then yeah, you need to close it.

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
config = {
storage = 34344}

if(getPlayerStorageValue(cid, config.storage) > 0) then
doCreatureSay(cid, "Welcome adventurer!", TALKTYPE_MONSTER)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
setPlayerStorageValue(cid, config.storage, 1)
end
end
 
The script look nice for first lua script but you just missed a bracket and remove a comma:
LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
config = {
storage = 34344
}


if(getPlayerStorageValue(cid, config.storage) > 0) then
doCreatureSay(cid, "Welcome adventurer!", TALKTYPE_MONSTER)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
setPlayerStorageValue(cid, config.storage, 1)
end
return true
end

Oops, Evan was first :D
 
Back
Top