SHARE
TWEET

Untitled

a guest Dec 14th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. AddEvent("OnPlayerInteractDoor", function(player, door, bWantsOpen)
  2.     local house = getDoorHouse(door)
  3.     if house == 0 then
  4.         return
  5.     end
  6.     if houses[house].owner == 0 then
  7.         CallRemoteEvent(player, "ShowHouseBuyDialog", house, houses[house].id, houses[house].price)
  8.     else
  9.         if player_data[player] ~= nil then
  10.             if player_data[player].db == houses[house].owner then
  11.                 SetDoorOpen(door, not IsDoorOpen(door))
  12.             end
  13.         end
  14.     end
  15.     AddPlayerChat(player, "Debug House: "..house)
  16. end)
  17.  
  18. AddRemoteEvent("BuyHouse", function(player, house)
  19.     if houses[house] == nil then
  20.         return
  21.     end
  22.     if houses[house].owner ~= 0 then
  23.         return
  24.     end
  25.     if GetPlayerCash(player) < houses[house].price then
  26.         AddPlayerChat(player, _("not_enough_cash"))
  27.         return
  28.     end
  29.     SetPlayerCash(player, GetPlayerCash(player) - houses[house].price)
  30.     houses[house].owner = player_data[player].db
  31.     mariadb_query(db, "UPDATE houses SET owner='"..houses[house].owner.."' WHERE id='"..houses[house].id.."';")
  32.     DestroyText3D(houses[house].textentities[2])
  33.     houses[house].textentities[2] = CreateText3D(_("owner")..": "..GetPlayerName(player), 10, houses[house].text[1], houses[house].text[2], houses[house].text[3]+5, 0, 0, 0)
  34. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top