Thread: Party system
View Single Post
  #3  
Old 09-01-2011, 11:30 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
I'd personally do something like have a class called "party" or whatever else you want to name it with a few functions like addPlayer, removePlayer, getPlayers, invitePlayer etc.

then create a party by doing something like

PHP Code:
function newParty(){
  
temp.party = new TStaticVar("Party_"@player.account);
  
party.join("party");
  
party.addPlayer(player);

then in the class

PHP Code:
public function addPlayer(pobj){
  
pobj.party this;
  
this.members.add(pobj);

then when a player wants to invite someone, imagine by some chat command on the client that triggers the server with the account name

PHP Code:
function onActionServerside(cmdtarget){
  if(
cmd == "inv"){
    
player.party.invitePlayer(findplayer(target));
  }
  if(
cmd == "create"){
    
newParty();
  }

Reply With Quote