Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-28-2007, 06:49 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
One last thing. ><
I cant get the weapon to add to the player. =/
I have tried everything....whats wrong with this?

HTML Code:
//#CLIENTSIDE
function onCreated(){
setTimer(.05);
}
function onActionLeftMouse(){
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 >[email protected]){
client.money -=this.price;
triggeraction(0,0,"serverside","-Shop","addw",@this.item);
}
}
-Shop npc:
HTML Code:
function onActionServerside(){
 if (params[0] == "addw") {
addweapon(@params[1]);
      }
    }
Reply With Quote
  #2  
Old 04-28-2007, 07:01 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by oo_jazz_oo View Post
One last thing. ><
I cant get the weapon to add to the player. =/
I have tried everything....whats wrong with this?
My guess is this little bit right here

PHP Code:
triggeraction(0,0,"serverside","-Shop","addw",@this.item); 
for one you dont need the @ at the start of the param, nor do you need it on the serverside (addweapon).
You never actually set anywhere in any of your script what this.item is.

but if you did trying

PHP Code:
triggeraction(00"serverside""-Shop""addw"thiso.item); 
and

PHP Code:
function onActionServerside() {
 if (
params[0] == "addw") {
  
addweapon(params[1]);
 }

was what you were looking for?

Edit:

It also seems to me like you almost by Habit use @ at the start of variables for example

PHP Code:
if (client.money >=@this.price){ 
Might not work? Anyways that could/should be rewritten as

PHP Code:
if (client.money >= this.price){ 
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.