Advertisement
akbare

Give item player by: emistry

Jan 19th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. - script Sample -1,{
  2.  
  3. OnInit:
  4. bindatcmd "reward",strnpcinfo(3) + "::OnAtcommand", 99, 99;
  5. end;
  6.  
  7. OnAtcommand:
  8. if (getgroupid() >= 99) {
  9. if (.@atcmd_parameters$[0] == "all" )
  10. .map$ = "all";
  11. else if (.@atcmd_parameters$[0] == "map" )
  12. .map$ = strcharinfo(3);
  13. else if (getmapusers(.@atcmd_parameters$[0]) >= 0)
  14. .map$ = .@atcmd_parameters$[0];
  15. else
  16. dispbottom "Error, pick 'map' or 'all' ";
  17.  
  18. .itemid = atoi(.@atcmd_parameters$[1]);
  19. .amount = atoi(.@atcmd_parameters$[2]);
  20.  
  21. if (getitemname(.itemid) == "null" || .amount < 1)
  22. dispbottom "Invalid item id #"+.itemid+" and amount ("+.amount+").";
  23. else donpcevent strnpcinfo(3)+"::OnReward";
  24. }
  25. end;
  26.  
  27. OnWhisperGlobal:
  28. if (getgroupid() >= 99) {
  29. if (@whispervar0$ == "all" )
  30. .map$ = "all";
  31. else if (@whispervar0$ == "map" )
  32. .map$ = strcharinfo(3);
  33. else if (getmapusers(@whispervar0$) >= 0)
  34. .map$ = @whispervar0$;
  35. else
  36. dispbottom "Error, pick 'map' or 'all' ";
  37.  
  38. .itemid = atoi(@whispervar1$);
  39. .amount = atoi(@whispervar2$);
  40.  
  41. if (getitemname(.itemid) == "null" || .amount < 1)
  42. dispbottom "Invalid item id #"+.itemid+" and amount ("+.amount+").";
  43. else donpcevent strnpcinfo(3)+"::OnReward";
  44. }
  45. end;
  46.  
  47. OnReward:
  48. if (.map$ == "all")
  49. addrid(0);
  50. else if (.map$ != "")
  51. addrid(5, 0, .map$);
  52.  
  53. getitem .itemid, .amount;
  54. end;
  55. }
  56. [npc:Sample] <map_mapname|map|all>#512#100
  57. @reward <map_name|map|all> 512 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement