Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. function on_game_start()
  2. RegisterScriptCallback("actor_on_item_use",pda_callback)
  3. end
  4.  
  5. function pda_callback(item)
  6. if (item:section() == "itm_pda_common") then
  7. if (dynamic_news_manager and axr_main.config:r_value("mm_options","enable_dynamic_news",1)) then
  8. dynamic_news_manager.get_dynamic_news():BoughtItems(npc,seller,buy_sell_items)
  9. end
  10. end
  11.  
  12. end
  13. function DynamicNewsManager:RequestLocation()
  14. local actor_pos = db.actor:position()
  15.  
  16. for i,id in ipairs(db.OnlineStalkers) do
  17. local npc = db.storage[id] and db.storage[id].object
  18.  
  19. -- If npc is the same community as the player and less than 30m away
  20. if npc:relation(db.actor) ~= game_object.enemy and actor_pos:distance_to_sqr(npc:position()) < 900) then -- 30 meters ie. 30^2
  21.  
  22. local msg = "We're " .. dynamic_news_helper.GetPointDescription(npc) -- Location Description
  23. local Se = strformat("%s, %s",sender:character_name(),dynamic_news_helper.GetCommunityDescription(sender,6)) -- NPC description
  24.  
  25. self:PushToChannel(npc:character_community(),{Mg=msg,Ic=npc:character_icon(),Snd="news",Se=Se,It="npc"})
  26. end
  27. end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement