My very first script, I have been reading a littlebit around on how to make scripts, so I decided, I was going to try and make my own script. So here it is guys!
Also, dont judge, if you see any mistakes please let me know, and yes there is no config for this so if you want to change something in it, you will have to do it by hand.
First, create a file named "shoplever.lua" or whatever you want to call your file, paste this in it.
Then, paste this in you Actions.xml
Now you can start placing the levers on the map you will be using, you may notice that I use a special kind of lever.
So what you want to do next is hit that J button to get up Jump to brush, and you want to write this in it, and select the lever and hit ok.
I noticed that the pictures were very small so I typed in 10029, its the ItemID for the lever that I used.
Place it where you want the lever to be, I made a room full of these levers as you can see on the picture.
Then you want to set the actionID and the UniqueID to these lever to the following
The Sudden Death lever = ActionID 23232 UniqueID 23232
The Great Mana Potion lever = ActionID 23233 UniqueID 23233
The Ultimate Health Potion lever = ActionID 23234 UniqueID 23234
The Great Spirit Potion lever = ActionID 23235 UniqueID 23235
The Strong Health Potion lever = ActionID 23236 UniqueID 23236
The Strong Mana Potion lever = ActionID 23237 UniqueID 23237
Put them in as shown in this picute below demonstrating on the Sudden Death lever.
And there you have it! My very first script!
You might want to put a price list aswell
Also, dont judge, if you see any mistakes please let me know, and yes there is no config for this so if you want to change something in it, you will have to do it by hand.
First, create a file named "shoplever.lua" or whatever you want to call your file, paste this in it.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 10029 and getPlayerMoney(cid) >= 10000 and item.uid == 23232 then
doTransformItem(item.uid, item.itemid + 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 2268, 100)
doPlayerSendCancel(cid,"You have bought 100 Sudden Deaths for 10000 gold.")
elseif item.itemid == 10030 and getPlayerMoney(cid) >= 10000 and item.uid == 23232 then
doTransformItem(item.uid, item.itemid - 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 2268, 100)
doPlayerSendCancel(cid,"You have bought 100 Sudden Deaths for 10000 gold.")
elseif item.itemid == 10029 and getPlayerMoney(cid) >= 10000 and item.uid == 23233 then
doTransformItem(item.uid, item.itemid + 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 7590, 100)
doPlayerSendCancel(cid,"You have bought 100 Great Mana Potions for 10000 gold.")
elseif item.itemid == 10030 and getPlayerMoney(cid) >= 10000 and item.uid == 23233 then
doTransformItem(item.uid, item.itemid - 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 7590, 100)
doPlayerSendCancel(cid,"You have bought 100 Great Mana Potions for 10000 gold.")
elseif item.itemid == 10029 and getPlayerMoney(cid) >= 25000 and item.uid == 23234 then
doTransformItem(item.uid, item.itemid + 1)
doPlayerRemoveMoney(cid, 25000)
doPlayerAddItem(cid, 8473, 100)
doPlayerSendCancel(cid,"You have bought 100 Ultimate Health Potions for 25000 gold.")
elseif item.itemid == 10030 and getPlayerMoney(cid) >= 25000 and item.uid == 23234 then
doTransformItem(item.uid, item.itemid - 1)
doPlayerRemoveMoney(cid, 25000)
doPlayerAddItem(cid, 8473, 100)
doPlayerSendCancel(cid,"You have bought 100 Ultimate Health Potions for 25000 gold.")
elseif item.itemid == 10029 and getPlayerMoney(cid) >= 19000 and item.uid == 23235 then
doTransformItem(item.uid, item.itemid + 1)
doPlayerRemoveMoney(cid, 19000)
doPlayerAddItem(cid, 8472, 100)
doPlayerSendCancel(cid,"You have bought 100 Great Spirit Potions for 19000 gold.")
elseif item.itemid == 10030 and getPlayerMoney(cid) >= 19000 and item.uid == 23235 then
doTransformItem(item.uid, item.itemid - 1)
doPlayerRemoveMoney(cid, 19000)
doPlayerAddItem(cid, 8472, 100)
doPlayerSendCancel(cid,"You have bought 100 Great Spirit Potions for 19000 gold.")
elseif item.itemid == 10029 and getPlayerMoney(cid) >= 10000 and item.uid == 23236 then
doTransformItem(item.uid, item.itemid + 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 7588, 100)
doPlayerSendCancel(cid,"You have bought 100 Strong Health Potions for 10000 gold.")
elseif item.itemid == 10030 and getPlayerMoney(cid) >= 10000 and item.uid == 23236 then
doTransformItem(item.uid, item.itemid - 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 7588, 100)
doPlayerSendCancel(cid,"You have bought 100 Strong Health Potions for 10000 gold.")
elseif item.itemid == 10030 and getPlayerMoney(cid) >= 10000 and item.uid == 23237 then
doTransformItem(item.uid, item.itemid - 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 7589, 100)
doPlayerSendCancel(cid,"You have bought 100 Strong Mana Potions for 10000 gold.")
elseif item.itemid == 10029 and getPlayerMoney(cid) >= 10000 and item.uid == 23237 then
doTransformItem(item.uid, item.itemid + 1)
doPlayerRemoveMoney(cid, 10000)
doPlayerAddItem(cid, 7589, 100)
doPlayerSendCancel(cid,"You have bought 100 Strong Mana Potions for 10000 gold.")
else
doPlayerSendTextMessage(cid,21,"You need more gold.")
end
return TRUE
end
Then, paste this in you Actions.xml
Code:
<action actionid="23232" event="script" value="shoplever.lua"/>
<action actionid="23233" event="script" value="shoplever.lua"/>
<action actionid="23234" event="script" value="shoplever.lua"/>
<action actionid="23235" event="script" value="shoplever.lua"/>
<action actionid="23236" event="script" value="shoplever.lua"/>
<action actionid="23237" event="script" value="shoplever.lua"/>
Now you can start placing the levers on the map you will be using, you may notice that I use a special kind of lever.
So what you want to do next is hit that J button to get up Jump to brush, and you want to write this in it, and select the lever and hit ok.
I noticed that the pictures were very small so I typed in 10029, its the ItemID for the lever that I used.
Place it where you want the lever to be, I made a room full of these levers as you can see on the picture.
Then you want to set the actionID and the UniqueID to these lever to the following
The Sudden Death lever = ActionID 23232 UniqueID 23232
The Great Mana Potion lever = ActionID 23233 UniqueID 23233
The Ultimate Health Potion lever = ActionID 23234 UniqueID 23234
The Great Spirit Potion lever = ActionID 23235 UniqueID 23235
The Strong Health Potion lever = ActionID 23236 UniqueID 23236
The Strong Mana Potion lever = ActionID 23237 UniqueID 23237
Put them in as shown in this picute below demonstrating on the Sudden Death lever.
And there you have it! My very first script!
You might want to put a price list aswell