[-]
Shout:
Click Refresh to load shouts.

Post Reply 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[LUA & OT] Using a Knowledge Parchment
01-14-2009, 03:48 PM (This post was last modified: 01-15-2009 11:42 AM by Jesper_Kladden. Edit Reason: )
Post: #1
[LUA & OT] Using a Knowledge Parchment
This is basicly what it does:

*Checks if the player level is less then 80, if it is you can't use it.
*Adds experience to the player

PHP Code:
local EXP 2000000 -- Amount of EXP to get 
local MESSAGE 
"Earned: 2 000 000 Experience points because of reading this very interresting text." -- The Message to get 
local ID 
1948 -- Parchment 
local CMESSAGE 
"Sorry, minimum level 80 to understand what the inscription says" -- The cancel message to get 
local PDAYS 
-- The amount of days to add to the premium account

function onUse(ciditemfrompositem2topos) -- The Function 
if 
getPlayerLevel(cid) < 80 then -- If the player is less than 80 then do 
doPlayerSendTextMessage(cid23CMESSAGE) -- Send a cancel message that it didn't work 
else   
if item.itemid == ID then -- If the ItemID equals to correct ID then continue 
doPlayerAddExp(cid, EXP) -- Add the Experience to the player 
doPlayerSendTextMessage(cid, 23, MESSAGE) -- Send a text message that everything went well 
doPlayerAddPremiumDays(cid, PDAYS) -- Adds premium account days to the account
doRemoveItem(item.uid, 1) -- Remove the item so you can'
use it over and over again 
end 
return TRUE 
end 
end 

This should be in actions.xml

PHP Code:
<action itemid="1948" script="other/knowledgeparchment.lua"/> 




The code is basicly self explaining (I've written some also)


Rate it , I've been doing LUA for 3 days Big Grin

[Image: image.php?type=sigpic&amp;userid=761...1230799621]
[Image: buttonug.png]
[Image: amini]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[LUA &amp; OT] Using a Knowledge Parchment - Jesper_Kladden - 01-14-2009 03:48 PM


Contact UsTProgrammingReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication