Jump to content

Help with a "set amount of fuel" script.


3ehud

Recommended Posts

So i made a script that was meant to set my wanted amount of fuel (0 to 100). It doesnt work and i need help from you guys. 

Here's the script:

function command(player,cmd,amount)
local vehicle = getPedOccupiedVehicle(player)
local fuel = getElementData(vehicle,"fuel")
local account = getPlayerAccount(player)
local name = getAccountName(account)
if isObjectInACLGroup("user."..name,aclGetGroup("Właściciel")) then
if vehicle and tonumber(amount) and (tonumber(fuel) + tonumber(amount)) <= 100 then
setElementData(vehicle,"fuel",tonumber(amount) + tonumber(fuel))
outputChatBox("Pojazd został zatrzymany.",player)
end
end
addCommandHandler("tech",command)

Edited by 3ehud
Link to comment

I edited the code a bit.

function command(player,cmd,amount) end
local vehicle = getPedOccupiedVehicle(player)
local fuel = getElementData(vehicle,"fuel")
local account = getPlayerAccount(player)
local name = getAccountName(account)
if isObjectInACLGroup("user."..name,aclGetGroup("Właściciel")) then end
if vehicle and tonumber(amount) and (tonumber(fuel) + tonumber(amount)) <= 100 then
setElementData(vehicle,"fuel",tonumber(amount) + tonumber(fuel))
outputChatBox("Pojazd został zatrzymany.",player)
end
addCommandHandler("tech",command)

And here are the errors/warnings.

https://drive.google.com/open?id=0B9I7LHGBgukAVmxkTmVyUm9OT3c

Btw would you mind helping me with an EMP (Electro-magnetic Pulse) system for Police that could turn off the engine for about 3 minutes?

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...