BRP | FiveM Framework [ NEW UPDATE COMING SOON ]

BRP | FiveM Framework

( Framework based on JSON storing files. )

BRP 2.0 will come soon!

10 Likes

Removed discord link, please review releases rules.

Any reason you guys are using the deprecated __resource.lua and not fxmanifest.lua?

2 Likes

I forgot to change it, thx for feedback

1 Like

For those who have troubles while installing it, later this week will be posted a similar pack of scripts to Dunko for this Framework!

1 Like

Looks nice.

1 Like

I am not gonna be a hater but you use vRP libs . Do you have the permission from Dunko to use them ?

1 Like

Firstly, it is an opensource lib

Secondly, it’s from imagicthecat :laughing:

In conclusion will be an update with a unique lib just for u :joy::joy::joy::joy:

4 Likes

Hey guys great job! I hope you stick with it and develop a decent framework out of it. Find people who dare to work on a framework very cool. So I’m curious what else will come of you :wink:

1 Like

thanks )

1 Like

That’s just the beginning!

2 Likes

Nice release. Ive been looking for something like this. Only question that popped up in my mind is that, how optimized it is? Please provide the ms from resmon that it usually has.

1 Like

Any screenshots?

1 Like

Why would you brand your vehicle creation event with the framework name? kek

RegisterCommand("vehicle",function()
    local mhash = GetHashKey("zentorno")
    RequestModel(mhash)
    local i = 0
    
    while not HasModelLoaded(mhash) and i < 10000 do
      Citizen.Wait(10)
      i = i+1
    end
    
    if HasModelLoaded(mhash) then
        local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1)))

        vehicle = CreateVehicle(mhash, x, y, z+0.5, GetEntityHeading(GetPlayerPed(-1)), true, true)
        SetEntityInvincible(vehicle,false)
        SetVehicleNumberPlateText(vehicle, "BRP CAR")
        SetPedIntoVehicle(GetPlayerPed(-1),vehicle,-1)
    end
end)

Let alone make it a client command that anyone can use. Sure its minimal effort to abstract it into server side, it just doesn’t make sense to actually allow it as just a non restricted command when the framework is obviously roleplay oriented considering it contains status effects.

1 Like

Not sure why so many people complain i think this is awesome nice work!

1 Like

I forgot to remove it! Sorry )))

1 Like

This entire function is literally the opposite of "very optimized".

  • Not using PlayerPedId()
  • Not storing the ped in a variable and calling a ped request over and over
  • Using table.unpack (very slow) when you could just store the vector result
  • For some reason only waiting for a certain period of time (just check the model exists first, there are a few natives for that)
  • Asking HasModelLoaded after already confirming the model has loaded
4 Likes

Yea there’s numerous cases of un-optimization going on :man_shrugging: (To be clear, I didn’t write it as it was copy and pasted from the framework.)

Like this being a thread:

Citizen.CreateThread(function()
    ModifyWater(
	5179.0, 
	-5308.7, 
	1000, 
	-10.0
)
    NetworkSetFriendlyFireOption(true)
    SetCanAttackFriendly(GetPlayerPed(-1), true, true)
    SetPoliceIgnorePlayer(PlayerId(), true)
    SetDispatchCopsForPlayer(PlayerId(), false)
end)

When you actually only need to set those 1 time and that’s it. Can abstract it to a disable function and call it on player spawn.

Idk if calling for spawning of the player on resource start is a good idea ether

Edit: it looks like the config.lua also isn’t set to load on the manifest ether :man_shrugging:

1 Like

So I have a few things to say about this that I hope you can take on the chin.

Please don’t use buzz-words if your script doesn’t actually introduce those features.

Firstly you seem to be missing the mandatory wait in playerConnecting, which means this has the ability to crash the FXServer.

Secondly in the same file you select every player to ever exist, which by itself is a bad idea, for reference, before we cleaned up our database and got rid of extremely old players, we had approximately 45,000 rows, after cleaning up old users we now have 12,000.

So say we’re iterating over our current user’s table, we would iterate over a pairs table which is extremely slow for this size of table, then you decode the player identifiers (instead of just storing one primary identifier, like their license). If you (for some reason) don’t want to choose an exact identifier, that’s fine, there’s the ability to select rows based on a ‘like’ field, which you can implement a promise based system using lua-promises which is already build into FiveM, to iterate over every identifier and check it in the database for the LIKE value, which will still be astronomically faster then this.

You also seem to do this again for the player spawning, instead of caching your results using the players playerJoining source, which you can later reference in the playerJoining which has one argument it can take (the docs seem to be out of date for this one) which has the players temporary ID that you can reference to in a table to get the players data, without having to re-fetch (though make sure you do occasionally clean it out as there’s no guarantee the player ever gets to the playerJoining state).

You seem to use the key, value pair loop everywhere, which seemingly negates the benefits of having a table be numbered, that being you can use a numbered array to have faster access times reference.

-- cache so we're not constantly referencing a table inside of a table.
local users = BRP.users
for i = 1, #BRP.users do
   local user = users[i]
   if user.sourceId == sourceId then
   -- insert rest of code here
   end
end

Another thing is you assume id 1 is going to always be the owner which has extremely serious security issues.

Another thing that is questionable is the reason to have this net event at all as it can seemingly be misused in VERY MANY different abusive manners, and is open to ANYONE to send net events to it.

Referring back to something that was previously said, you’re completely negating the benefits of using a number table when you just use paired tables anyways, you also decrease performance when recreating a table that is already a vector.

Thanks for reading the feedback and I hope you take the time to improve your code!

7 Likes