viewing paste Unknown #21246 | Text

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
-   script  CARD_CHECK  -1,{
    OnInit:
        // Card ID
        setarray .@cardIds$, 1, 2, 3, 4, 5, 6;
        .@cardCount = getarraysize( .@cardIds$ ); 
        
        // 0 = All. For all other numbers see the reference at http://herc.ws/wiki/Custom_Items - Weapon-type items.
        setarray .@allowedSubtype, 0, 0, 0, 0, 0, 0;
        
        // Slot size. Additional space that card takes. So if card id 1 shall take two slots this needs to be 1.
        setarray .@slotSize, 1, 1, 1, 1, 1, 1;
        
        .@cardIdPattern$ = implode( .@cardIds$, ":" );
        
        while( sleep( 5000 ) ) {
            .@resCount = query_sql( "SELECT `account_id` FROM `char` WHERE online = 1", .@accountIds );
            for( .@i = 0; .@i < .@resCount; .@i++ ) {
                if( attachrid( .@accountIds[ .@i ] ) ) {
                    for( .@y = 1; .@y < 20; .@y++ ) {
                        if( getequipisequiped( .@y ) ) {
                            .@wrongType = 0;
 
                            .@equipmentId = getequipid( .@y );
                            .@eqSlotSpace = getitemslots( .@equipmentId );
                            .@eqOccupiedSlots = getequipcardcnt( .@y );
 
                            if( getiteminfo( .@equipmentId, 2 ) == 4 )
                                .@eqWeaponType = getiteminfo( .@equipmentId, 14 );
                            
                            .@eqInfoCards$[ 0 ] = getequipcardid( .@y, 0 );
                            .@eqInfoCards$[ 1 ] = getequipcardid( .@y, 1 );
                            .@eqInfoCards$[ 2 ] = getequipcardid( .@y, 2 );
                            .@eqInfoCards$[ 3 ] = getequipcardid( .@y, 3 );
 
                            for( .@z = 0; .@z < .@cardCount; .@z++ ) {
                                for( .@x = 0; .@x < 4; .@x++ ) {
                                    if( .@cardIdPattern$[ .@z ] == .@eqInfoCards$[ .@x ] ) {
                                        if( .@eqWeaponType && .@allowedSubtype[ .@z ] && .@allowedSubtype[ .@z ] != .@eqWeaponType ) {
                                            .@wrongType = 1;
                                            break;
                                        }
 
                                        .@eqOccupiedSlots += .@slotSize[ .@z ];
                                    }
                                }
                                
                                if( .@wrongType ) break;
                            }
                            
                            if( .@wrongType ) {
                                successremovecards .@y;
                                dispbottom "You tried to add a cards to " + getequipname( .@y ) + " that didn't match the allowed weapon type.";        
                            } else if( ( .@eqSlotSpace - .@eqOccupiedSlots ) > 0 ) {
                                successremovecards .@y;
                                dispbottom "You tried to add more cards to " + getequipname( .@y ) + " as allowed.";        
                            }
                        }
                    }
                }
            }
        }
    end;
}
Viewed 708 times, submitted by Guest.