SHARE
TWEET

Untitled

a guest Jan 24th, 2020 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. RegisterServerEvent('taeratto_inventory:server:useItem')
  2. AddEventHandler('taeratto_inventory:server:useItem', function(idname)
  3.     local user_id = vRP.getUserId({source})
  4.     -- vRP.items
  5.  
  6.     print('idname: '.. json.encode(idname))
  7.    
  8.     -- local name = vRP.getItemName(idname.name)
  9.     -- local item = items[idname.name]
  10.     -- print("item in use item: ".. json.encode(item))
  11.       if user_id ~= nil then
  12.         if vRP.tryGetInventoryItem({user_id, idname.name, 1, false}) and idname.usable then
  13.         --   if vary_hunger ~= 0 then vRP.varyHunger(user_id,vary_hunger) end
  14.         --   if vary_thirst ~= 0 then vRP.varyThirst(user_id,vary_thirst) end
  15.         -- 4 hunger 5 thirst in array
  16.         local item = items[idname.name]
  17.         print('usable: '.. idname.usabletype)
  18.         if idname.usabletype == 'drink' then
  19.             vRP.varyThirst({user_id, item[5]})
  20.             -- play_drinks({player})
  21.             local seq = {
  22.                 {"mp_player_intdrink","intro_bottle",1},
  23.                 {"mp_player_intdrink","loop_bottle",1},
  24.                 {"mp_player_intdrink","outro_bottle",1}
  25.               }
  26.            
  27.               vRPclient.playAnim(source,{false,seq,false})
  28.             -- vRPclient.playAnim(source,{false,seq,true})
  29.         elseif idname.usabletype == 'eat' then
  30.             vRP.varyHunger({user_id, item[4]})
  31.             -- play_eats({player}) --HAHAHA vRP dunko
  32.             local seq = {
  33.                 {"mp_player_inteat@burger", "mp_player_int_eat_burger_enter",1},
  34.                 {"mp_player_inteat@burger", "mp_player_int_eat_burger",1},
  35.                 {"mp_player_inteat@burger", "mp_player_int_eat_burger_fp",1},
  36.                 {"mp_player_inteat@burger", "mp_player_int_eat_exit_burger",1}
  37.               }
  38.            
  39.               vRPclient.playAnim(source,{false,seq,false})
  40.             -- vRPclient.playAnim(source,{false,seq,true})
  41.         elseif idname.usabletype == 'weapon' then
  42.             -- your code here
  43.         end
  44.  
  45.        
  46.        
  47.         --   if ftype == "drink" then
  48.         --     vRPclient.notify(player,{"~b~ Drinking "..name.."."})
  49.         --     play_drink(player)
  50.         --   elseif ftype == "eat" then
  51.         --     vRPclient.notify(player,{"~o~ Eating "..name.."."})
  52.         --     play_eat(player)
  53.         --   end
  54.         print('ok')
  55.  
  56.         --   vRP.closeMenu(player)
  57.         end
  58.       end
  59. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top