vRP-framework / vRP

FiveM (http://fivem.net) RP addon/framework
https://vrp-framework.github.io/vRP
MIT License
294 stars 191 forks source link

Help in understanding vRP 2.0 #652

Closed GeneralNovais closed 3 years ago

GeneralNovais commented 3 years ago

I believe this is not the best place for this, but I am looking for alternatives.

I already know vrp1 well and recently decided to try vrp2, I already have it running locally. I've read and reread the documentation, but still can't quite understand how the new scripts relate to each other, or to the VRP itself.

First I made a script with nothing, just for example to check if the player was handcuffed. I went to the POLICE module and saw the property that gives me this value. I had enormous difficulty getting this value back. The only way I could do it was doing 'local cPolice = module("vrp", "client/police")' and then calling: vRP.EXT.Police:isHandcuffed() which returned 'false' as it wasn't actually handcuffed.

My question then is, do I have to load the vrp modules like, police, garage, identity, survival etc... in each script that I need to interact with?

Another question I have, I want to convert some old resources in vrp1 to vrp2 and some use AddEventHandler for example "vRP:playerSpawn" in vpr2 I keep using addEventHandler or I use function myClass.event:playerSpawn(user, first_spawn) instead ?

Thanks for listening.

ImagicTheCat commented 3 years ago
  1. No, once the script is loaded in the vRP resource context (doc) you have access to the vRP global.
  2. The second.
GeneralNovais commented 3 years ago
  1. No, once the script is loaded in the vRP resource context (doc) you have access to the vRP global.
  2. The second.

Thanks! I was trying, but in Discord I was instructed to load client.lua in fxmanifest and not use loadScript (which was wrong). The LoadScript was not finding the client.lua file loaded in the client_vrp.lua I had to put client.lua in the files {} in the fxmanifest file which is not necessary to do with the server file.

I did a test and it worked. Thank you very much. I'm dying to concretely use vrp2 a beautiful job.