/*=========================================================
@party
by Glitch [Via]
===========================================================
Description:
Allows party creation by atcommand (@). Requies source mods
for script commands 'makeparty' and 'leaveparty'. Can be
used as a charcommand (#) as well.
Special thanks to Haruna for providing the necessary source
modifications to make this functional.
=========================================================*/
- script modparty -1,{
OnMakeParty:
// Intialize party name
.@partyname$ = .@atcmd_parameters$[0];
// Determine if party name has a space
if (getarraysize(.@atcmd_parameters$) > 1)
{
// Build the party name with additional strings until complete
for (.@i = 1; .@i < getarraysize(.@atcmd_parameters$); .@i++)
.@partyname$ += " "+ .@atcmd_parameters$[.@i];
}
// Check if player is already in a party
if (getcharid(1))
{
message strcharinfo(0), "You are already in a party!";
message strcharinfo(0), "@party failed.";
}
// Check if no party name was input
else if (.@partyname$ == "")
{
message strcharinfo(0), "Please input a party name (usage: @party <Party Name>).";
message strcharinfo(0), "@party failed.";
}
else
{
// Create the party
makeparty .@partyname$;
// Check if party creation was unsuccessful
if (!getcharid(1))
{
message strcharinfo(0), "@party failed.";
end;
}
// Inform player of successful party creation
message strcharinfo(0), "Party '"+ .@partyname$ +"' was successfully created.";
}
end;
OnLeaveParty:
// Check if player is not in a party
if (!getcharid(1))
{
message strcharinfo(0), "You are not in a party!";
message strcharinfo(0), "@leaveparty failed.";
}
else
{
// Leave the party
leaveparty;
// Inform player of successful party leave
message strcharinfo(0), "You have left the party.";
}
end;
OnWhisperGlobal:
// Whisper anything to initialize settings
message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";
OnInit:
// Create commands @party and @leaveparty
bindatcmd "party", strnpcinfo(3) +"::OnMakeParty", 0, 80;
bindatcmd "leaveparty", strnpcinfo(3) +"::OnLeaveParty", 0, 80;
end;
}