V
verdehile95
Guest
I have a question: how can I make it so that when I use the wings item, it will add wings to my outfit?
Attachments
-
111.webp61.4 KB · Views: 26 · VirusTotal
local ITEM_ID = 38676 -- Item ID that the player can click to add mounts
local STORAGE_KEY = 941006 -- Unique storage key for tracking usage
local addMountSystem = Action()
function addMountSystem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid ~= ITEM_ID then
return true
end
-- Check if the player has already used this item
if player:getStorageValue(STORAGE_KEY) == 1 then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have already used this item.")
return true
end
-- Apply mounts without changing the outfit
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have received 3 free mounts.')
-- Mark the item as used
player:setStorageValue(STORAGE_KEY, 1)
-- Set specific storage values for mounts
local mountStorages = {90550, 90551, 90552}
for _, storage in ipairs(mountStorages) do
player:setStorageValue(storage, 1)
end
item:remove(1)
return true
end
addMountSystem:id(ITEM_ID)
addMountSystem:register()
This is Mount system not wingRevscript
LUA:local ITEM_ID = 38676 -- Item ID that the player can click to add mounts local STORAGE_KEY = 941006 -- Unique storage key for tracking usage local addMountSystem = Action() function addMountSystem.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid ~= ITEM_ID then return true end -- Check if the player has already used this item if player:getStorageValue(STORAGE_KEY) == 1 then player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have already used this item.") return true end -- Apply mounts without changing the outfit player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED) player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have received 3 free mounts.') -- Mark the item as used player:setStorageValue(STORAGE_KEY, 1) -- Set specific storage values for mounts local mountStorages = {90550, 90551, 90552} for _, storage in ipairs(mountStorages) do player:setStorageValue(storage, 1) end item:remove(1) return true end addMountSystem:id(ITEM_ID) addMountSystem:register()
just change mount To wing xDDDThis is Mount system not wing
local ITEM_ID = 38676 -- Item ID that the player can click to add wings
local STORAGE_KEY = 941006 -- Unique storage key for tracking usage
local addWingSystem = Action()
function addWingSystem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid ~= ITEM_ID then
return true
end
-- Check if the player has already used this item
if player:getStorageValue(STORAGE_KEY) == 1 then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have already used this item.")
return true
end
-- Apply wings without changing the outfit
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have received 3 free wings.')
-- Mark the item as used
player:setStorageValue(STORAGE_KEY, 1)
-- Set specific storage values for wings
local wingStorages = {90550, 90551, 90552}
for _, storage in ipairs(wingStorages) do
player:setStorageValue(storage, 1)
end
item:remove(1)
return true
end
addWingSystem:id(ITEM_ID)
addWingSystem:register()
Ok and let me know if it worked wellOk thanks i test it when I back to home
I get the notification but it still doesn't workOk and let me know if it worked well
function Player.hasWings(self)
-- Zwraca `true` jeśli gracz ma przypisane skrzydła (sprawdzając wartość w `Storage`)
return self:getStorageValue(905) == 1 -- Sprawdza, czy gracz ma przypisane skrzydło z ID 905
end
you just was needed to add your wing storage 905I get the notification but it still doesn't work
Post automatically merged:
I added this to the code and now it works
LUA:function Player.hasWings(self) -- Zwraca `true` jeśli gracz ma przypisane skrzydła (sprawdzając wartość w `Storage`) return self:getStorageValue(905) == 1 -- Sprawdza, czy gracz ma przypisane skrzydło z ID 905 end