Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   credit card script help. (https://forums.graalonline.com/forums/showthread.php?t=86765)

[email protected] 07-08-2009 01:17 PM

credit card script help.
 
Hello guys, Today I need some help on NPC control.


I have this bank script that I finally got working. It runs in 2 NPC-Controls.

1 is called Bank.

The other one is called BankDB.


So I got this new credit card script I am making, and basically, it allows you to use the money you have in the bank account, without having to go to the bank and saying /withdraw (amount). Just so I could make sure it works, I put a functionOnPlayerChats thing and made it to where if you say /credit balance, it shows your bank balance basically, since thats what your running off of. For some reason, It isnt showing the bank balance. How Can I make the weapon script called "Credit/Card" know what im talking about when I am talking about the bank balance? Is there a way you can do like findnpc("npcname");?

Someone tell me please.

Thanks.

cbk1994 07-08-2009 01:30 PM

Quote:

Originally Posted by [email protected] (Post 1505147)
findnpc("npcname");?

Absolutely, and that's the command. However, you should just do this:

PHP Code:

balance BankDB.getBalance(player.account); 

Change "BankDB" to whichever NPC stores the bank amounts, and change the function name (or change it to a variable).

Twinny 07-08-2009 01:35 PM

Ok,

When you create a new NPC in the NPCs section (has a lizard man picture), it is called a DBNPC: not a Control-NPC. Control-NPC is a specialized default DBNPC.

Now, I don't understand why you would need 2 DBNPCs for a bank...surely they could just be joined?

From the credit card weapon, you can call BankDB.publicfunction() serverside

soo....

PHP Code:

//BankDB
public function test()
{
  echo(
"Public Function Reached!");
  return 
true;


PHP Code:

//Credit Card Weapon
//blah blah

temp.test BankDB.test();
if (
temp.test)
  
player.chat "woo!";
else
  
player.chat "dammit =("

Of course, you could access the BankDB variables straight from the Credit card weapon using the BankDB.variable method but it depends what types of security you implement.

Gambet 07-08-2009 03:54 PM

I released a banking system on the code gallery years ago and I believe others have also released versions of their own banking system, you should take a look at those and see if you would want to incorporate any of those features to your system.

Don't take any of the scripts word-for-word copy-and-paste style because most of that stuff was released quite some time ago and could use rescripting.


All times are GMT +2. The time now is 03:36 PM.

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