[Release] Calculator UI with custom prop

Calculator UI with custom prop 💚

Version: 1.2

Download here!

- Github Download
- Github Repo

- ESX Peeps

What is this?

This is a calculator ;p That let you do what a calculator do 😂
- Standalone script, so it dosent require any other scripts or frameworks


How to use?

- Type /calc in the chat


Installation

- Download the resource from the link above
- Drag the calculator resource into your Resources folder
- Add start calculator into server.cfg


Bugs?

Not that i know of?
Do you find a bug, then you are welcome to report it!

Credits

Big thanks to Aswad Ali , for giving me access to release this for you guys, since this is his work!
He released the calculator on Codepen, you can find it here
> Proof of permission

And not to forget my buddy, who made the custom prop for this release! @Bobo_Boss <3


Cheers.
13 Likes

Really cool script. Is there a way to make it an item for esx?

I don’t work with ESX, so i dont know how it works.
But i guess its easy tho.

looking cool, nice job

If you PM me with the code, then i can edit a download for it on this topic with your credits;)

Standalone and ESX would be really cool, could also be re-worked for vrp aswell.

it is a stand alone script it will work with any framework

why the fu*k is that always the first thing people ask for? omg…

1 Like

Agree - dont get why they dont do it them self, it takes litterly like 2 min to convert this in to esx.

create server.lua

Add

ESX.RegisterUsableItem('calculator', function(source)
    TriggerClientEvent('Calculator:Open', source)
end)

Open client.lua

Remove the this part.

RegisterCommand('calc', function(source, args, rawCommand)
    if (oIsAnimationOn == false) then
        Calculator()
    end
end)

Go to the end of the script add the following

RegisterNetEvent('Calculator:Open')
AddEventHandler('Calculator:Open', Calculator)

Open __resource.lua

Add

server_scripts {
'server.lua'
}

Add Item to Items in mysql create a item called calculator, add it to your shops if you want to.

Now you got it as a item needed, and as something that can only be “opened” up if you got the item.

This aint tested there might need to be added a piece of code to close all esx menu’s down, but again this is how simple it is to make something in to an item.

1 Like

How do you exit the calculator? Pressing escape doesn’t seem to take it away

Download it again from Github, and dont rename the resource…
I made a mistake before;p Should be fixed, so ESC work again.
Edit: https://github.com/TerbSEC/Calculator/releases/tag/1.1

1 Like

how to close the calc ?

ESC or the Back button on the calc.

@CruelAlpha and @SezayThomas
I made a stupid mistake lol :stuck_out_tongue:
If you download the newest version now, it should work just fine to close it;P
The folder name need to be calculator ;p Remember that.

Cheers, i’ll try that. is the “C” in calculator meant to be capital or simple?

This doesnt work at all for me.

Simple;)

For ESX Users!
If you want the calculator as an item, follow these steps!

Add this into your Client.lua

RegisterNetEvent("Calculator:Open")
AddEventHandler("Calculator:Open", function()
    Calculator()
end)

Create a new Server.lua, and put this in it!

ESX                = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

ESX.RegisterUsableItem('calculator', function(source)
    TriggerClientEvent('Calculator:Open', source)
end)

And then, add this to your __resource.lua

server_scripts {
    "server.lua"
}

Last step: Add “calculator” to the item table in database.

ez pz lemon squeezy

3 Likes

No need to do this.

Just do

RegisterNetEvent('Calculator:Open')
AddEventHandler('Calculator:Open', Calculator)

Just has to be below the function Calculator to work :slight_smile:

It basicly just calls the function direct, insted of having to do the wrapping around a function all.

You can actually even do it with functions that require parameters like

function something(a,b,c)
print(a)
end

Then add the RegisterNetEvent.

And you are able to call

TriggerEvent(‘eventName’, a, b, c) direct, easy method to keep the code cleaned up.

1 Like

The function thing is normal.
But never heard about that

AddEventHandler('Calculator:Open', Calculator)

before tho

1 Like