Pay for the artificial intelligence service of the mechanical npc

Hello, I have a mechanical A.I script, but I wanted to add a code in the script that, at the end of the service, the person pays for the service, base of servers that I use and VRP.
the script I want to adapt is this: [Release] AI Mechanic
I would be very grateful. Thank

I think you should pay at the beginning of the service in order to prevent lack of money. If you want to do it before starting you can use this function:

if vRP.tryFullPayment({user_id, Price}) then

(Obviously it depends on the version of vrp)

and where should i put this command? start of all code?

No, you should allocate it to the function you want, or that of the mechanic. In addition, you should link the vRP libraries to the resource.

at __resource? am new to fivem programming you help me? could you tell me step by step? I’m lost :confused:

I haven’t programmed in vRP for long, but you should be able to link libraries by adding open __resource.lua and adding:

dependency "vrp"

"@vrp/lib/utils.lua" (in server_scripts)

"lib/Tunnel.lua" (in client_scripts)
"lib/Proxy.lua", (in client_scripts) 

something like this should come out:

resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"

dependency "vrp"

client_scripts{ 
  "lib/Tunnel.lua",
  "lib/Proxy.lua",
  "file-of-client.lua"
}

server_scripts{ 
  "@vrp/lib/utils.lua",
  "file-of-server.lua"
}

he is like this:
resource_manifest_version ‘77731fab-63ca-442c-a67b-abc70f28dfa5’

client_scripts {

'client.lua',

'config.lua',

}

server_scripts{

"@vrp/lib/utils.lua",

"server.lua"

}

should i switch to this one?

resource_manifest_version “44febabe-d386-4d18-afbe-5e627f4af937”

dependency “vrp”

client_scripts{
“lib/Tunnel.lua”,
“lib/Proxy.lua”,
“file-of-client.lua”
}

server_scripts{
@vrp/lib/utils.lua”,
“file-of-server.lua”
}