fracek91
Member
- Joined
- May 30, 2008
- Messages
- 423
- Reaction score
- 8
Hi, I wanted to make a furniture shop for my ot where players can see the items before they buy. So it looks like this (note: players can't step onto levers so there's only one position from which they can use lever, that's item's position + 0x,2y,0z)
Next, I've made an action script, but I didn't know what to put in at least to places (they're bold), and please don't complain about that text in polish, that's just info that you bought/error occured. Item id's are from constructionkit.lua, but reversed, with doubles removed.
Next, I've made an action script, but I didn't know what to put in at least to places (they're bold), and please don't complain about that text in polish, that's just info that you bought/error occured. Item id's are from constructionkit.lua, but reversed, with doubles removed.
Code:
local CONSTRUCTIONS = {
[1650] = 3901 , [1658] = 3902, [1666] = 3903, [1670] = 3904, [3813] = 3905, [3817] = 3906, [2093] = 3907, [2603] = 3908, [1614] = 3909, [1615] = 3910,
[1616] = 3911, [1619] = 3912, [3805] = 3913, [3807] = 3914, [1740] = 3915, [1774] = 3916, [2084] = 3917, [2095] = 3918, [3809] = 3919, [3832] = 3920,
[1714] = 3921, [2107] = 3922, [2104] = 3923, [7670] = 3924, [2080] = 3926, [2098] = 3927, [1676] = 3928, [2101] = 3929, [1739] = 3930,
[2105] = 3931, [1724] = 3932, [1728] = 3933, [1732] = 3934, [1775] = 3935, [3812] = 3936, [2064] = 3937, [6371] = 3938, [1738] = 5086, [1741] = 5087, [1770] = 5088,
[2106] = 6114, [2034] = 6115, [3811] = 6372, [1736] = 6373, [1750] = 7503, [5928] = 7700, [3821] = 7960, [2582] = 7962, [8688] = 8692, [7486] = 8693
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
playerpos = getPlayerPosition(cid)
[B]itempos = {playerposx,playerposy-2,playerposz,stackpos=1}
getitem = getthingfrompos(itempos)[/B]
[B]if(isInArray(CONSTRUCTIONS, getitem.itemid) == TRUE)[/B] then
if(doPlayerRemoveMoney(cid, 100000) == TRUE) then
doPlayerAddItem(cid,CONSTRUCTIONS[getitem.itemid],1)
doSendMagicEffect(fromPosition, CONST_ME_HEARTS)
else
doPlayerSendTextMessage(cid, 22, "Potrzeba 100k zeby kupic ten przedmiot.")
end
else
doPlayerSendTextMessage(cid, 22, "Jezeli widzisz te wiadomosc to cos poszlo zle. Zglos to do admina.")
end
return true
end
Last edited: