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

Can Anyone fix my script?

legolas23

New Member
Joined
Jan 8, 2009
Messages
537
Reaction score
3
Code:
local weapon =
{
    sorcerer = 2187,
    druid =    2183,
    paladin = 8849,
    knight = 2392,2436,2432
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isSorcerer(cid) then
        doPlayerAddItem(cid, weapon.sorcerer, 1)
        setPlayerStorageValue(cid,11300,1)
        doPlayerSendTextMessage(cid,22,"Have a good fun!")
    elseif
        getPlayerStorageValue(cid,9999) == -1 then
        doPlayerSendTextMessage(cid,22,"You've got you prize already")    
    elseif isDruid(cid) then 
        doPlayerAddItem(cid, weapon.druid, 1)
        setPlayerStorageValue(cid,11300,1)
        doPlayerSendTextMessage(cid,22,"Have a good fun!")
    elseif
        getPlayerStorageValue(cid,9999) == -1 then
        doPlayerSendTextMessage(cid,22,"You've got you prize already")
    elseif isPaladin(cid) then
        doPlayerAddItem(cid, weapon.paladin, 1)
        setPlayerStorageValue(cid,11300,1)
        doPlayerSendTextMessage(cid,22,"Have a good fun!")
    elseif
        getPlayerStorageValue(cid,9999) == -1 then
        doPlayerSendTextMessage(cid,22,"You've got you prize already")
    else
        doPlayerAddItem(cid, weapon.knight, 1)
        setPlayerStorageValue(cid,11300,1)
        doPlayerSendTextMessage(cid,22,"Have a good fun!")
    elseif
        getPlayerStorageValue(cid,9999) == -1 then
        doPlayerSendTextMessage(cid,22,"You've got you prize already")
    end
    

end

Bug in tfs
Code:
[02/05/2009 23:49:23] [Warning - Event::loadScript] Can not load script (data/actions/scripts/quests/20levs.lua)
[02/05/2009 23:49:23] data/actions/scripts/quests/20levs.lua:36: 'end' expected (to close 'if' at line 11) near 'elseif'


Rep ++ for help
 
ewwy
Lua:
local weapon =
{
    sorcerer = 2187,
    druid =    2183,
    paladin = 8849,
    knight = {2392, 2436, 2432}
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,11300) == -1 then
    if isSorcerer(cid) then
        doPlayerAddItem(cid, weapon.sorcerer, 1)
    elseif isDruid(cid) then 
        doPlayerAddItem(cid, weapon.druid, 1)
    elseif isPaladin(cid) then
        doPlayerAddItem(cid, weapon.paladin, 1)
    elseif isKnight(cid) then
	for i = 1, table.maxn(weapon.knight) do
			doPlayerAddItem(cid, weapon.knight[i], 1)
	end
    end
	setPlayerStorageValue(cid,11300,1)
        doPlayerSendTextMessage(cid,22,"Have a good fun!")
	    else
        doPlayerSendTextMessage(cid,22,"You've got you prize already")    
	end
end
Try that.
 
Code:
[03/05/2009 10:16:24] [Warning - Event::loadScript] Can not load script (data/actions/scripts/quests/20levs.lua)
[03/05/2009 10:16:24] data/actions/scripts/quests/20levs.lua:30: '<eof>' expected near 'end'


Still not working
 
There shouldn't have errors it is fine and i tested:

PHP:
  local weapon = {
    sorcerer = 2187,
    druid =    2183,
    paladin = 8849,
    knight = {2392, 2436, 2432}
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid,11300) == -1 then
		if isSorcerer(cid) == TRUE then
			doPlayerAddItem(cid, weapon.sorcerer, 1)
		elseif isDruid(cid) == TRUE then
			doPlayerAddItem(cid, weapon.druid, 1)
		elseif isPaladin(cid) == TRUE then
			doPlayerAddItem(cid, weapon.paladin, 1)
		elseif isKnight(cid) == TRUE then
			for i = 1, table.maxn(weapon.knight) do
                doPlayerAddItem(cid, weapon.knight[i], 1)
			end
		end
			setPlayerStorageValue(cid,11300,1)
			doPlayerSendTextMessage(cid,22,"Have a good fun!")
    else
        doPlayerSendTextMessage(cid,22,"You've got you prize already")    
    end
end
 
Can any1 fix very simmilar script?

Code:
  local weapon = {
    sorcerer = (2190, 2160)
    druid = (2182, 2160)
    paladin = 2160
    knight = {2383, 2428, 2439, 2160}
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid,11301) == -1 then
        if isSorcerer(cid) == TRUE then
        for i = 1, table.maxn(weapon.sorcerer) do
            doPlayerAddItem(cid, weapon.sorcerer, 1)
        elseif isDruid(cid) == TRUE then
        for i = 1, table.maxn(weapon.druid) do
            doPlayerAddItem(cid, weapon.druid, 1)
        elseif isPaladin(cid) == TRUE then
            doPlayerAddItem(cid, weapon.paladin, 1)
        elseif isKnight(cid) == TRUE then
            for i = 1, table.maxn(weapon.knight) do
                doPlayerAddItem(cid, weapon.knight[i], 1)
            end
        end
            setPlayerStorageValue(cid,11301,1)
            doPlayerSendTextMessage(cid,22,"Have a good fun!")
    else
        doPlayerSendTextMessage(cid,22,"You've got you prize already")    
    end
end


Code:
[03/05/2009 11:30:52] [Warning - Event::loadScript] Can not load script (data/actions/scripts/quests/templequest.lua)
[03/05/2009 11:30:52] data/actions/scripts/quests/templequest.lua:2: ')' expected near ','
 
local weapon = {
sorcerer = {2190, 2160},
druid = {2182, 2160},
paladin = 2160,
knight = {2383, 2428, 2439, 2160}
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,11301) == -1 then
if isSorcerer(cid) == TRUE then
for i = 1, table.maxn(weapon.sorcerer) do
doPlayerAddItem(cid, weapon.sorcerer, 1)
elseif isDruid(cid) == TRUE then
for i = 1, table.maxn(weapon.druid) do
doPlayerAddItem(cid, weapon.druid, 1)
elseif isPaladin(cid) == TRUE then
doPlayerAddItem(cid, weapon.paladin, 1)
elseif isKnight(cid) == TRUE then
for i = 1, table.maxn(weapon.knight) do
doPlayerAddItem(cid, weapon.knight, 1)
end
end
setPlayerStorageValue(cid,11301,1)
doPlayerSendTextMessage(cid,22,"Have a good fun!")
else
doPlayerSendTextMessage(cid,22,"You've got you prize already")
end
end


I am not sure if this will work, but it will probably will..
 
Nah Sir Shutter's won't work.

You forgot to end the first 2 "for" statements.

Lua:
 local weapon = {
    sorcerer = (2190, 2160)
    druid = (2182, 2160)
    paladin = 2160
    knight = {2383, 2428, 2439, 2160}
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid,11301) == -1 then
        if isSorcerer(cid) == TRUE then
        for i = 1, table.maxn(weapon.sorcerer) do
            doPlayerAddItem(cid, weapon.sorcerer, 1)
			end
        elseif isDruid(cid) == TRUE then
        for i = 1, table.maxn(weapon.druid) do
            doPlayerAddItem(cid, weapon.druid, 1)
			end
        elseif isPaladin(cid) == TRUE then
            doPlayerAddItem(cid, weapon.paladin, 1)
        elseif isKnight(cid) == TRUE then
            for i = 1, table.maxn(weapon.knight) do
                doPlayerAddItem(cid, weapon.knight[i], 1)
            end
        end
            setPlayerStorageValue(cid,11301,1)
            doPlayerSendTextMessage(cid,22,"Have a good fun!")
    else
        doPlayerSendTextMessage(cid,22,"You've got you prize already")    
    end
end
This should work.
 
Back
Top