Advertisement
Guest User

partyinvite [pan]

a guest
Dec 21st, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. //Usage: partyinvite <party id>;
  2. // Modified [pan]
  3. // @return 1    -> Successfully added
  4. // @return -1   -> Error adding member
  5. // @return -2   -> Party not found
  6. BUILDIN(partyinvite)
  7. {
  8.     int party_id, i = 0;
  9.     struct map_session_data *sd = script_rid2sd(st);
  10.     struct party_data *p;
  11.  
  12.     party_id = script_getnum(st,2);
  13.  
  14.     if ( sd )
  15.     {
  16.         // Search party struct
  17.         if( !(p = party->search(party_id)) )
  18.             script_pushint(st,-2); // Party not found
  19.         else
  20.         {
  21.             // Sort members
  22.             for( ; i < MAX_PARTY && !p->party.member[i].leader; i++);
  23.             if ( i != MAX_PARTY )
  24.             {
  25.                 // Add sd to party
  26.                 sd->party_joining = 1;
  27.                 sd->party_invite = party_id;
  28.                 sd->party_invite_account =  p->party.member[i].account_id;
  29.                 ( party->member_added(party_id,sd->status.account_id,sd->status.char_id,0) )? script_pushint(st,1) : script_pushint(st,-1);
  30.             }
  31.         }
  32.     }
  33.     return true;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement