📱
APhone
  • What is APhone ?
  • Installation
    • Workshop
    • Configuration ( Lua part )
    • Configuration ( In-game )
  • How you make your own apps
    • Create your first app
    • App functions
    • App Metas
    • Tips you NEED to know
  • API ( Clientside )
    • Parameters ( Clientside )
    • UI - General Functions
    • UI - Required Functions
    • UI - Colors
    • UI - Fonts
    • UI - Web/Imgur Pictures
    • UI - Renderview
    • UI - Stencils
    • UI - Panels
    • Notifications
    • Rotate functions
  • API ( Shared )
    • Numbers
  • API - App Specific
    • Contacts ( Clientside )
    • Messages ( Clientside )
    • Bank ( Shared )
Powered by GitBook
On this page
  • You need to know :
  • Final result

Was this helpful?

  1. How you make your own apps

Create your first app

You need to know :

  • Applications load at the start-up. Files are automatically loaded depending on their prefix. (sv_, cl_, sh_)

  • You can put multiples files of the same realm/same prefix.

  • You don't need to put an app meta in every file. They will be loaded no matter their content.

  • You don't need to create your main panel, everything is given in the APP:Open meta.

Now that everything is good, let's create our first app! Mine will be a red-painted panel.

1. Create the folder

You need to create a folder/addon structure in :

addons/[Addon Name]/lua/aphone/apps

( Or you can register your app in your addon, you can do this later in the wiki )

2. Fill with files

I'm gonna create a file : "cl_mycooladdon.lua". The cl_ is needed to auto-include your file in the client realm.

Now you need to put this code in your file :

local APP = {}
APP.name = "My red-painted panel" // My app name
APP.color = Color( 255, 0, 0) // My app color
APP.icon = "akulla/flux/app_camera.png" // My app icon

This code is the header of your file. Everything on top of it can't be an app meta/function.

Now, I'm gonna use the APP:Open meta so I can manipulate my panel

function APP:Open(main, main_x, main_y)
     function main:Paint(w, h)
          surface.SetDrawColor(Color(255, 0, 0))
          surface.DrawRect(0,0,w,h)
     end
end

Now, my app is done, but there is something missing.

You need to put this at the end of your file :

aphone.RegisterApp(APP)

This is needed to give your app to the loader. At this point, your app will appear and work

If you want to make more complicated apps, I invite you to check the next chapter that relates to every function you would need to make your app.

Final result

local APP = {}
APP.name = "My red-painted panel" // My app name
APP.color = Color( 255, 0, 0) // My app color
APP.icon = "akulla/flux/app_camera.png" // My app icon

function APP:Open(main, main_x, main_y)
     function main:Paint(w, h)
          surface.SetDrawColor(Color(255, 0, 0))
          surface.DrawRect(0,0,w,h)
     end
end

aphone.RegisterApp(APP)
PreviousConfiguration ( In-game )NextApp functions

Last updated 2 years ago

Was this helpful?