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

Solved Addon Script

Ussef

New Member
Joined
May 27, 2009
Messages
123
Reaction score
2
I'm trying to make an addon script that when you click on a sign while u have certain items it gives you the addon if you have them. I made this script but it doesn't work. Whats wrong with it?


function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 1434 then
if doPlayerRemoveItem(cid, 12428, 30)
if doPlayerRemoveItem(cid, 10609, 10)
if doPlayerRemoveItem(cid, 2227, 3) == TRUE then


local pPos = getPlayerPosition(cid)
doPlayerAddOutfit(cid,128,1)
doPlayerAddOutfit(cid,136,1)
doSendMagicEffect(pPos, 19)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "First Citizen Addon")
else
doCreatureSay(cid, "You do not have the required items!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
return TRUE
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if itemEx.itemid == 1434 then
   if(getPlayerStorageValue(cid, 807) ~= 1) then
     if getPlayerItemCount(cid, 12428) >= 30 and getPlayerItemCount(cid, 10609) >= 30 and getPlayerItemCount(cid, 2227) >= 3 then
   
       local pPos = getPlayerPosition(cid)
       doPlayerRemoveItem(cid, 12428, 30)
       doPlayerRemoveItem(cid, 10609, 10)
       doPlayerRemoveItem(cid, 2227, 3)
       doPlayerAddOutfit(cid,128,1)
       doPlayerAddOutfit(cid,136,1)
       doSendMagicEffect(pPos, 20)
       setPlayerStorageValue(cid,807,1)
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "First Citizen Addon")
     else
       doCreatureSay(cid, "You do not have the required items!", TALKTYPE_ORANGE_1)
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
     end
   else
     doCreatureSay(cid, "You already posses citizen addon!", TALKTYPE_ORANGE_1)
   end
end
return TRUE
end

3rd edit

this one must be working :D
 
Last edited:
Ye it worked but theres still a problem. When I right click the sign. If I have 30 of the item 12428 it takes the 30 away and doesnt give anything.. If i have any of the other items it doesnt take them unless i have all collected.. so theres a problem with the first 30 that just get taken regardless
 
Now it says you dont have the required items every time i click it even if i have the items. wanna login on the server and try and help me?

if ur free that is cause i got a bit of stuff i need help with
 
Last edited by a moderator:
what tfs do you use? it works perfect on my server, tested without any bugs

make sure u got all items in your bp
 
Code:
local c = {[0] = 136, [1] = 128}
local i = {{12428, 30}, {10609, 10}, {2227, 3}}

function onUse(cid, item, fromPosition, itemEx, toPosition)
     local s = c[getPlayerSex(cid)]

     if itemEx.itemid == 1434 then
         if canPlayerWearOutfit(cid, s, 1) then
             doPlayerSendCancel(cid, "You already have the first Citizen addon.")
             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
             return true
         end
         local n = 0
         for x = 1, #i do
             if getPlayerItemCount(cid, i[x][1]) >= i[x][2] then
                 n = n + 1
             end
         end
         if n == #i then
             for r = 1, #i do
                 doPlayerRemoveItem(cid, i[r][1], i[r][2])
             end
             doPlayerAddOutfit(cid, s, 1)
             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_SOUND_RED)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "First Citizen Addon")
         else
             doCreatureSay(cid, "You do not have the required items!", TALKTYPE_ORANGE_1)
             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
         end
     end
     return true
end
 

Similar threads

Back
Top