Log in

View Full Version : Credit Management


LordAdakos
10-17-2011, 03:54 PM
I was looking for a platinum sink, and figured that the translocator was much too free. So like the good capitalist I am, I decided to make people PAY to use him!

I want to charge 100pp per port, but I want the NPC to be able to take money in advance and hold it for the player, and keep a running total. I've seen this on other servers, but I cannot for the life of my figure out how to implement it.

I'm guessing I assign a global variable with the characters name and the amount they deposited - and then check that, subtract as necessary ....


But does anyone have an example of a credit system/ using global variables I could look at as an example? Even something simple?

joligario
10-17-2011, 07:24 PM
Use quest globals.

sub EVENT_ITEM {
my $cash = $platinum * 1000 + $gold * 100 + $silver * 10 + $copper;

if ($cash > 0) {
if (defined($qglobals{credit})) {
quest::setglobal("credit",$qglobals{credit}+$cash,0,"F");
}
else {
quest::setglobal("credit",$cash,0,"F");
}
}
else {
plugin::return_items(\%itemcount);
}
}

Didn't test or check this for errors, but it is something you can start with.

Akkadius
10-17-2011, 08:12 PM
http://www.eqemulator.org/forums/showthread.php?t=33661