Kurczok
Newbie
- Joined
- Oct 22, 2009
- Messages
- 497
- Reaction score
- 4
Witam znowu mam problem ze skryptem (a raczej cały czas ten sam)
jednak tym razem postaram się to lepiej zobrazować
To jest część skryptu:
Problem polega na tym że przy wysyłaniu wiadomości do gracza
wywala błąd
55 to linijka
2)Mam jeszcze takie pytanie jak mogę zablokować możliwość dawania namelocków przez tutorów?
jednak tym razem postaram się to lepiej zobrazować
To jest część skryptu:
Lua:
local monsters =
{
[1] = {name = "Troll", id = 1, ex = 100, go = 100},
[2] = {name = "Rotworm", id = 2, ex = 80, go = 20}
}
function onSay(cid, words, param, channel)
local poziom =
{
p1 = 100,
p2 = 200,
}
local quest2 =
{
q1 = "nazwa potwora to " .. rand.name .. " ilosc ".. getPlayerStorageValue(cid, 4402) .."",
q2 = "nazwa potwora to " .. rand.name .. " ilosc ".. getPlayerStorageValue(cid, 4402) ..""
}
if (param == 'start') then
if getPlayerStorageValue(cid, 4400) == 0 or getPlayerStorageValue(cid, 4400) == -1 then
if getPlayerLevel(cid) >= poziom.p1 then
setPlayerStorageValue(cid, 4400, 1)
local rand = monsters[math.random(1, #monsters)]
setPlayerStorageValue(cid, 4406, rand.id)
setPlayerStorageValue(cid, 4411, rand.ex)
setPlayerStorageValue(cid, 4416, rand.go)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"nazwa potwora to " .. rand.name .. " ilosc ".. getPlayerStorageValue(cid, 4402) .."")
if getPlayerLevel(cid) >= poziom.p2 then
setPlayerStorageValue(cid, 4400, 2)
local rand = monsters[math.random(1, #monsters)]
setPlayerStorageValue(cid, 4407, rand.id)
setPlayerStorageValue(cid, 4412, rand.ex)
setPlayerStorageValue(cid, 4417, rand.go)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"nazwa potwora to " .. rand.name .. " ilosc ".. getPlayerStorageValue(cid, 4402) .."")
end
end
end
elseif (param == 'help') then
if getPlayerStorageValue(cid, 4400) >= 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "".. quest2.q1 .. "") -- nie mozna pobrac rand
if getPlayerStorageValue(cid, 4400) >= 2 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "".. quest2.q2 .. "") -- nie mozna pobrac rand
end
end
end
return true
end
Problem polega na tym że przy wysyłaniu wiadomości do gracza
Lua:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "".. quest2.q1 .. "")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "".. quest2.q2 .. "")
Code:
[07/03/2010 21:44:47] data/talkactions/scripts/quest.lua:55: attempt to index global 'rand' (a nil value)
[07/03/2010 21:44:47] stack traceback:
[07/03/2010 21:44:47] data/talkactions/scripts/quest.lua:55: in function <data/talkactions/scripts/quest.lua:31>
55 to linijka
Code:
q1 = "nazwa potwora to " .. rand.name .. " ilosc ".. getPlayerStorageValue(cid, 4402) .."",
2)Mam jeszcze takie pytanie jak mogę zablokować możliwość dawania namelocków przez tutorów?