• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Item Reward Premium

Nightss

Normal People
Joined
May 18, 2013
Messages
55
Reaction score
12
Location
Mexicali
Hello, I Created This Script For Me Server,This Item Or Action Hace You 15 Days Premium Or You Can Edit The Days :D

Actions/scripts
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
   local text = "You Have A 15 Days Premium!"
   local days = "15" 

    doPlayerAddPremiumDays(cid, days)
     doPlayerSendTextMessage(cid, text)

   end
    return TRUE
end

In Scripts.xml;
XML:
<action itemid="XXXX" event="script" value="PremmyDays.lua" />

Credits;
100% Me :D
 
Last edited:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local days = 15 
return doPlayerSendTextMessage(cid, "You Have A "..days.." Days Premium!") and doPlayerAddPremiumDays(cid, days <= 0 and 1 or days)
end
 
this script not work in my server ;/

i click item and see only " You cannot use this item "
 
Then you added it wrong in actions.xml.
Look at other actions.xml lines for example and add it the same way.
If your server is using script="other/premiumscroll.lua"/>
Then add it like that and not with event and value.
 
now i have error in console :
Code:
Warning: [Event::loadScript] Can not load script. data/actions/scripts/other/premiumscroll.lua
data/actions/scripts/other/premiumscroll.lua:11: '' expected near 'end'

Edit :

Second error :

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/premiumscroll.lua:onUse

luaDoPlayerSendTextMessage(). Player not found
 
Last edited:
If you are using the one Nightss: local days = 15
Without string and remove the end above return true, but you can also just use the one Critico posted.
 
i now use Critico script and have error :

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/premiumscroll.lua:onUse

luaDoPlayerSendTextMessage(). Player not found

i delete line luaDoPlayerSendTextMessage and now work premium scroll as this item not lost on use ;/
 
Oh, Critico forgot to write the message type
Code:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Have A "..days.." Days Premium!")

To remove the item you click use on in an action script.
Code:
doRemoveItem(item.uid, 1)
 
Last edited:
Back
Top