Advertisement
Guest User

Untitled

a guest
Aug 7th, 2015
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. - script CARD_CHECK -1,{
  2. OnInit:
  3. // Card ID
  4. setarray .@cardIds$, 1, 2, 3, 4, 5, 6;
  5. .@cardCount = getarraysize( .@cardIds$ );
  6.  
  7. // 0 = All. For all other numbers see the reference at http://herc.ws/wiki/Custom_Items - Weapon-type items.
  8. setarray .@allowedSubtype, 0, 0, 0, 0, 0, 0;
  9.  
  10. // Slot size. Additional space that card takes. So if card id 1 shall take two slots this needs to be 1.
  11. setarray .@slotSize, 1, 1, 1, 1, 1, 1;
  12.  
  13. while( sleep( 5000 ) ) {
  14. cleararray .@accountIds, 0, getarraysize( .@accountIds );
  15. .@resCount = query_sql( "SELECT `account_id` FROM `char` WHERE online = 1", .@accountIds );
  16. for( .@i = 0; .@i < .@resCount; .@i++ ) {
  17. if( attachrid( .@accountIds[ .@i ] ) ) {
  18. for( .@y = 1; .@y < 20; .@y++ ) {
  19. if( getequipisequiped( .@y ) ) {
  20. .@wrongType = 0;
  21. .@eqWeaponType = 0;
  22.  
  23. .@equipmentId = getequipid( .@y );
  24. .@eqSlotSpace = getitemslots( .@equipmentId );
  25. .@eqOccupiedSlots = getequipcardcnt( .@y );
  26.  
  27. if( getiteminfo( .@equipmentId, 2 ) == 4 )
  28. .@eqWeaponType = getiteminfo( .@equipmentId, 14 );
  29.  
  30. .@eqInfoCards$[ 0 ] = getequipcardid( .@y, 0 );
  31. .@eqInfoCards$[ 1 ] = getequipcardid( .@y, 1 );
  32. .@eqInfoCards$[ 2 ] = getequipcardid( .@y, 2 );
  33. .@eqInfoCards$[ 3 ] = getequipcardid( .@y, 3 );
  34.  
  35. for( .@z = 0; .@z < .@cardCount; .@z++ ) {
  36. for( .@x = 0; .@x < 4; .@x++ ) {
  37. if( .@cardIdPattern$[ .@z ] == .@eqInfoCards$[ .@x ] ) {
  38. if( .@eqWeaponType && .@allowedSubtype[ .@z ] && .@allowedSubtype[ .@z ] != .@eqWeaponType ) {
  39. .@wrongType = 1;
  40. break;
  41. }
  42.  
  43. .@eqOccupiedSlots += .@slotSize[ .@z ];
  44. }
  45. }
  46.  
  47. if( .@wrongType ) break;
  48. }
  49.  
  50. if( .@wrongType ) {
  51. successremovecards .@y;
  52. dispbottom "You tried to add a cards to " + getequipname( .@y ) + " that didn't match the allowed weapon type.";
  53. } else if( ( .@eqSlotSpace - .@eqOccupiedSlots ) > 0 ) {
  54. successremovecards .@y;
  55. dispbottom "You tried to add more cards to " + getequipname( .@y ) + " as allowed.";
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. end;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement