Initial upload
Initial upload
This commit is contained in:
25
_module/nss/cs_takegold.nss
Normal file
25
_module/nss/cs_takegold.nss
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "cs_misc_function"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPlayer = GetItemActivatedTarget();
|
||||
int iGoldToTake = 10000;
|
||||
int iGoldOnPlayer = GetGold(oPlayer);
|
||||
int iGoldInBank = cs_GetGoldInBank(oPlayer);
|
||||
object oActivator = GetItemActivator();
|
||||
|
||||
//
|
||||
// Take the Gold from the player if they have enough to cover, if not, then
|
||||
// take it from their bank account giving them a negative balance if necessary.
|
||||
//
|
||||
if (GetIsPC(oPlayer)) {
|
||||
AssignCommand(oPlayer, TakeGoldFromCreature(iGoldToTake, oPlayer, TRUE));
|
||||
if (iGoldOnPlayer < iGoldToTake) {
|
||||
SendMessageToPC(oActivator, IntToString(iGoldOnPlayer) + " was taken from " + GetName(oPlayer) + ". The rest came out of their bank account.");
|
||||
cs_SetGoldInBank(oPlayer, iGoldInBank - (iGoldToTake - iGoldOnPlayer));
|
||||
} else {
|
||||
SendMessageToPC(oActivator, IntToString(iGoldToTake) + " was taken from " + GetName(oPlayer));
|
||||
}
|
||||
GiveGoldToCreature(oActivator, iGoldToTake);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user