What's new
  • logo_cipsoft
    Latest servers:
    New servers will open on: 19th Feb 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Actions Donator Box

Status
Not open for further replies.

arcane

Active User
Joined
Jan 5, 2013
Messages
73
Reaction score
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.

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

data/actions/scripts/donatorbox.lua

Code:
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

Code:
<action itemid="id box'a" script="donatorbox.lua"/>
 

Dantez

Moim sekretem jest ciasto
Joined
May 22, 2008
Messages
1,206
Reaction score
202
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.
 
Last edited:

Anakonta

Senior User
Joined
Oct 5, 2010
Messages
536
Reaction score
10
Odp: Donator Box

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

arcane

Active User
Joined
Jan 5, 2013
Messages
73
Reaction score
1
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.
 

Dantez

Moim sekretem jest ciasto
Joined
May 22, 2008
Messages
1,206
Reaction score
202
Odp: Donator Box

Poprawi?em b??d ze znikaniem i nazw?, przedmioty dawa?o od pocz?tku - zn?w wina twojego syfnego silnika.
 
Status
Not open for further replies.
Top