What's new

Skrypt wywala blad

Status
Not open for further replies.

panczo 1995

Advanced User
Joined
Apr 5, 2009
Messages
383
Reaction score
13
Krotko i zwi??le
B??d co wywala

Srypt w kt?rym co? jest ?le
function onUse(cid, item, frompos, itemEx, topos)
local config = {
[1000] = {item = 2160, ile = 15, level = 100}
}
local cc = config[item.uid]
if item.uid == 2005 then
if getPlayerLevel(cid) >= cc.level then
if getPlayerStorageValue(cid, item.uid) == -1 then
doPlayerAddItem(cid, cc.item, cc.ile)
setPlayerStorageValue(cid, item.uid, 1)
doPlayerSendTextMessage(cid, 22, "You have found a "..cc.ile.." "..getItemNameById(cc.item)..".")
else
doPlayerSendTextMessage(cid, 22, "It is empty.")
end
end
end
return true
end
Pomo?e Kto??
 
Joined
Jan 6, 2011
Messages
552
Reaction score
65
Odp: Skrypt wywala blad

W tablicy nie ma indeksu 2005, wi?c item, ile, level nie maj? warto?ci (nil). Je?eli dobrze przeanalizowa?em skrypt, to ten powinien dzia?a?:
PHP:
local config = {
	[1000] = {item = 2160, ile = 15, level = 100}
}
function onUse(cid, item, frompos, itemEx, topos)
	if(config[item.uid]) then
		local cc = config[item.uid]
		if(getPlayerLevel(cid) >= cc.level) then
			if(getPlayerStorageValue(cid, item.uid) == -1) then
				doPlayerAddItem(cid, cc.item, cc.ile)
				setPlayerStorageValue(cid, item.uid, 1)
				doPlayerSendTextMessage(cid, 22, "You have found a "..cc.ile.." "..getItemNameById(cc.item)..".")
			else
				doPlayerSendTextMessage(cid, 22, "It is empty.")
			end
		else
			doPlayerSendTextMessage(cid, 22, "You don't have enough level.")
		end
	end
	return true
end
 
Last edited:
Status
Not open for further replies.
Top