Advertisement
slp13at420

WD PVP reward system

Dec 27th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. -- idea from Black WOlf
  2. -- Rochet2 of ac-web.org proofread then reworked it to function
  3. -- Thank you Rochet2 for all your help
  4. -- PVP reward system. player gets awarded 3 mg per kill plus a bonus mg count equal to the vip level (1-6) of the victim.
  5.  
  6. function GrantPvPReward(event, pPlayer, pKilled)
  7.         local Q = WorldDBQuery("SELECT `vip` FROM logon.accounts WHERE `login` = '"..pKilled:GetAccountName().."';")
  8.  
  9.         local vip = 0
  10.  
  11.         if(Q)
  12.                  then vip = Q:GetColumn(0):GetLong()
  13.     else
  14.  
  15.         end
  16.  
  17.     pPlayer:SendBroadcastMessage("you earned 3+"..vip.." magic gold.")
  18.  
  19.         WorldDBQuery("UPDATE logon.accounts SET `mg` = `mg` + '3' + "..vip.." WHERE `login` = '"..pPlayer:GetAccountName().."' LIMIT 1; ");
  20.    
  21. --        WorldDBQuery("UPDATE logon.accounts SET `mg` = `mg` - '3' WHERE `login` = '"..pKilled:GetAccountName().."' LIMIT 1; ");
  22.  
  23.  
  24. end
  25.  
  26.  
  27.  
  28.  
  29.  
  30. RegisterServerHook(23, "GrantPvPReward")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement