Czopeq
Advanced User
- Joined
- Jun 29, 2015
- Messages
- 191
- Reaction score
- 6
Hello, chcia?em zrobi? to co jest w configu wy?wietla?o si? randomowo:
[LUA]config = {
[1] = { text="text1"},
[2] = { text="text12"},
[3] = { text="text123"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = math.random(3)
for i, k in pairs(config) do
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,k.text)
doPlayerSendTextMessage(cid,22,"random: "..x.. " ")
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
return true
end
return true
end
[/LUA]
Tak ?eby ta randomowa cyfra do 3 by?a tym "i", jak x = 2 to wy?wietla tekst z 2'ki...
---------- Tre?? dodana o 23:25 ----------
Albo jak skr?ci? ten kod:
[LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = math.random(3)
if item.itemid == 1945 then
if x <= 1 then
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,"text1")
elseif x == 2 then
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,"text2")
else
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,"text3")
end
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
return true
end[/LUA]
Ja ju? nie mam pomys?u :c
[LUA]config = {
[1] = { text="text1"},
[2] = { text="text12"},
[3] = { text="text123"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = math.random(3)
for i, k in pairs(config) do
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,k.text)
doPlayerSendTextMessage(cid,22,"random: "..x.. " ")
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
return true
end
return true
end
[/LUA]
Tak ?eby ta randomowa cyfra do 3 by?a tym "i", jak x = 2 to wy?wietla tekst z 2'ki...
---------- Tre?? dodana o 23:25 ----------
Albo jak skr?ci? ten kod:
[LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = math.random(3)
if item.itemid == 1945 then
if x <= 1 then
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,"text1")
elseif x == 2 then
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,"text2")
else
doTransformItem(item.uid, 1946)
doPlayerSendTextMessage(cid,25,"text3")
end
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
return true
end[/LUA]
Ja ju? nie mam pomys?u :c