• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[lua] Taki tam nubski problem

lenidas

New Member
Joined
Mar 18, 2010
Messages
149
Reaction score
0
Cześć, uczę się lua i napisałem prosty skrypt ale nie chce mi działać :P
Chodzi o to że jak gracz stanie na kratkę z uniqueID to żeby zniknęły skały a jak z niej zejdzie to żeby znów się pojawiły

Code:
function onStepIn(cid, item, pos)
    local stone_pos = {x=2498, y=1284, z=7}
    if item.uid == 63985 and isPlayer(cid) == TRUE then
        doRemoveItem(387,1,stone_pos)
    end
    return true
end

function onStepOut(cid, item, pos)
    local stone_pos = {x=2498, y=1284, z=7}
    if item.uid == 63985 and isPlayer(cid) == TRUE then              
    doCreateItem(387,1,stone_pos)
    end
    return true
end

i wyskakuje błąd
Code:
data/movements/scripts/destroy.lua:onStepIn
Description:
(luaDoRemoveItem) Item not found

Co robie źle?
 
hmm.. doRemoveItem(387,1,stone_pos)
387 - id skaly, 1 - ilosc, stone_pos - pozycja skaly
tak to działa?
chyba nie bo to tu wywala błąd :P
więc jak to działa?


Edit:
Coś takiego wymyśliłem:
Code:
function onStepIn(cid, item, pos)
    local stone_pos = {x=2498, y=1284, z=7}
	local stone = getThingfromPos(stone_pos)
    if item.uid == 63985 and isPlayer(cid) == TRUE then
        doRemoveItem(stone.uid)
    end
    return true
end

Ale czy zadziała to nie wiem, jutro przetestuję bo już ledwo żyje :)
 
doRemoveItem(uid,count) po potrzebuje zadnego id :)

po prosty 1 element to uid danego itema, a 2 elment to ilosc ile ma usuwac ;)

w przypadku skały masz 1
Code:
        doRemoveItem(stope_pos.uid,1)
 
doRemoveItem(uid,count) po potrzebuje zadnego id :)

po prosty 1 element to uid danego itema, a 2 elment to ilosc ile ma usuwac ;)

w przypadku skały masz 1
Code:
        doRemoveItem(stope_pos.uid,1)

Parametr #2 jest opcjonalny, tak btw. ;d
 
Poradziłem sobie inaczej, troche śmiesznie ale działa :)
Code:
function onStepIn(cid, item, pos)
    local stone_pos = {x=2498, y=1284, z=7}
    if item.uid == 63985 and isPlayer(cid) == TRUE then
        doRemoveItem(38754,1)
    end
    return true
end


function onStepOut(cid, item, pos)
    local stone_pos = {x=2498, y=1284, z=7}
    if item.uid == 63985 and isPlayer(cid) == TRUE then     
	doItemSetAttribute(doCreateItem(387, 1,stone_pos), "uid", 38754)
    end
    return true
end

Dzięki za pomoc, rep+ dla wszystkich, można zamknąć.
 
Back
Top