Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. function ENT:Use(ply, caller)
  2. //ply:Hint("Gas Pumps are not enabled yet")
  3. local found
  4. for k, v in pairs(ents.FindInSphere(self:GetPos(), 400)) do
  5. if v:GetClass() == "prop_vehicle_jeep" and v:GetNWInt("Owner") == ply:EntIndex() then
  6. found = true
  7. print("We have jeep ",v," and we have owner")
  8. local MAX = GAMEMODE.OCRP_Cars[v:GetCarType()].GasTank
  9. if v.Gas >= MAX then
  10. ply:Hint("The tank is already full.")
  11. return
  12. end
  13. if v.Gas + 200 <= MAX then
  14. if ply:GetMoney(WALLET) >= 200 then
  15. ply:AddMoney(WALLET, 200 * - 1)
  16. ply:Hint("You filled your car for a part. It costed you: $200")
  17. v.Gas = v.Gas + 200 // Fills up the car with 200 points each time.
  18. else
  19. ply:Hint("You do not have enough money to refill your car.")
  20. return end
  21. else
  22. if ply:GetMoney(WALLET) >= 200 then
  23. ply:AddMoney(WALLET, 200 * - 1)
  24. ply:Hint("You filled your car up to max. It costed you: $200")
  25. v.Gas = MAX // Fills up the car with the remaining points if it's less then 200.
  26. else
  27. ply:Hint("You do not have enough money to refill your car.")
  28. return end
  29. end
  30. self:EmitSound("ambient/water/water_spray1.wav",100,100)
  31. v.GasCheck = CurTime()
  32. break // break the loop
  33. end
  34. end
  35. if !found then ply:Hint("Could not find your car.") end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement