• 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!

upgrade an item with power gem

Na Amigo

The crazy girl
Joined
Jun 5, 2017
Messages
254
Solutions
3
Reaction score
18
Location
Egypt
hello i have an script to upgrade the item id "2342" to "2343" with the power gem id "2156"
the tutorial to use the item id "2342" at gem to get "2343" i have the script but it say error at console player not found
Code:
function OnUse(cid,item,olditem,newitem,item2)

  if item2.itemid == olditem then  

      

                doPlayerAddItem(cid,newitem,1)
                doPlayerSendTextMessage(cid,19,"Congratulations! Your Weapon Has Been Successfully Upgraded")
                doSendAnimatedText(position,"Succeed",TEXTCOLOR_RED)
                doSendMagicEffect(position,28)
              
            end
            doRemoveItem(item2.uid,1)
    end



function onUse(cid, item, frompos, item2, topos)

    if item.itemid == 2342 and getPlayerItemCount(cid,2342) >= 1 then
        doPlayerAddItem(cid,item,1,2156,2343,item2) --ancient helmet
     pps = getPlayerPosition(cid)
    end
  
end
 
Solution

Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2156 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(item.uid, 1)
        doRemoveItem(target.uid, 1)
    end

    return true
end

Also please read the rules; Rules for the Support board
#2
hello i have an script to upgrade the item id "2342" to "2343" with the power gem id "2156"
the tutorial to use the item id "2342" at gem to get "2343" i have the script but it say error at console player not found
Code:
function OnUse(cid,item,olditem,newitem,item2)

  if item2.itemid == olditem then 

     

                doPlayerAddItem(cid,newitem,1)
                doPlayerSendTextMessage(cid,19,"Congratulations! Your Weapon Has Been Successfully Upgraded")
                doSendAnimatedText(position,"Succeed",TEXTCOLOR_RED)
                doSendMagicEffect(position,28)
             
            end
            doRemoveItem(item2.uid,1)
    end



function onUse(cid, item, frompos, item2, topos)

    if item.itemid == 2342 and getPlayerItemCount(cid,2342) >= 1 then
        doPlayerAddItem(cid,item,1,2156,2343,item2) --ancient helmet
     pps = getPlayerPosition(cid)
    end
 
end

Post the full error (take an SS)
 
here you are Imgur: The magic of the Internet
651xi
 

Give this a try;
Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2342 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(target.uid, 1)
    end

    return true
end
 
Give this a try;
Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2342 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(target.uid, 1)
    end

    return true
end
not working :/
 
no error at console i have aries 0.4.0 8.1

Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    print(target.itemid)
    if target.itemid == 2342 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(target.uid, 1)
    end

    return true
end

Restart the server and take another SS.
 
Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    print(target.itemid)
    if target.itemid == 2342 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(target.uid, 1)
    end

    return true
end

Restart the server and take another SS.
ok.
Imgur: The magic of the Internet
aRFUG
 
works fine but the old helmet did not removed

Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2156 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(item.uid, 1)
    end

    return true
end
 
Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2156 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(item.uid, 1)
    end

    return true
end
works fine too i want the gem remove too

Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2156 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(item.uid, 1)
    end

    return true
end
 
Last edited by a moderator:

Lua:
function onUse(cid, item, fromPosition, target, toPosition)
    if target.itemid == 2156 then
        doPlayerAddItem(cid, 2343, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations! Your Weapon Has Been Successfully Upgraded")
        doSendAnimatedText(fromPosition, "Succeed", TEXTCOLOR_RED)
        doSendMagicEffect(fromPosition, CONST_ANI_ETHEREALSPEAR)
        doRemoveItem(item.uid, 1)
        doRemoveItem(target.uid, 1)
    end

    return true
end

Also please read the rules; Rules for the Support board
#2
 
Solution
Back
Top