View Single Post
  #2  
Old 02-06-2008, 02:13 AM
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
You could just create a class with a public function and join it to your weapon/weapons like

Class - Bankfunc
PHP Code:
public function getBalance(acct)
{
  
doStuff();
  return 
temp.riches;

Weapon
PHP Code:
function onCreated()
{
  
this.join("Bankfunc");
  
temp.result Bankfunc::getBalance("Twinny"); //Note: Bankfunc:: was to get the idea through: not necessary unless multiple cases of getBalance()
  
printf("Balance: $i"temp.result); //replace $ with percent sign

You could also make a global object join the class:

System
PHP Code:
function onCreated()
{
  
Bank = new TStaticVar();
  
Bank.join("Bankfunc");

Now you could simply do Bank.getBalance() from any script serverside. I don't find it ideal really but it works.

Last edited by Twinny; 02-06-2008 at 02:24 AM..
Reply With Quote