In my module I have a banking system set up that records deposits to a database. The process of deposits and withdrawls that keep a balance to a player character has worked well for years and now I'd like to modify the system to take a 10% fee from the deposit before adding it to the PC's current bank balance. The deposit scripting is as follows:
#include "aps_include"
void main()
{
int dep=GetLocalInt(OBJECT_SELF, "deposit");
TakeGoldFromCreature(dep, GetPCSpeaker(), TRUE);
int balance=GetPersistentInt(GetPCSpeaker(), "cc_bank_gold");
SetPersistentInt(GetPCSpeaker(), "cc_bank_gold", dep+balance);
DeleteLocalInt(OBJECT_SELF, "deposit");
}
My questions are: What is the best way and the proper equation for subtracting 10% from the deposit and making that the amount that gets deposited?
Thanks for your help.
Modifié par Badwater, 22 mars 2011 - 07:22 .