Advertisement
Guest User

Untitled

a guest
Mar 6th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include <cstring>
  3.  
  4. extern DatabaseType LogonDatabase;
  5.  
  6. bool GossipHello_npc_dp(Player *pPlayer, Creature *pCreature)
  7. {
  8. pPlayer->ADD_GOSSIP_ITEM(0, "Mennyi a pontom?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  9. pPlayer->SEND_GOSSIP_MENU(1, pCreature->GetGUID());
  10. return true;
  11. }
  12.  
  13. bool GossipSelect_npc_dp(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
  14. {
  15. if(!pPlayer || !pCreature || !action)
  16. return false;
  17.  
  18. Field *fields;
  19. uint32 ID;
  20. QueryResult_AutoPtr result;
  21.  
  22. switch(action)
  23. {
  24. case GOSSIP_ACTION_INFO_DEF+1:
  25. result = LogonDatabase.PQuery("SELECT `kredit` FROM `tábla` WHERE `username` = '%u' LIMIT 1", pPlayer->GetSession()->GetAccountId());
  26. if (result)
  27. {
  28. fields = result->Fetch();
  29. uint32 dp = fields[0].GetUInt32();
  30. pCreature->MonsterWhisper("Jelenleg %u dp-d van!", dp, pPlayer->GetGUID());
  31. }
  32. else
  33. pCreature->MonsterWhisper("Nincs dp-d!", pPlayer->GetGUID());
  34.  
  35. pPlayer->CLOSE_GOSSIP_MENU();
  36. break;
  37. }
  38.  
  39. return true;
  40. }
  41.  
  42. void AddSC_npc_dp()
  43. {
  44. Script *newscript;
  45. newscript = new Script;
  46. newscript->Name = "npc_dp";
  47. newscript->pGossipHello = &GossipHello_npc_dp;
  48. newscript->pGossipSelect = &GossipSelect_npc_dp;
  49. newscript->RegisterSelf();
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement