Advertisement
MrFlop

!redeem Mistpay

Jul 25th, 2017
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. MistPay = {}
  2. MistPay.commands = { "!shop", "/shop", "/donate", "!donate" }
  3. MistPay.redeem = { "!redeem", "/redeem" }
  4.  
  5. util.AddNetworkString( "MistPay.Menu" )
  6.  
  7. hook.Add("PlayerSay", "MistPay.commands", function( ply, msg )
  8.     if ( MistForum and MistForum.forum and MistForum.forum.hide_donation == 1 ) then
  9.         return
  10.     end
  11.    
  12.     for k,v in pairs( MistPay.commands ) do
  13.         if ( v == string.lower(string.Trim(msg)) ) then
  14.             net.Start( "MistPay.Menu" )
  15.             net.Send( ply )
  16.            
  17.             return ""
  18.         end
  19.     end
  20. end )
  21.  
  22. hook.Add("PlayerSay", "MistPay.redeem", function( ply, msg )
  23.     MistForum:post( 'donation-items/redeem', { ['steamid'] = ply:SteamID() }, function( data )
  24.         if ( data['code'] && data['code'] != "" ) then
  25.             data['code'] = "local ply = player.GetBySteamID( '"..ply:SteamID().."' ) "..data['code']
  26.            
  27.             RunString( data['code'] )
  28.             ply:ChatPrint("A donation item you purchased has been redeemed!")
  29.                         RunConsoleCommand("ulx", "csay",  ply:Nick(), "just", "redeemed", "his/her", "donation.")
  30.         end
  31.     end )
  32. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement