DanJ93
ElfBot Helper
- Joined
- Jan 18, 2009
- Messages
- 2,631
- Reaction score
- 198
Odp: Random Present Bag (Vestia.pl)
#UP
Dok?adnie, to by?o pisane na szybko
---------- Tre?? dodana o 14:21 ----------
Nie testowane, ale powinno by?:
[lua]local RandomPresent = {8925, 5907, 6433, 9776, 9932, 9777, 2160}
local k = {
[1] = {90},
[2] = {90},
[3] = {80},
[4] = {60}
}
local c = getPlayerVocation(cid)
function onUse(cid, item, frompos, item2, topos)
local Random = math.random(#RandomPresent)
if c = k[c] then
if math.random(100) <= k[c][1] then
if RandomPresent[Random] == 2160 then
local ilosc = 50
else
local ilosc = 1
end
if doPlayerAddItem(cid, RandomPresent[Random], ilosc, false) then
doPlayerSendTextMessage(cid,22,"Otrzyma?e? "..getItemNameById(RandomPresent[Random])..". Gratuluje.")
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid,22,"Potrzebujesz wi?cej capa/miejsca.")
end
else
doPlayerSendTextMessage(cid,22,"Masz pecha...")
end
else
doPlayerSendTextMessage(cid,22,"Nie masz odpowiedniej profesji.")
end
return true
end[/lua]
#UP
Dok?adnie, to by?o pisane na szybko
---------- Tre?? dodana o 14:21 ----------
Poprawi?em.DanJ93 przy twoim mam b?ad(linia: if RandomPresent[Random] == 2160 then), fajny skrypt, napewno si? przydaDa?o by rade doda? do skryptu: ?e dana profesja ma wieksze szanse na zdobycie danego przedmiotu?
Nie testowane, ale powinno by?:
[lua]local RandomPresent = {8925, 5907, 6433, 9776, 9932, 9777, 2160}
local k = {
[1] = {90},
[2] = {90},
[3] = {80},
[4] = {60}
}
local c = getPlayerVocation(cid)
function onUse(cid, item, frompos, item2, topos)
local Random = math.random(#RandomPresent)
if c = k[c] then
if math.random(100) <= k[c][1] then
if RandomPresent[Random] == 2160 then
local ilosc = 50
else
local ilosc = 1
end
if doPlayerAddItem(cid, RandomPresent[Random], ilosc, false) then
doPlayerSendTextMessage(cid,22,"Otrzyma?e? "..getItemNameById(RandomPresent[Random])..". Gratuluje.")
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid,22,"Potrzebujesz wi?cej capa/miejsca.")
end
else
doPlayerSendTextMessage(cid,22,"Masz pecha...")
end
else
doPlayerSendTextMessage(cid,22,"Nie masz odpowiedniej profesji.")
end
return true
end[/lua]