Emistry icon

[RO] WOE limit GTB per guild

Emistry | PRO | 01/10/22 02:19:08 PM UTC (Edited) | 0 ⭐ | 753 👁️ | Never ⏰ | []
C |

2.78 KB

|

None

|

0 👍

/

0 👎

// https://rathena.org/board/topic/130105-request-for-one-card-holder-per-guild/
 
 
-   script  Sample  -1,{
    
    OnInit:
        .item_id = 4128;
        setitemscript .item_id, "{ doevent \""+strnpcinfo(3)+"::OnEquip\"; }", 1;
        setitemscript .item_id, "{ doevent \""+strnpcinfo(3)+"::OnUnEquip\"; }", 2;
        
        setarray .map$, "prtg_cas01";
        .@map_size = getarraysize(.map$);
        for (.@i = 0; .@i < .@map_size; .@i++)
            setmapflag(.map$, MF_LOADEVENT);
            
        bindatcmd "gmreset",strnpcinfo(3) + "::OnAtcommand";
        end;
        
    OnAgitStart:
    OnAgitStart2:
    OnAgitStart3:
    OnAgitEnd:
    OnAgitEnd2:
    OnAgitEnd3:
        .is_woe_on = (agitcheck() || agitcheck2() || agitcheck3());
        end;
        
    OnPCLoadMapEvent:
        if (!isequipped(.item_id)) end;
    OnEquip:
        if (!.is_woe_on) end;
        if (inarray(.map$, strcharinfo(3)) == -1) end;
        .@guild_id = getcharid(2);
        if (.@guild_id) {
            .@current_cid = getd(".guild_gid_"+.@guild_id);
            
            if (.@current_cid == getcharid(0)) end;
            else if (!.@current_cid 
                || (!isloggedin(convertpcinfo(.@current_cid, CPC_ACCOUNT), .@current_cid))
            ) {
                setd(".guild_gid_"+.@guild_id, getcharid(0));
                
                addrid(3, 0, .@guild_id);
                dispbottom "Guild member '"+convertpcinfo(getd(".guild_gid_"+getcharid(2)), CPC_NAME)+"' has equipped "+getitemname(.item_id)+".";
                end;
            }
            else if (.@current_cid != getcharid(0)) {
                dispbottom "Guild member '"+convertpcinfo(.@current_cid, CPC_NAME)+"' has already equipped "+getitemname(.item_id)+". You can't equip it now.";
                message strcharinfo(0), getitemname(.item_id)+" unequipped!";
                unequip EQI_HAND_L;
            }
        }
        end;
        
    OnUnEquip:
        if (!.is_woe_on) end;
        .@guild_id = getcharid(2);
        if (.@guild_id) {
            if (getd(".guild_gid_"+.@guild_id) == getcharid(0)) {
                setd(".guild_gid_"+.@guild_id, 0);
                
                addrid(3, 0, .@guild_id);
                dispbottom "Guild member '"+convertpcinfo(getd(".guild_gid_"+getcharid(2)), CPC_NAME)+"' has un-equipped "+getitemname(.item_id)+".";
                end;
            }
        }
        end;
        
    OnAtcommand:
        .@guild_id = getcharid(2);
        if (.@guild_id && getcharid(0) == getguildmasterid(.@guild_id)) {
            .@current_cid = getd(".guild_gid_"+.@guild_id);
            
            if (!.@current_cid) {
                dispbottom "No guild member equipped "+getitemname(.item_id)+".";
                end;
            }
            
            if (isloggedin(convertpcinfo(.@current_cid, CPC_ACCOUNT), .@current_cid)) {
                attachrid(convertpcinfo(.@current_cid, CPC_ACCOUNT));
                if (inarray(.map$, strcharinfo(3)) != -1 && .@guild_id == getcharid(2)) {
                    message strcharinfo(0), getitemname(.item_id)+" unequipped!";
                    unequip EQI_HAND_L;
                }
            }
            
            setd(".guild_gid_"+.@guild_id, getcharid(0));
            addrid(3, 0, .@guild_id);
            dispbottom "Guild Master has forced a member to unequip "+getitemname(.item_id)+".";
        }
        end;
}
 
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎