Action Addon Scroll!

Zonet

Web Developer
Joined
Sep 1, 2008
Messages
4,375
Best answers
0
Reaction score
38
Location
realpath( dirname( __FILE__ ) );
This is my first script i made!

This is a addon scroll script.
also you get addon by simply click on a item!

If you are using a donation server you can make this item so player can buy addons with Gesiors shop.

Here is it.

First go to data/action/scripts[ Create script, name it addon.lua
Now open the script and add this.


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		
if getPlayerStorageValue(cid,1800) == 10 then
			doCreatureSay(cid, "You already got the second addon", TALKTYPE_ORANGE_1)

	else if getPlayerLevel(cid) >= 10 then
		doCreatureSay(cid, "You received the first addon and the second addon, Thanks for buying.", TALKTYPE_ORANGE_1)
			doPlayerAddAddons(cid, 3)
			doSendMagicEffect(fromPosition, 37)
			doRemoveItem(item.uid)
			setPlayerStorageValue(cid,1800,20)
			return TRUE
		else
					doCreatureSay(cid, "You must be level 10 to get the second addon", TALKTYPE_ORANGE_1)
		end
end
end
Code:
doPlayerAddAddons(cid, 3) <--- this means which addon player should get
3=both 1=first 2=second 
also if you want the player use the scroll one time then 
change the setPlayerStorageValue(cid,1800,20) to setPlayerStorageValue(cid,1800,10)
Now go to data/action/action.xml

Under:
Code:
<actions>
Add:
Code:
	<action itemid="6527" script="addon.lua"/>
<action itemid="6527" <--- this id is the id of the scroll... you can change to the item you want the scroll be...


Thank you, dont forget this is only my first script.
 

bomba

Member
Joined
Feb 26, 2008
Messages
635
Best answers
0
Reaction score
6
Location
Brazil
I like of addons...
Look my script:
Code:
 local female = 0
 local male = 1

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerSex(cid) == female then
	if getPlayerStorageValue(cid, 16344) == TRUE then
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but you already have this addon.")
	 elseif getPlayerStorageValue(cid, 16344) == FALSE then
	   doPlayerAddOutfit(cid, 136, 1)
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you received the first 'citizen' addon.")
	   doRemoveItem(item.uid)
	   setPlayerStorageValue(cid, 16344, TRUE)

	 elseif getPlayerSex(cid) == male then
	if getPlayerStorageValue(cid, 16344) == TRUE then
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but you already have this addon.")
	 elseif getPlayerStorageValue(cid, 16344) == FALSE then
	   doPlayerAddOutfit(cid, 128, 1)
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you received the first 'citizen' addon.")
	   doRemoveItem(item.uid)
	   setPlayerStorageValue(cid, 16344, TRUE)
  end
 end
  return TRUE
end
 

Skar

New Member
Joined
Aug 11, 2008
Messages
59
Best answers
0
Reaction score
0
Location
Mexico
I make this script based in your script
but I have 1 problem, after logout character the addon no save
the character need use a new scroll for addon =/

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		
if getPlayerStorageValue(cid,1800) == 10 then
			doCreatureSay(cid, "You already got the first addon", TALKTYPE_ORANGE_1)

	else if getPlayerLevel(cid) >= 10 then
		doCreatureSay(cid, "You received the first addon Demon Hunter.", TALKTYPE_ORANGE_1)
			doPlayerAddOutfit(cid, 289, 1)
                        doPlayerAddOutfit(cid, 288, 1)
			doSendMagicEffect(fromPosition, 37)
			doRemoveItem(item.uid)
			setPlayerStorageValue(cid,1800,20)
			return TRUE
		else
					doCreatureSay(cid, "You must be level 10 to get the second addon", TALKTYPE_ORANGE_1)
		end
end
end

Help :p
 

justin234

New Member
Joined
Jan 22, 2008
Messages
999
Best answers
0
Reaction score
3
Very Cool.
I can use this for lots of things...

Thank You!
 

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Best answers
0
Reaction score
23
Location
Norway
not too bad... u can remove an end by writing elseif instead of else if..

my version:
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(cid)	
	if getPlayerStorageValue(cid, 1800) == TRUE then
			doCreatureSay(cid, "You have already used this scroll.", TALKTYPE_ORANGE_1)
	else
		doCreatureSay(cid, "You received the first addon and the second addon!", TALKTYPE_ORANGE_1)
		doSendAnimatedText(pos, "Addons!", math.random(1, 215))
		doPlayerAddAddons(cid, 3)
		setPlayerStorageValue(cid, 1800, TRUE)
		doRemoveItem(item.uid)
		for i=1,30 do
			doSendDistanceShoot(pos, {x = pos.x + math.random(-7, 7), y = pos.y + math.random(-5, 5), z = pos.z}, 4)
		end
	end
	return TRUE
end
dunno why you had level checker... probably cuz u took the basics from 1337 scroll scripts and changed the function lol :p
 

Skar

New Member
Joined
Aug 11, 2008
Messages
59
Best answers
0
Reaction score
0
Location
Mexico
Ehmm, if your not working which is based on my.. why not just using my ?
:$

I only use scroll for addons of demon hunter outfit
no use for alls
I make quest of demon hunter addon =P
but why no save ? :(
 

Skar

New Member
Joined
Aug 11, 2008
Messages
59
Best answers
0
Reaction score
0
Location
Mexico
It should be like this instead of
change to:
Yeah Im make this:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		
if getPlayerStorageValue(cid,1800) == 10 then
			doCreatureSay(cid, "You already got the first addon", TALKTYPE_ORANGE_1)

	else if getPlayerLevel(cid) >= 10 then
		doCreatureSay(cid, "You received the first addon Demon Hunter.", TALKTYPE_ORANGE_1)
			doPlayerAddOutfit(cid, 289, 1)
                        doPlayerAddOutfit(cid, 288, 1)
			doSendMagicEffect(fromPosition, 37)
			doRemoveItem(item.uid)
			setPlayerStorageValue(cid,1800,20)
			return TRUE
		else
					doCreatureSay(cid, "You must be level 10 to get the second addon", TALKTYPE_ORANGE_1)
		end
end
end
But if the player logout the addons delete
addons no save
 

Knutt

mapper/scripter
Joined
Jan 25, 2009
Messages
23
Best answers
0
Reaction score
0
Location
Germany/Hamburg
nice but if i put this in addon.lua where did i put my addoner then ^.-
 

justin234

New Member
Joined
Jan 22, 2008
Messages
999
Best answers
0
Reaction score
3
@up,
make another file...

@topic,
This will work with [7.6] Avesta?
I was told its based off of tfs.
 

dabaflow

New Member
Joined
May 22, 2008
Messages
277
Best answers
0
Reaction score
0
Btw, its good if adding "doremoveitem" or else the player can just send it around after use.
 

Nixtronx

New Member
Joined
Nov 28, 2007
Messages
18
Best answers
0
Reaction score
0
Location
Chile
take :p

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid,1800) == 10 then
doCreatureSay(cid, "You already got the addons", TALKTYPE_ORANGE_1)

else if getPlayerLevel(cid) >= 0 then
doCreatureSay(cid, "Felicidades has obtenido los addons de Demon Hunter.", TALKTYPE_ORANGE_1)
doPlayerAddOutfit(cid, 289, 2)
doPlayerAddOutfit(cid, 288, 2)
doPlayerAddOutfit(cid, 289, 1)
doPlayerAddOutfit(cid, 288, 1)
setPlayerStorageValue(cid,demon,2)
doSendMagicEffect(fromPosition, 37)
doRemoveItem(item.uid)
setPlayerStorageValue(cid,1800,20)
return TRUE
else
end
end
end
 
Top