View Single Post
  #26  
Old 04-29-2007, 03:30 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by oo_jazz_oo View Post
Still wont work. =/
Its the triggeraction that isnt working...cause, if you replace
ShopFunctions.addShopItem(params[1]);
with
player.chat = "Test";
Nothing happens, so there is a problem in the triggeraciotn. -.-
two things

first:
I changed the styling and some vars from the original (your script), but didn't see this:
PHP Code:
if (client.money >= this.price){ 
try change it to
PHP Code:
if (client.money >= thiso.price){ 
(They are right before the triggeraction)

second:

change addWeapon(params[1]); to addWeapon(item); in ShopFunctions,
I was using params[1] because I was thinking of the class (params[1] was the item there)

class "shops":
PHP Code:
function onCreated()
  
sethape(1, 32, 32); // you need a shape for triggeractions

function onActionServerside()
{
  if (
params[0] == "addw")
    
ShopFunctions.addShopItem(params[1]);
}
//#CLIENTSIDE
function onCreated()
{
  
sethape(1, 32, 32); // you need a shape for triggeractions
  
setTimer(0.05);
}
function 
onMouseDown(button)
{
  if (
button == "left")
    
openShopGui();
}
function 
openShopGui()
{
  new 
GuiWindowCtrl(shopwin) {
    
profile = GuiBlueWindowProfile;
    
x = 10;
    
y = 100;
    
destroyonhide = true;
    
canresize = false;
    
canminimize = false;
    
canmaximize = false;
    
canclose = false;
    
canmove = true;
    
width = 160;
    
height = 140;
    
text = "";
    new 
GuiMLTextCtrl(shopitem) {
      
profile = GuiBlueMLTextProfile;
      
x = 0;
      
y = 25;
      
width = 160;
      
height = 1;
      
text = "<center>" @ thiso.itemname @ "</center>";
    }
    new 
GuiMLTextCtrl(shoppri) {
      
profile = GuiBlueMLTextProfile;
      
x = 0;
      
y = 45;
      
width = 160;
      
height = 1;
      
text = "<center>Price:</center>";
    }
    new 
GuiMLTextCtrl(shopprice) {
      
profile = GuiBlueMLTextProfile;
      
x = 0;
      
y = 65;
      
width = 160;
      
height = 1;
      
text = "<center>" @ thiso.price @ " $</center>";
    }
    new 
GuiFrameSetCtrl(Test_Frames) {
      
x = 10;
      
y = 65;
      
width = 140;
      
height = 15;
      
rowcount = 1;
      
columncount = 1;
      
setColumnOffset(1, 80);
      
setRowOffset(1, 80);
      
bordercolor = {128, 128, 255, 128};
      new 
GuiScrollCtrl(Test_Frame1) {
        
profile = GuiBlueScrollProfile;
        
hScrollBar = "dynamic";
        
vScrollBar = "dynamic";
      }
    }
    new 
GuiButtonCtrl("cancelb") {
      
profile = GuiBlueButtonProfile;
      
x = 10;
      
y = 90;
      
width = 50;
      
height = 20;
      
text = "Cancel";
    }
    new 
GuiButtonCtrl("buyb") {
      
profile = GuiBlueButtonProfile;
      
x = 100;
      
y = 90;
      
width = 50;
      
height = 20;
      
text = "Buy";
    }
  }
  
Test_Frames.PushtoBack();
}

function 
cancelb.onAction()
  
shopwin.destroy();

function 
buyb.onAction()
{
  if (
client.money >= thiso.price) { // Changed this to thiso
    
client.money -= this.price;
    
triggeraction(this.x + 0.5, this.y + 0.5, "serverside", "addw", thiso.item);
  }
} 
wnpc "ShopFunctions":
PHP Code:
public function addShopItem(temp.item)
  
addweapon(item); 
Quote:
Originally Posted by Rapidwolve View Post
It would be params[0] wouldn't it? either do addWeapon(params[0]) or addWeapon(temp.item)
You're right typo

should be addWeapon(item); in ShopFunctions



Quote:
Originally Posted by Inverness View Post
Actions occur on both sides as long as the object has a shape on both sides.
:O didn't know
__________________
Reply With Quote