Advertisement
Guest User

Untitled

a guest
Aug 14th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. //===== eAthena Script ============================================
  2. //= #itemall
  3. //===== By: =======================================================
  4. //= Originally by goddameit
  5. //= redo by ~AnnieRuru~
  6. //===== Current Version: ==========================================
  7. //= 1.0
  8. //===== Compatible With: ==========================================
  9. //= eAthena 14910 Trunk TXT/SQL
  10. //===== Description: ==============================================
  11. //= give items to all players in the map, or on the server
  12. //===== Topic =====================================================
  13. //= http://www.eathena.ws/board/index.php?showtopic=276326
  14. //===== Additional Comments: ======================================
  15. //= topic splitted
  16. //=================================================================
  17.  
  18. - script itemall -1,{
  19. OnWhisperGlobal:
  20. if ( getgmlevel() < 80 ) end; // configure minimum GM level here
  21. if ( compare( @whispervar0$, "map" ) )
  22. set .@map$, strcharinfo(3);
  23. else if ( compare( @whispervar0$, "all" ) == 0 ) {
  24. dispbottom "[itemall] Please enter \"map#<item id>#<item amount>\" or \"all#<item id>#<item amount>\"";
  25. end;
  26. }
  27. set .@itemid, atoi( @whispervar1$ );
  28. set .@amount, atoi( @whispervar2$ );
  29. if ( getiteminfo( .@itemid, 0 ) == -1 ) {
  30. dispbottom "[itemall] Invalid item ID";
  31. end;
  32. }
  33. if ( .@amount == 0 )
  34. set .@amount, 1;
  35. set .@origin$, strcharinfo(0);
  36. while ( .@i < $online_count ) {
  37. attachrid getd("$online_aid"+ .@i );
  38. if ( .@map$ == "" || strcharinfo(3) == .@map$ ) {
  39. message strcharinfo(0), .@origin$ +" gives you "+ .@amount +" "+ getitemname(.@itemid);
  40. getitem .@itemid, .@amount;
  41. }
  42. set .@i, .@i +1;
  43. }
  44. end;
  45.  
  46. OnPCLoginEvent:
  47. setd "$online_aid"+ $online_count, getcharid(3);
  48. set $online_count, $online_count +1;
  49. end;
  50. OnPCLogoutEvent:
  51. while ( .@i < $online_count && getd("$online_aid"+ .@i ) != getcharid(3) )
  52. set .@i, .@i +1;
  53. if ( $online_count == .@i ) end; // prevent @loadnpc/@reloadscript bug becos not in the array
  54. while ( .@i < $online_count ) {
  55. setd "$online_aid"+ .@i, getd("$online_aid"+ ( .@i +1 ) );
  56. set .@i, .@i +1;
  57. }
  58. set $online_count, $online_count -1;
  59. end;
  60. OnInit:
  61. if ( getusers(1) ) end;
  62. while ( .@i < $online_count ) {
  63. setd "$online_aid"+ .@i, 0;
  64. set .@i, .@i +1;
  65. }
  66. set $online_count, 0;
  67. end;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement