• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Actions Donator Box

Status
Zamknięty.

arcane

Active User
Dołączył
Styczeń 5, 2013
Posty
73
Liczba reakcji
1
Amatorski skrypcik na Donator Box, czyli klikasz i losujesz itemek ; ). W skrypcie jest tylko 10 itemk?w, ale t? liczb? mo?na zwi?kszy? kopiuj?c ca?? tre?? elseif.

je?eli box ma losowa? wi?cej lub mniej ni? 10 item?w, musimy zmieni? warto?? drugiej liczby, w tym przypadku 10.

Kod:
local random = math.random(1,10)

data/actions/scripts/donatorbox.lua

Kod:
function onUse(cid, item, fromPosition, itemEx, toPosition)



lol = getPlayerPosition(cid)

local random = math.random(1,10) 


if random == 1 then
doPlayerAddItem(cid,2510,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Fusion Armor.")
doRemoveItem(item.uid, 1)

elseif random == 2 then
doPlayerAddItem(cid,2160,100)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a 100 Gold.")
doRemoveItem(item.uid, 1)

elseif random == 3 then
doPlayerAddItem(cid,2673,100)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a 100 Senzu.")
doRemoveItem(item.uid, 1)

elseif random == 4 then
doPlayerAddItem(cid,2469,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Goku SSj5 Legs.")
doRemoveItem(item.uid, 1)

elseif random == 5 then
doPlayerAddItem(cid,2478,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Gohan Legs.")
doRemoveItem(item.uid, 1)

elseif random == 6 then
doPlayerAddItem(cid,2487,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Gohan Armor.")
doRemoveItem(item.uid, 1)

elseif random == 7 then
doPlayerAddItem(cid,2655,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Super C17 Armor.")
doRemoveItem(item.uid, 1)

elseif random == 8 then
doPlayerAddItem(cid,2441,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Silver Glove.")
doRemoveItem(item.uid, 1)

elseif random == 9 then
doPlayerAddItem(cid,2442,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Saiyan Sword.")
doRemoveItem(item.uid, 1)

elseif random == 10 then
doPlayerAddItem(cid,5875,1)
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have got a Crashni Scroll of 10.000.000 experiance..")
doRemoveItem(item.uid, 1)
end

return TRUE
end

data/actions/actions.xml

Kod:
<action itemid="id box'a" script="donatorbox.lua"/>
 
Odp: Donator Box

U?yj tablicy!

Tak to powinno wygl?da?:
PHP:
local items = {2510, 2160, 2673, 2469, 2478, 2487, 2655, 2441, 2442, 5875} 

function onUse(cid, item, fromPosition, itemEx, toPosition) 

    if(#items > 0) then 
        local rand = math.random(#items) 
        doPlayerAddItem(cid, items[rand]) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have got a " .. getItemNameById(items[rand])) 
        doRemoveItem(item.uid, 1) 
    end 
     
return true 
end


// Btw.
PHP:
lol = getPlayerPosition(cid)
Nawet z tego nie korzystasz.
 
Ostatnia edycja:
Odp: Donator Box

W?a?nie mia?em napisa? ?eby u?y? tablicy, skrypt fajny, na pewno si? przyda
 
Odp: Donator Box

[USER]Dantez[/USER] dopiero sprawdzi?em m?j skrypt kt?ry poprawi?e? za pomoc? tablicy, i on nie dzia?a. Wyskakuje tylko napis, jaki dostali?my itemek, lecz Donator Box nie znika oraz nie daje eq.
 
Odp: Donator Box

Poprawi?em b??d ze znikaniem i nazw?, przedmioty dawa?o od pocz?tku - zn?w wina twojego syfnego silnika.
 
Status
Zamknięty.
Do góry