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

Problem in TalkAction (created by me)

bolero

MikeHere
Joined
Apr 13, 2009
Messages
1,146
Reaction score
12
Location
Venezuela
Now I have 1 talk action and this say error in the console GUI

This say:

Code:
[22/11/2009 08:41:56] attempt to index a nil value
[22/11/2009 08:41:57] stack traceback:
[22/11/2009 08:41:57] 	[C]: in function 'doSendMagicEffect'
[22/11/2009 08:41:58] 	data/talkactions/scripts/!fire boots.lua:10: in function <data/talkactions/scripts/!fire boots.lua:1>

[22/11/2009 08:41:59] Lua Script Error: [TalkAction Interface] 
[22/11/2009 08:42:00] data/talkactions/scripts/!fire boots.lua:onSay

And the script is...

Code:
function onSay(cid, words, param)
    if getPlayerMoney(cid) >= 10000 then
        if getPlayerItemCount(cid,9934) >= 1 then
            doPlayerTakeItem(cid,9934,1)
            doPlayerRemoveMoney(cid, 10000)
            doPlayerAddItem(cid,9932,1)
        else
            doPlayerSendCancel(cid, "Tu no tienes las firewalker boots.")
        end
        doSendMagicEffect(topos,12)
    else
        doPlayerSendCancel(cid, "Tu necesitas 10k y el worn firewalker boots.")
    end
    return TRUE
end
local function GIC(cid, x)
return getPlayerItemCount(cid, x)
end
local function getPlayerMoney(cid)
return GIC(cid, 2160)*10000 + GIC(cid, 2152)*100 + GIC(cid, 2148)
end


Anyone can help me?
 
Try this:

PHP:
function onSay(cid, words, param)
    if getPlayerMoney(cid) >= 10000 then
        if getPlayerItemCount(cid,9934) >= 1 then
            doPlayerTakeItem(cid,9934,1)
            doPlayerRemoveMoney(cid, 10000)
            doPlayerAddItem(cid,9932,1)
        else
            doPlayerSendCancel(cid, "Tu no tienes las firewalker boots.")
        doSendMagicEffect(topos,12)
        end
    else
        doPlayerSendCancel(cid, "Tu necesitas 10k y el worn firewalker boots.")
    end
    return TRUE
end
local function GIC(cid, x)
return getPlayerItemCount(cid, x)
end
local function getPlayerMoney(cid)
return GIC(cid, 2160)*10000 + GIC(cid, 2152)*100 + GIC(cid, 2148)
end
 
Code:
local function GIC(cid, x)
	return getPlayerItemCount(cid, x)
end
local function getPlayerMoney(cid)
	return GIC(cid, 2160)*10000 + GIC(cid, 2152)*100 + GIC(cid, 2148)
end

function onSay(cid, words, param)
	if getPlayerMoney(cid) >= 10000 then
		if getPlayerItemCount(cid, 9934) > 0 then
			doPlayerRemoveItem(cid, 9934, 1)
			doPlayerRemoveMoney(cid, 10000)
			doPlayerAddItem(cid, 9932, 1)
			doSendMagicEffect(getCreaturePosition(cid), 12)
		else
			doPlayerSendCancel(cid, "Tu no tienes las firewalker boots.")
		end
	else
		doPlayerSendCancel(cid, "Tu necesitas 10k y el worn firewalker boots.")
	end
	return TRUE
end
 
Good!!! Is work! You can fix other script? Is too only change the id of firewalker for soft boots please!

function onsay(cid, words, param)
if getplayermoney(cid) >= 10000 then
if getplayeritemcount(cid,6530) >= 1 then
doplayertakeitem(cid,6530,1)
doplayerremovemoney(cid, 10000)
doplayeradditem(cid,2640,1)
else
doplayersendcancel(cid, "tu no tienes las soft boots.")
end

dosendmagiceffect(getcreatureposition(cid), param)

else
doplayersendcancel(cid, "you need 10000 platinum coins and worn of soft boots.")
end
return true
end
local function gic(cid, x)
return getplayeritemcount(cid, x)
end
local function getplayermoney(cid)
return gic(cid, 2160)*10000 + gic(cid, 2152)*100 + gic(cid, 2148)
end
 
Code:
local config = {
	itemid = 6530,
	price = 10000,
	newid = 6132
}

local function GIC(cid, x)
	return getPlayerItemCount(cid, x)
end
local function getPlayerMoney(cid)
	return GIC(cid, 2160)*10000 + GIC(cid, 2152)*100 + GIC(cid, 2148)
end

function onSay(cid, words, param)
	if getPlayerMoney(cid) >= config.price then
		if getPlayerItemCount(cid, config.itemid) > 0 then
			doPlayerRemoveItem(cid, config.itemid, 1)
			doPlayerRemoveMoney(cid, config.price)
			doPlayerAddItem(cid, newid, 1)
			doSendMagicEffect(getCreaturePosition(cid), 12)
		else
			doPlayerSendCancel(cid, "Tu no tienes las " .. getItemNameById(config.itemid) .. ".")
		end
	else
		doPlayerSendCancel(cid, "Tu necesitas " .. config.price / 1000 .. "k y el " .. getItemNameById(config.itemid) .. ".")
	end
	return TRUE
end
 
Back
Top