UW2_PRC8/_module/nss/sfpb_deposit.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

36 lines
1.0 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Scarface's Persistent Banking
//:: sfpb_deposit
//:://////////////////////////////////////////////
/*
Written By Scarface
*/
//////////////////////////////////////////////////
#include "sfpb_config"
void main()
{
// Vars
object oPC = GetPCSpeaker(), oBanker = OBJECT_SELF;
string sID = SF_GetPlayerID(oPC);
string sAmount = GetLocalString(oBanker, "GOLD");
int nAmount = StringToInt(sAmount);
int nTotal;
// Anti-Cheat Check For Duping Gold
if (GetGold(oPC) >= nAmount)
{
// Take the deposited amount from the player and store
// in the database
TakeGoldFromCreature(nAmount, oPC, TRUE);
int nBanked = GetCampaignInt(GetName(GetModule()), DATABASE_GOLD + sID);
nTotal = nAmount + nBanked;
SetCampaignInt(GetName(GetModule()), DATABASE_GOLD + sID, nTotal);
}
else // Set Anti-Cheat Variable
SetLocalInt(oBanker, "ANTI_CHEAT", TRUE);
// Set custom token
SetCustomToken(1000, IntToString(nTotal));
}