Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ENT:Use(ply, caller)
- //ply:Hint("Gas Pumps are not enabled yet")
- local found
- for k, v in pairs(ents.FindInSphere(self:GetPos(), 400)) do
- if v:GetClass() == "prop_vehicle_jeep" and v:GetNWInt("Owner") == ply:EntIndex() then
- found = true
- print("We have jeep ",v," and we have owner")
- local MAX = GAMEMODE.OCRP_Cars[v:GetCarType()].GasTank
- if v.Gas >= MAX then
- ply:Hint("The tank is already full.")
- return
- end
- if v.Gas + 200 <= MAX then
- if ply:GetMoney(WALLET) >= 200 then
- ply:AddMoney(WALLET, 200 * - 1)
- ply:Hint("You filled your car for a part. It costed you: $200")
- v.Gas = v.Gas + 200 // Fills up the car with 200 points each time.
- else
- ply:Hint("You do not have enough money to refill your car.")
- return end
- else
- if ply:GetMoney(WALLET) >= 200 then
- ply:AddMoney(WALLET, 200 * - 1)
- ply:Hint("You filled your car up to max. It costed you: $200")
- v.Gas = MAX // Fills up the car with the remaining points if it's less then 200.
- else
- ply:Hint("You do not have enough money to refill your car.")
- return end
- end
- self:EmitSound("ambient/water/water_spray1.wav",100,100)
- v.GasCheck = CurTime()
- break // break the loop
- end
- end
- if !found then ply:Hint("Could not find your car.") end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement