Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 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. .@resCount = query_sql( "SELECT `account_id` FROM `char` WHERE online = 1", .@accountIds );
  15. for( .@i = 0; .@i < .@resCount; .@i++ ) {
  16. if( attachrid( .@accountIds[ .@i ] ) ) {
  17. for( .@y = 1; .@y < 20; .@y++ ) {
  18. if( getequipisequiped( .@y ) ) {
  19. .@wrongType = 0;
  20. .@eqWeaponType = 0;
  21.  
  22. .@equipmentId = getequipid( .@y );
  23. .@eqSlotSpace = getitemslots( .@equipmentId );
  24. .@eqOccupiedSlots = getequipcardcnt( .@y );
  25.  
  26. if( getiteminfo( .@equipmentId, 2 ) == 4 )
  27. .@eqWeaponType = getiteminfo( .@equipmentId, 14 );
  28.  
  29. .@eqInfoCards$[ 0 ] = getequipcardid( .@y, 0 );
  30. .@eqInfoCards$[ 1 ] = getequipcardid( .@y, 1 );
  31. .@eqInfoCards$[ 2 ] = getequipcardid( .@y, 2 );
  32. .@eqInfoCards$[ 3 ] = getequipcardid( .@y, 3 );
  33.  
  34. for( .@z = 0; .@z < .@cardCount; .@z++ ) {
  35. for( .@x = 0; .@x < 4; .@x++ ) {
  36. if( .@cardIdPattern$[ .@z ] == .@eqInfoCards$[ .@x ] ) {
  37. if( .@eqWeaponType && .@allowedSubtype[ .@z ] && .@allowedSubtype[ .@z ] != .@eqWeaponType ) {
  38. .@wrongType = 1;
  39. break;
  40. }
  41.  
  42. .@eqOccupiedSlots += .@slotSize[ .@z ];
  43. }
  44. }
  45.  
  46. if( .@wrongType ) break;
  47. }
  48.  
  49. if( .@wrongType ) {
  50. successremovecards .@y;
  51. dispbottom "You tried to add a cards to " + getequipname( .@y ) + " that didn't match the allowed weapon type.";
  52. } else if( ( .@eqSlotSpace - .@eqOccupiedSlots ) > 0 ) {
  53. successremovecards .@y;
  54. dispbottom "You tried to add more cards to " + getequipname( .@y ) + " as allowed.";
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. end;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement