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

skrypt do wyboru 2 itemki

Status
Zamknięty.

karabasz

Active User
Dołączył
Maj 1, 2010
Posty
55
Liczba reakcji
0
dal by ktos skrypt na skrzynke questowa gdzie do wyboru sa 2 itemki
focus cape i blue robe

dam punkt
Notka moderatorska:
Przenosz? do request.
 
Odp: skrypt do wyboru 2 itemki

Masz dwa sposoby na rozwi?zanie tego questa.
PIERWSZY:
PHP:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 5000 then  
queststatus = getPlayerStorageValue(cid,5000)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"Zdobyles blue robe.")
doPlayerAddItem(cid,2656,1)
setPlayerStorageValue(cid,5000,1)
else
doPlayerSendTextMessage(cid,22,"Mozesz wziac tylko jedna sposrod dwoch nagrod.")
end
elseif item.uid == 5001 then
queststatus = getPlayerStorageValue(cid,5000)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"Zdobyles focus cape.")
doPlayerAddItem(cid,8871,1)
setPlayerStorageValue(cid,5000,1)
else
doPlayerSendTextMessage(cid,22,"Mozesz wziac tylko jedna sposrod dwoch nagrod.")
end
end
end
Do actions.xml dodaj:
PHP:
<action fromuid="5000" touid="5001" event="script" value="blue_robe.lua" />
DRUGI:
PHP:
 local Items = { 
[5000] = {storages = 5000, bp = 0, add_item = 2656, add_item_count = 1, ground = false, expe = 0},
[5001] = {storages = 5000, bp = 0, add_item = 8871, add_item_count = 1, ground = false, expe = 0}
             }
function onUse(cid, item, frompos, item2, topos)
  local actual_quest = Items[item.uid]
      if getPlayerStorageValue(cid, actual_quest.storages) ==  -1 then
              if actual_quest.bp == 0 then
                 local itms = doPlayerAddItem(cid, actual_quest.add_item, actual_quest.add_item_count, actual_quest.ground)
                    if itms ~= LUA_ERROR then
                          doPlayerAddExperience(cid, actual_quest.expe)
                          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Znalazlem : "..getItemNameById(actual_quest.add_item))
                          doPlayerSetStorageValue(cid, actual_quest.storages, 1)
                    else
                          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nie moge podniesc")
                    end
              else
               local new_container = doCreateItemEx(actual_quest.bp, 1)
                     for i = 1, #actual_quest.add_item do
                         if actual_quest.add_item[i] == 8978 then
                           doItemSetAttribute(doAddContainerItem(new_container, actual_quest.add_item[i], actual_quest.add_item_count[i]), "aid", 2222)
                         else
                          doAddContainerItem(new_container, actual_quest.add_item[i], actual_quest.add_item_count[i])
                         end
                     end
                local itms = doPlayerAddItemEx(cid, new_container, actual_quest.ground)
                     if itms == 1 then
                      doPlayerAddExperience(cid, actual_quest.expe)
                      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Znalazlem : "..getItemNameById(actual_quest.bp))
                      doPlayerSetStorageValue(cid, actual_quest.storages, 1)
                     else
                      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nie moge podniesc")
                     end
              end 
      else
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Niestety lecz nic nie znalazles")
      end
return True
end
A co actions.xml wklej:
PHP:
<action fromuid="5000" touid="5001" event="script" value="blue_robe.lua" />
 
Status
Zamknięty.
Do góry