Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Simple Chat-Based Bank (https://forums.graalonline.com/forums/showthread.php?t=72932)

killerogue 03-19-2007 09:10 AM

Simple Chat-Based Bank
 
Hey! I've been learning to script lately, and Twinny asked me to make a bank. So I've been working on this for about 30 mins or so with a bit of help from Twinny and some from PFA.

Not exactly working out.

The general idea is to open the account, deposit, withdraw or close the account all with chat.

PHP Code:

function onActionserverside() {

  if (
params[0] == "open") {
    
Test.(@"account_" player.account) += params[1];

}

  else if (
params[0] == "deposit") {
    
Test.(@"account_" player.account) += params[1];

}
 
  else if (
params[0] == "withdraw") {
    
Test.(@"account_" player.account) -= params[1];
 
  }
}
  
//#CLIENTSIDE
function onPlayerchats() {
  
  if (
player.chat == "/openbankaccount") {
    if(
player.gralats 300) {
      
player.gralats 300;
      
this.startmoney 300;
      
triggeraction(0,0,"serverside",this.name,"open",this.startmoney);
  }
}

  else if (
player.chat == "/closebankaccount") {
    
Test.(@"account_" player.account).clear();

}

  else if (
player.chat.starts("/deposit")) {
    
this.depmoney player.chat.substring(10);
    
triggeraction(0,0,"serverside",this.name,"deposit",this.depmoney);

}

  else if (
player.chat.starts("/withdraw")) {
    
this.witmoney player.chat.substring(11);
    
triggeraction(0,0,"serverside",this.name,"withdraw",this.witmoney);

  }



contiga 03-19-2007 09:29 AM

Test.( @ "account_" @ player.account).clear(); should be on the serverside, player.gralats should be player.rupees and should be moved to the serverside also.

Riot 03-19-2007 09:15 PM

Quote:

Originally Posted by contiga (Post 1290420)
player.gralats should be player.rupees and should be moved to the serverside also.

The wiki and scriptfunctions_client.txt state to use 'gralats' instead of 'rupees':
rupees - integer - better use 'gralats'

You should throw as much as this in the serverside as possible, if not all of it.

Angel_Light 03-19-2007 11:31 PM

instead of player.gralats/rupees use a clientr.var much better in my opnions. ^-^

killerogue 03-20-2007 12:18 AM

Quote:

Originally Posted by Angel_Light (Post 1290731)
instead of player.gralats/rupees use a clientr.var much better in my opnions. ^-^

Not sure how to use clientr.

Rapidwolve 03-20-2007 02:54 AM

replace player. with clientr.
to start off

Twinny 03-20-2007 06:31 AM

Quote:

Originally Posted by Angel_Light (Post 1290731)
instead of player.gralats/rupees use a clientr.var much better in my opnions. ^-^

Depends if the rest of his systems use player.gralats.... could be a nasty change ^^.

napo_p2p 03-20-2007 07:26 AM

Quote:

Originally Posted by Twinny (Post 1290896)
Depends if the rest of his systems use player.gralats.... could be a nasty change ^^.

Could download all the .txt/.nw files then do a mass find/replace I guess.

But sometimes player.rupees are desirable b/c writes to it are really easy to log.

Twinny 03-20-2007 07:45 AM

Quote:

Originally Posted by napo_p2p (Post 1290917)
But sometimes player.rupees are desirable b/c writes to it are really easy to log.

As soon as Stefan takes heed to my suggestion and brings protected vars, to hell with player.gralats! >_<


All times are GMT +2. The time now is 11:23 PM.

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