Ancordia_PRC8/_module/nss/house_authchar.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

40 lines
1.7 KiB
Plaintext

#include "x4_inc_functions"
void main()
{
object oPC = GetPCSpeaker();
object oModule = GetModule();
string sDatabase = GetLocalString(oModule, "DB");
string sHouse = GetLocalString(oPC, "HouseToSell");
string sLogin = GetStringLowerCase(GetPCPlayerName(oPC));
string sCharacter = GetLocalString(oPC, "CharName");
int nAuthPosition;
string sAuth1 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_1");
string sAuth2 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_2");
string sAuth3 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_3");
string sAuth4 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_4");
string sAuth5 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_5");
string sAuth6 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_6");
string sAuth7 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_7");
string sAuth8 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_8");
string sAuth9 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_9");
string sAuth10 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_10");
if (sAuth1 == "") {nAuthPosition = 1;}
else if (sAuth2 == "") {nAuthPosition = 2;}
else if (sAuth3 == "") {nAuthPosition = 3;}
else if (sAuth4 == "") {nAuthPosition = 4;}
else if (sAuth5 == "") {nAuthPosition = 5;}
else if (sAuth6 == "") {nAuthPosition = 6;}
else if (sAuth7 == "") {nAuthPosition = 7;}
else if (sAuth8 == "") {nAuthPosition = 8;}
else if (sAuth9 == "") {nAuthPosition = 9;}
else if (sAuth10 == "") {nAuthPosition = 10;}
//Authorize the character
string sAuthPosition = IntToString(nAuthPosition);
SetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_"+sAuthPosition, "PC_"+sLogin+"_"+sCharacter);
}