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

Tlkact error

Coca Cola

New Member
Joined
Apr 10, 2010
Messages
164
Reaction score
0
hello everyone , i have an problem with this script and i belive the error is in refpower part.. could someone help? I can't fix that :/
ty,cya
Lua:
function onSay(cid, words, param)

local d = string.explode(param,",")

local itemid = tonumber(d[1])
local count = tonumber(d[2])
local refAtk = tonumber(d[3])
local refDef = tonumber(d[4])
local refPower = tonumber(d[5])
local Charges = tonumber(d[6])
local Armor = tonumber(d[7])                         
local HitChance = tonumber(d[8])	
local Desc = tonumber(d[9])	                                      					                    				
	if itemid ~= nil then
local uid = doPlayerAddItem(cid, itemid, count)              
 end											     	
 if refAtk ~= nil and refAtk > 0 then                    
 doItemSetAttribute(uid,"attack",refAtk)					              
 end											
 if refDef ~= nil and refDef > 0 then                    
 doItemSetAttribute(uid,"defense",refDef)					              
 end												
 if refPower ~= nil and refPower > 0 then                    
doItemSetAttribute(item.uid, 'name', getItemInfo(item.uid).name .. '[power+'..refPower..'points]')	
 end												
 if Charges ~= nil and Charges > 0 then                    
 doItemSetAttribute(uid,"charges",Charges)					              
 end												
 if Armor ~= nil and Armor > 0 then                    
 doItemSetAttribute(uid,"armor",Armor)					              
 end													
 if HitChance ~= nil and HitChance > 0 then                    
 doItemSetAttribute(uid,"hitchance",HitChance)			               
 end	
  if Desc ~= nil then                    
 doItemSetAttribute(uid,"hitchance",HitChance)			               
 end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'O item foi criado com sucesso.')
end
return TRUE
 
Last edited:
Code:
function onSay(cid, words, param, channel)
	local t = string.explode(param,',')

	local itemid, uid = tonumber(t[1])
	local count = tonumber(t[2]) or 1
	local refAtk = tonumber(t[3]) or 0
	local refDef = tonumber(t[4]) or 0
	local refPower = tonumber(t[5]) or 0
	local Charges = tonumber(t[6]) or 0
	local Armor = tonumber(t[6]) or 0
	local HitChance = tonumber(t[8]) or 0
	local Desc = t[9] ~= '' and t[9] or ''

	if itemid then
		uid = doPlayerAddItem(cid, itemid, count)
	else
		return true
	end

	if refAtk > 0 then
		doItemSetAttribute(uid, 'attack', refAtk)
	end
	if refDef > 0 then
		doItemSetAttribute(uid, 'defense', refDef)
	end  
	if refPower > 0 then
		doItemSetAttribute(uid, 'name', getItemInfo(itemid).name .. ' [power + '..refPower..' points]')
	end  
	if Charges > 0 then
		doItemSetAttribute(uid, 'charges', Charges)
	end  
	if Armor > 0 then
		doItemSetAttribute(uid, 'armor', Armor)
	end
	if HitChance > 0 then
		doItemSetAttribute(uid, 'hitchance', HitChance)
	end
	if Desc ~= '' then
		doItemSetAttribute(uid, 'description', Desc)
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'O item foi criado com sucesso.')
	return TRUE
end
 
Last edited:
Back
Top