The class
PHP Code:
function onActionBuyWep()
{
player.chat = "trigger2";
}
//#CLIENTSIDE
function onCreated()
{
setshape( 1, 32, 32 );
setimg( this.image );
setTimer( 0.05 );
}
function onActionMouseClick()
{
showGui();
client.shopid = this.id;
}
function onMouseDown( button )
{
if ( button == "left" )
{
triggeraction( mousex, mousey, "MouseClick", player.account );
}
}
function onTimeOut()
{
chat = this.stockamm;
if ( this.stock == true )
{
this.stockamm = makevar( this.stockvar );
}
setTimer( 0.05 );
}
function showGUI()
{
// GUI is here, works fine
}
function Shop_Buy.onAction()
{
if ( client.shopid == this.id )
{
if ( player.rupees >= this.realprice )
{
triggeraction( this.x, this.y, "BuyWep");
}
else
{
player.chat = "You cannot afford this!";
}
}
}
The local NPC that joins it ...
PHP Code:
join( "shoptest" );
//#CLIENTSIDE
function onCreated()
{
this.image = "block.png";
this.weaponname = "Items/Explosives";
this.itemname = "Plastic Explosives";
this.itemprice = 100;
}