viewing paste Unknown #6901 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
/*=========================================================
@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;
    
}
Viewed 1328 times, submitted by Guest.