Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-08-2009, 01:17 PM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
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.
Reply With Quote
  #2  
Old 07-08-2009, 01:30 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by [email protected] View Post
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).
__________________
Reply With Quote
  #3  
Old 07-08-2009, 01:35 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
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.
Reply With Quote
  #4  
Old 07-08-2009, 03:54 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
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.
Reply With Quote
Reply


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 03:26 PM.


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