in the item you are clicking on, you need this:
PHP Code:
function onActionRightMouse(){ //or if you want left click, switch Right for Left ;]
triggerClient("weapon", "<WEAPONNAME>", "actionorwhatever", additional params available);
}
and then in your weapon you will need to check for the trigger...
ex:
PHP Code:
//#CLIENTSIDE
function onActionClientside(actionorwhateverhere, additionalparamspossible..)
{
//can do conditional or switch statement depending on the actionorwhatever
//and how many things you want to check here..
displayPurchaseMenu(); // or whatever you want to call the function to display your menu
}
Be careful here, because you need to set up some serverside security as well, such as checking to ensure that the item the client is sending that they want to purchase is the correct item, as well as the price is the correct price that it should be (check a DB or something that stores the price information serverside so that it can not be manipulated). The reason for the additional security is because someone could essentially buy anything they wanted for FREE if all of the purchasing was handled on the clientside (adding items and things should be handled on serverside anyway)
--Hopefully someone can chime in with better examples of the above paragraph, as I have not fooled with it recently. ;]
Here are a few examples and helpful posts:
Skyld's Shop Script
That one is somewhat outdated, but still relevant (note, the triggeraction used there has since been replaced -> use triggerClient instead)
Also, it might be noted, that Skyld's example stores the items information in a Database (multiple) -- This could now be redone to support SQLite..
Also, some helpful posts for triggering:
Serverside / Clientside actions explained
http://forums.graalonline.com/forums...84&postcount=6
good trigger examples both ways:
http://forums.graalonline.com/forums...17&postcount=4
Trigger DB from Level NPC
http://forums.graalonline.com/forums...41&postcount=9