Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Functions
- *
- * doClearParty( Account);
- * ** Clears the party strings, incase of errors
- *
- * doPurgeParty( [Party]);
- * ** Clears all members of a party
- * ** If party is left blank,
- * ** It clears all parties, and all members from it
- *
- * doCreateParty( Account);
- * ** Creates a party. With the leader Account
- *
- * doJoinParty( Party, Account);
- * ** Joins Account to Party.
- * ** If Party is not a 'Raid'
- * ** Party limit is 6. Else, its 20
- *
- * doLeaveParty( Party, Account);
- * ** Removes Account from Party
- * ** If the player was the last player in the party
- * ** The Party will automatically be purged.
- * ** If the player was the leader of the party
- * ** The leader will be passed.
- * ** It will pass to the person on the top of the list
- * ** Or if the leader was on the top, the second from.
- *
- * doPassLeader( Party, curLeader, nxtLeader);
- * ** Pass leader from curLeader to nxtLeader in Party.
- * ** curLeader must match the current leader.
- * ** nxtLeader must be in the party, and exist.
- */
- function onCreated()
- {
- // doClearParty( "Admin-Playerworld71");
- //doPurgeParty( "");
- // findPlayer("Hotrian").clientr.party = "";
- // doCreateParty( "Hotrian");
- // doJoinParty( 1, "AznLaoGuy");
- // doJoinParty( 1, "Admin-Playerworld71");
- // doJoinParty( 1, "monolord");
- // doJoinParty( 1, "slaytoda");
- // doJoinParty( 3, "Drastic Vendetta");
- //doLeaveParty( 1, "MysticalDragon", "kicked");
- //doPassLeader( 1, "Hotrian", "Admin-Playerworld71");
- this._StaySilent = false;
- }
- public function doPassLeader( pty, ldr, pl)
- {
- if ( this.("Parties_"@temp.pty@"_Leader") == temp.ldr )
- {
- temp.ind = "NOTHERE";
- for (temp.pt : this.("Parties_"@temp.pty)[1])
- {
- if ( temp.pt[0] == temp.pl )
- {
- temp.ind = this.("Parties_"@temp.pty)[1].index(@temp.pt);
- break;
- }
- }
- if (temp.ind == "NOTHERE")
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Was not in %s", name, temp.pl, temp.pty);
- return false;
- }
- this.("Parties_"@temp.pty@"_Leader") = temp.pl;
- }
- }
- public function doJoinParty( pty, pl)
- {
- p = findPlayer(@temp.pl);
- if (p.clientr.party[0] != NULL && p.clientr.party[0] != 0 && p.clientr.party[0] != "")
- { /* The player is in a party already! */
- if ( !this._StaySilent) printf("[ %s ]: %s is already in a party, %s.", name, temp.pl, p.clientr.party[0]);
- return false;
- }
- if (temp.pty == NULL || p == NULL || temp.pl == NULL)
- { /* The player is offline */
- if (p == NULL)
- {
- if ( !this._StaySilent) printf("[ %s ]: %s is not online.", name, temp.pl, temp.pty);
- } else printf("[ %s ]: %s didnt specify a party to join.", name, temp.pl, temp.pty);
- return false;
- }
- if ( this.("Parties_"@temp.pty@"_Leader") == NULL )
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Tried to join %s But no one was in that party.", name, temp.pl, temp.pty);
- return false;
- }
- if ( this.("Parties_"@temp.pty)[0] == "Party") temp.ptylimit = 6;
- else if ( this.("Parties_"@temp.pty)[0] == "Raid") temp.ptylimit = 20;
- if (this.("Parties_"@temp.pty)[1].size() < temp.ptylimit)
- {
- temp.array = { temp.pl, p.client.profile_health, p.client.profile_magic, p.headimg, p.attr[1], p.nick};
- this.("Parties_"@temp.pty)[1].add( @temp.array);
- if ( !this._StaySilent) printf("[ %s ]: %s Joined %s", name, temp.pl, temp.pty);
- p.clientr.party = { temp.pty, this.("Parties_"@temp.pty)};
- p.clientr.partyleader = this.("Parties_"@temp.pty@"_Leader");
- }
- if (!contains( p.joinedclasses, "h_party")) { p.join("h_party"); echo(p SPC "didn't join h_party; Joined him."); }
- p.addweapon( "-System/Party");
- }
- public function doLeaveParty( pty, pl)
- {
- p = findPlayer(@temp.pl);
- if (temp.pty == NULL || p == NULL || temp.pl == NULL)
- {
- if (p == NULL) {
- if ( !this._StaySilent) printf("[ %s ]: %s is not online.", name, temp.pl, temp.pty);
- } else if ( !this._StaySilent) printf("[ %s ]: %s didnt specify a party to leave.", name, temp.pl, temp.pty);
- return false;
- }
- temp.ind = "NOTHERE";
- for (temp.pt : this.("Parties_"@temp.pty)[1])
- {
- if ( temp.pt[0] == temp.pl )
- {
- temp.ind = this.("Parties_"@temp.pty)[1].index(@temp.pt);
- break;
- }
- }
- if (temp.ind == "NOTHERE")
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Was not in %s", name, temp.pl, temp.pty);
- return false;
- }
- if ( !this._StaySilent) printf("[ %s ]: %s Left %s", name, temp.pl, temp.pty);
- p.clientr.party = NULL;
- p.clientr.partyleader = NULL;
- if (this.("Parties_"@temp.pty)[1].size() > 1)
- {
- this.("Parties_"@temp.pty)[1].delete(temp.ind);
- } else {
- if ( !this._StaySilent) printf( "[ %s ]: (S)he was the last member, So the party was deleted.", name);
- this.("Parties_"@temp.pty) = new[0];
- this.("Parties_"@temp.pty@"_Leader") = NULL;
- return true;
- }
- if (this.("Parties_"@temp.pty@"_Leader") == temp.pl)
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Was the leader of %s", name, temp.pl, temp.pty);
- this.("Parties_"@temp.pty@"_Leader") = this.("Parties_"@temp.pty)[1][0][0];
- if ( !this._StaySilent) printf("[ %s ]: Leader passed to %s", name, this.("Parties_"@temp.pty@"_Leader"));
- }
- }
- public function doKickfromParty( pty, pl, placct)
- {
- if (this.("Parties_"@temp.pty@"_Leader") != temp.placct)
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Tried to kick %s from %s but was not the leader.", name, temp.placct, temp.pl, temp.pty);
- return false;
- }
- p = findPlayer(@temp.pl);
- if (temp.pty == NULL || p == NULL || temp.pl == NULL)
- {
- if (p == NULL)
- if ( !this._StaySilent) printf("[ %s ]: %s is not online.", name, temp.pl, temp.pty);
- return false;
- }
- temp.ind = "NOTHERE";
- for (temp.pt : this.("Parties_"@temp.pty)[1])
- {
- if ( temp.pt[0] == temp.pl )
- {
- temp.ind = this.("Parties_"@temp.pty)[1].index(@temp.pt);
- break;
- }
- }
- if (temp.ind == "NOTHERE")
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Was not in %s to be kicked from.", name, temp.pl, temp.pty);
- return false;
- }
- if ( !this._StaySilent) printf("[ %s ]: %s was kicked from %s", name, temp.pl, temp.pty);
- p.clientr.party = NULL;
- p.clientr.partyleader = NULL;
- if (this.("Parties_"@temp.pty)[1].size() > 1)
- {
- this.("Parties_"@temp.pty)[1].delete(temp.ind);
- } else {
- if ( !this._StaySilent) printf( "[ %s ]: (S)he was the last member, So the party was deleted.", name);
- this.("Parties_"@temp.pty) = new[0];
- this.("Parties_"@temp.pty@"_Leader") = NULL;
- return true;
- }
- if (this.("Parties_"@temp.pty@"_Leader") == temp.placct)
- {
- if ( !this._StaySilent) printf("[ %s ]: %s Was the leader of %s", name, temp.pl, temp.pty);
- this.("Parties_"@temp.pty@"_Leader") = this.("Parties_"@temp.pty)[1][0][0];
- if ( !this._StaySilent) printf("[ %s ]: Leader passed to %s", name, this.("Parties_"@temp.pty@"_Leader"));
- }
- }
- public function doCreateParty( pl)
- {
- p = findPlayer(@temp.pl);
- if (p.clientr.party[0] != NULL && p.clientr.party[0] != 0 && p.clientr.party[0] != "")
- { /* The player is in a a party already! */
- if ( !this._StaySilent) printf("[ %s ]: %s is already in a party, %s.", name, temp.pl, p.clientr.party[0]);
- return false;
- }
- thiso._NextParty ++;
- if ( p == NULL || temp.pl == NULL ) return false;
- this.("Parties_"@thiso._NextParty@"_Leader") = pl;
- this.("Parties_"@thiso._NextParty) = { "Party", {{ temp.pl, p.client.profile_health, p.client.profile_magic, p.headimg, p.attr[1], p.nick}}};
- p.clientr.party = { thiso._NextParty, this.("Parties_"@thiso._NextParty)};
- p.clientr.partyleader = this.("Parties_"@thiso._NextParty@"_Leader");
- if ( !this._StaySilent) printf("[ %s ]: Created: %s, Leader: %s", name, thiso._NextParty, temp.pl);
- if (!contains( p.joinedclasses, "h_party")) { p.join("h_party"); echo(p SPC "didn't join h_party; Joined him."); }
- p.addweapon( "-System/Party");
- // p.clientr.party = {"a", { "a", { "a", "b", "a", "b", }}}
- }
- public function doUpdateStats( pty, pl, hp, mp, head, hat, nick)
- {
- thiso.inparty = false;
- for (temp.pt : this.("Parties_"@temp.pty)[1])
- {
- if ( temp.pt[0] == temp.pl )
- {
- thiso.inparty = true;
- temp.ind = this.("Parties_"@temp.pty)[1].index(@temp.pt);
- this.("Parties_"@temp.pty)[1][temp.ind][1] = temp.hp;
- this.("Parties_"@temp.pty)[1][temp.ind][2] = temp.mp;
- this.("Parties_"@temp.pty)[1][temp.ind][3] = temp.head;
- this.("Parties_"@temp.pty)[1][temp.ind][4] = temp.hat;
- this.("Parties_"@temp.pty)[1][temp.ind][5] = temp.nick;
- break;
- }
- }
- if (thiso.inparty == false)
- {
- findPlayer(@temp.pl).clientr.party = NULL;
- findPlayer(@temp.pl).clientr.partyleader = NULL;
- return false;
- }
- findPlayer(@temp.pl).clientr.party = { temp.pty, this.("Parties_"@temp.pty)};
- findPlayer(@temp.pl).clientr.partyleader = this.("Parties_"@temp.pty@"_Leader");
- //printf("[ %s ]: %s sent new data: %s, %s, %s, %s, %s", name, temp.pl, temp.pty, temp.hp, temp.mp, temp.head, temp.hat);
- }
- public function doPurgeParty( pty)
- {
- if (temp.pty != NULL && temp.pty != "All")
- {
- for (temp.pl : this.("Parties_"@temp.pty))
- {
- findPlayer(@temp.pl).clientr.party = NULL;
- }
- this.("Parties_"@temp.pty) = "";
- }else
- {
- for (pl :allplayers) findplayer( @pl).clientr.party = NULL;
- thiso._NextParty = 0;
- for (temp.ptyy : getstringkeys("this.Parties_"))
- {
- for (temp.pl : this.("Parties_"@temp.ptyy)[1])
- {
- printf( "[ %s ]: %s was in %s." , name, temp.pl[0], temp.ptyy);
- findPlayer(@temp.pl[0]).clientr.party = NULL;
- }
- this.("Parties_"@temp.ptyy) = "";
- this.("Parties_"@temp.ptyy@"_Leader") = "";
- }
- }
- temp.ptyn = (temp.pty == NULL || temp.pty == "All") ? "All Parties" : temp.pty;
- printf("[ %s ]: Purged: %s", name, temp.ptyn);
- }
- public function doClearParty( acct)
- {
- if (temp.acct != NULL && temp.acct != "All")
- {
- findPlayer(@temp.acct).clientr.party = NULL;
- }else
- {
- for (temp.pl : allplayers)
- {
- printf( "[ %s ]: %s was in a party." , name, temp.pl);
- findPlayer(@temp.acct).clientr.party = NULL;
- }
- }
- temp.ptyn = (temp.acct == NULL || temp.acct == "All") ? "All Players" : temp.acct;
- printf("[ %s ]: Purged: %s", name, temp.ptyn);
- }
Add Comment
Please, Sign In to add comment