HoS_PRC8/_mod/_module/nss/squadl_join_sq3.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

31 lines
1.2 KiB
Plaintext

// squadl_join_sq3 - Make this player join this squad
#include "color_header"
void main()
{
int nNum=3;
object oPC=GetPCSpeaker();
string sID=GetLocalString(oPC,"sTeamID");
object oMod=GetModule();
object oSQL=GetLocalObject(oMod,"oSquadLead"+sID+IntToString(nNum));
object oTarget=GetLocalObject(oPC,"oTarget");
int nPrev=GetLocalInt(oTarget,"nSquadNum");
SetLocalInt(oTarget,"nSquadNum",nNum);
sID="You have been assigned to the squad lead by "+GetName(oSQL)+". For the good of your team try to stay with them and assist them as they ask.";
sID=ColorRGBString(sID,0,4,1);
SendMessageToPC(oTarget,sID);
sID=GetName(oTarget)+" has been assigned to your squad. Try to keep them with you and use them to the best of your abilities.";
sID=ColorRGBString(sID,0,4,1);
SendMessageToPC(oSQL,sID);
if (nPrev!=0&&nPrev!=nNum)
{ // notify previous squad leader
oSQL=GetLocalObject(oMod,"oSquadLead"+sID+IntToString(nPrev));
if (GetIsObjectValid(oSQL))
{ // tell old squad leader
sID=GetName(oTarget)+" has been removed from your squad and assigned to a different one.";
sID=ColorRGBString(sID,0,4,1);
SendMessageToPC(oSQL,sID);
} // tell old squad leader
} // notify previous squad leader
}