|
|
|
|
Jodla
Bardzo Zainteresowany
Dołączył: 18 Cze 2008
Posty: 334
Przeczytał: 0 tematów
Ostrzeżeń: 1/5
|
|
|
|
|
|
Wysłany: Sob 9:46, 19 Lip 2008 Temat postu: |
|
|
Sry Za double ale znalazlem bardzo przydatny skrypt
Autor: AGS
Kod: | data\actions\scripts modification_kits.lua |
Kod: | function onUse(cid, item, fromPosition, itemEx, toPosition)
local BEDSINUSE = {1762, 1764, 7480, 7778, 7779, 7787, 7789, 7799, 7801, 7791, 7793, 7803, 7805, 7795, 7797, 7807, 7809}
local horizontalpos = {x = toPosition.x+1, y = toPosition.y, z = toPosition.z, stackpos = 1}
local horizontal = getThingfromPos(horizontalpos)
local verticalpos = {x = toPosition.x, y = toPosition.y+1, z = toPosition.z, stackpos = 1}
local vertical = getThingfromPos(verticalpos)
if getTileHouseInfo(getPlayerPosition(cid)) ~= 0 then
if item.itemid == 7904 then --green bed kit
if itemEx.itemid == 1760 then
doTransformItem(itemEx.uid, 7813)
doTransformItem(horizontal.uid, 7814)
doRemoveItem(item.uid,1)
elseif itemEx.itemid == 1754 then
doTransformItem(itemEx.uid, 7811)
doTransformItem(vertical.uid, 7812)
doRemoveItem(item.uid,1)
elseif isInArray(BEDSINUSE,itemEx.itemid) == TRUE then
doPlayerSendCancel(cid, "Somebody is sleeping there!")
else
doPlayerSendCancel(cid, "You can only use modification kits on empty beds.")
end
elseif item.itemid == 7905 then --red bed kit
if itemEx.itemid == 1760 then
doTransformItem(itemEx.uid, 7817)
doTransformItem(horizontal.uid, 7818)
doRemoveItem(item.uid,1)
elseif itemEx.itemid == 1754 then
doTransformItem(itemEx.uid, 7815)
doTransformItem(vertical.uid, 7816)
doRemoveItem(item.uid,1)
elseif isInArray(BEDSINUSE,itemEx.itemid) == TRUE then
doPlayerSendCancel(cid, "Somebody is sleeping there!")
else
doPlayerSendCancel(cid, "You can only use modification kits on empty beds.")
end
elseif item.itemid == 7906 then --yellow bed kit
if itemEx.itemid == 1760 then
doTransformItem(itemEx.uid, 7821)
doTransformItem(horizontal.uid, 7822)
doRemoveItem(item.uid,1)
elseif itemEx.itemid == 1754 then
doTransformItem(itemEx.uid, 7819)
doTransformItem(vertical.uid, 7820)
doRemoveItem(item.uid,1)
elseif isInArray(BEDSINUSE,itemEx.itemid) == TRUE then
doPlayerSendCancel(cid, "Somebody is sleeping there!")
else
doPlayerSendCancel(cid, "You can only use modification kits on empty beds.")
end
elseif item.itemid == 7907 then --remove modification
if itemEx.itemid == 7813 or itemEx.itemid == 7817 or itemEx.itemid == 7821 then
doTransformItem(itemEx.uid, 1760)
doTransformItem(horizontal.uid, 1761)
doRemoveItem(item.uid,1)
elseif itemEx.itemid == 7811 or itemEx.itemid == 7815 or itemEx.itemid == 7819 then
doTransformItem(itemEx.uid, 1754)
doTransformItem(vertical.uid, 1755)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid, "You can only use this on modified empty beds.")
end
end
else
doPlayerSendCancel(cid, "You can only use this inside a house.")
end
end |
data\actions\actions.xml
Kod: | <action itemid="7904" script="modification_kits.lua" />
<action itemid="7905" script="modification_kits.lua" />
<action itemid="7906" script="modification_kits.lua" />
<action itemid="7907" script="modification_kits.lua" /> |
Teraz npc [by Me ] sprzedający różne pierdoły w tym modyfikacje do łóżek:
data\npc\scripts pierdoly.lua
Kod: | local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! I sell Decorations!')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'decorations') then
selfSay('I sell Gems, Big Gems, Beds Modifications and Misc Decoration.')
elseif msgcontains(msg, 'big gems') then
selfSay('I sell Violet (1k), Yellow (1k), Green (1k), Red (1k) and Blue Gems (1k).')
elseif msgcontains(msg, 'misc') then
selfSay('I sell Blood Herbs (1k), 100 Coconuts (5k), 100 Snowballs (10k), 100 Gold Nuggets (10k), and Teddy Bears (10k).')
elseif msgcontains(msg, 'gems') then
selfSay('I sell 100 Talons (5k), 100 Small Rubies (5k), 100 Small Emeralds (5k), 100 Small Diamonds (5k), 100 Small Amethysts (5k), 100 Small Sapphires (5k), 100 Black Pearls (5k) and 100 White Pearls (5k).')
elseif msgcontains(msg, 'beds') then
selfSay('I sell Green (1k), Yellow (1k) and Red Beds Modifications (1k) also I sell remove modifikations (100gp).')
elseif msgcontains(msg, 'green bed kit') or msgcontains(msg, 'green bed') then
buy(cid,7904,1,1000)
elseif msgcontains(msg, 'red bed kit') or msgcontains(msg, 'red bed') then
buy(cid,7905,1,1000)
elseif msgcontains(msg, 'yellow bed kit') or msgcontains(msg, 'yellow bed') then
buy(cid,7906,1,1000)
elseif msgcontains(msg, 'remove bed kit') or msgcontains(msg, 'remove bed') or msgcontains(msg, 'remove kit') then
buy(cid,7907,1,100)
elseif msgcontains(msg, 'violet') then
buy(cid,2153,1,1000)
elseif msgcontains(msg, 'yellow') then
buy(cid,2154,1,1000)
elseif msgcontains(msg, 'green') then
buy(cid,2155,1,1000)
elseif msgcontains(msg, 'red') then
buy(cid,2156,1,1000)
elseif msgcontains(msg, 'blue') then
buy(cid,2158,1,1000)
elseif msgcontains(msg, 'blood herb') then
buy(cid,2798,1,1000)
elseif msgcontains(msg, 'coconuts') then
buy(cid,2678,100,5000)
elseif msgcontains(msg, 'snowballs') then
buy(cid,2111,100,10000)
elseif msgcontains(msg, 'teddy bear') then
buy(cid,2326,1,10000)
elseif msgcontains(msg, 'nuggets') then
buy(cid,2157,100,10000)
elseif msgcontains(msg, 'small rubies') then
buy(cid,2147,100,5000)
elseif msgcontains(msg, 'small emeralds') then
buy(cid,2149,100,5000)
elseif msgcontains(msg, 'small diamonds') then
buy(cid,2145,100,5000)
elseif msgcontains(msg, 'small sapphires') then
buy(cid,2146,100,5000)
elseif msgcontains(msg, 'small amethysts') then
buy(cid,2150,100,5000)
elseif msgcontains(msg, 'talons') then
buy(cid,2151,100,5000)
elseif msgcontains(msg, 'black pearls') then
buy(cid,2144,100,5000)
elseif msgcontains(msg, 'white pearls') then
buy(cid,2143,100,5000)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if focus > 0 then
x, y, z = creatureGetPosition(focus)
myx, myy, myz = selfGetPosition()
if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
selfTurn(1)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(3)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(0)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(2)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(0)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(3)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(1)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(2)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(0)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(3)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(1)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(2)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(0)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(3)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(1)
end
end
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end |
data\npc Jas Pierdola.xml
Kod: | <?xml version="1.0"?>
<npc name="Jas Pierdola" script="data/npc/scripts/pierdoly.lua" access="3" lookdir="2" autowalk="1">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="134" head="116" body="114" legs="76" feet="114"/>
</npc> |
Teraz tak żeby było fajnie to:
data\items\items.xml
Kod: | <item id="7904" name="green bed kit">
</item>
<item id="7905" name="red bed kit">
</item>
<item id="7906" name="yellow bed kit">
</item>
<item id="7907" name="remove modification kit">
</item> |
No i instrukcja obsługi:
Idziemy sobie do Jasia Pierdoły i kupujemy sobie green bed kit.
Z paczuszką udajmy się do swojego domku.
Teraz klikamy ppm(prawy przycisk myszy) na paczkę i klikamy lpm(lewy przycisk myszy) na nasze brzydkie łóżko...Pach i oto nasze stare łoże zamienia się w piękne zielone łóżeczko.
Ale to łóżko nam się znudziło i chcemy swoje stare łóżko.
Idziemy znów do Jasia i kupujemy remove bed kit teraz robimy to samo co z tamtą paczką i nasze ładne łoże zostaje zamienione na zwykłe, normalne łóżko.
Post został pochwalony 0 razy
|
|