GithubHelp home page GithubHelp logo

citizenfx / fivem Goto Github PK

View Code? Open in Web Editor NEW
3.3K 37.0 2.0K 334.59 MB

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.

Home Page: https://cfx.re/

JavaScript 18.86% Batchfile 0.04% C++ 67.64% C# 3.85% Lua 1.27% C 0.01% Python 0.30% HTML 0.16% PowerShell 0.32% TypeScript 6.56% Shell 0.06% Makefile 0.03% SCSS 0.72% Assembly 0.01% Handlebars 0.12% HLSL 0.04% Vue 0.01% CSS 0.01%
fivem cfx gta redm rage gtav gtaiv rdr2 multiplayer-mod mod-framework

fivem's Introduction

Cfx.re (FiveM/RedM)

This repository contains the code for the Cfx.re projects, among which are the following:

  • FiveM, a dual-purpose (SP/MP) modification framework for the PC version of Grand Theft Auto V as released by Rockstar Games.
  • RedM, a modification framework for the PC version of Red Dead Redemption 2 as released by Rockstar Games.
  • FXServer, the server component for multiplayer services on the Cfx.re projects.

On the multiplayer aspect, the GTA/RAGE modifications differ from other similar modifications by utilizing the embedded game networking frameworks, building a modification framework around them, and expanding the game's functionality on an end-to-end level, directly binding to the RAGE Technology Group's base frameworks and Rockstar North's GTA codebase.

Getting started

To play FiveM, simply download the launcher binaries from the website.

To develop FiveM, please follow the documentation in docs/ in the repository.

License

FiveM is licensed under a dual license, details of which are in the code/LICENSE file in the repository.

fivem's People

Contributors

avarianknight avatar balika011 avatar bladecoding avatar blattersturm avatar carmineos avatar citizenfx-ci avatar disquse avatar duk-37 avatar fabianterhorst avatar gottfriedleibniz avatar hellslicer avatar jakub-cfx avatar korioz avatar lwss avatar mooshetv avatar neptunium-cfx avatar niekschoemaker avatar nihonium-cfx avatar nikez avatar nta avatar pichotm avatar prikolium-cfx avatar stannum-cfx avatar technetium-cfx avatar thers avatar thorium-cfx avatar tomgrobbe avatar vecchiotom avatar vinipux322 avatar weblate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fivem's Issues

Allow making server desktop/start menu/taskbar shortcuts

While reviewing the jump list work (and having forgotten that this existed entirely), it seemed like it might be workable to allow servers to get a shortcut added to the Start menu so they can eventually pin to Start, the taskbar or the desktop.

Requirements:

  • Only do this on user request i.e. from main UI, potentially just on favorite.
  • Properly add or remove icons (e.g. on favorite?) to a Start menu folder, similar to browser PWAs.
  • Optionally add to desktop: prompt the user.
  • Gracefully handle icons being removed from the shell (and servers failing to exist i.e. orphans?)

Inspiration: browser favorite UI popover?

image

'undo' button, potentially a 'don't add to Start'/'add to Desktop' tick

playerDropped broken in FXServer C#

It seems as if playerDropped gets called too late for the server to be able to call functions such as GET_PLAYER_NAME. (Or, rather, it lacks the information you would want. I think it may already have been this way, but now I don't know how even to get the name of the dropped player; before I believe it was an argument to the function.) Both calling that native on its own and calling source.Name throws an exception. (No surprise, since that's just a wrapper.) source.Handle works, of course, but it's pretty important to know more than just the session ID of the player that just dropped.

I guess the player's already gone by the time the playerDropped handler gets called.

Reproduction below.

A hacky solution? Pass name fetched earlier, and hopefully both or either of IP and steam ID to the trigger.

I could keep a playerlist populated myself just for this to achieve the same result, but I rather not.

namespace Test
{
    class Test : BaseScript
    {
        public Test()
        {
            EventHandlers["playerDropped"] += new Action<CitizenFX.Core.Player, string>(PlayerDropped);
        }

        void PlayerDropped([FromSource] CitizenFX.Core.Player source, string reason)
        {
            // Works (prints 1)
            Debug.WriteLine($"Player {source.Handle} dropped");
            // Throws NullReferenceException
            Debug.WriteLine($"Player {source.Name} dropped");
            // Also throws NullReferenceException
            string name = Function.Call<string>(Hash.GET_PLAYER_NAME, source.Handle);
        }
    }
}

Error 127 Procedure entry point Nui-core.dll

GTA V version? Latest as of (5/6/2017)
Up to date? Yes
Legit or Pirate copy? Legit
Steam/CD/Social Club? Steam
Windows version? Windows 10 (10.0.15063)
Did you try to disable/uninstall your Anti-virus? Yes
Did you try to delete caches.xml and try again? Yes
Error screenshot: http://i.imgur.com/DOGfkIK.png1 , http://i.imgur.com/vJvJIq2.png
GTA V folder screenshot: http://i.imgur.com/Ep0anxb.png1
GTA V/update/x64/dlcpacks screenshot: http://i.imgur.com/eYOTr42.png1
Filepath to FiveM folder: C:\Users\Alexl\Desktop\GTAV-FiveM
FiveM Application Data folder screenshot: http://i.imgur.com/nNbUYHg.png2
System specifications: AMD FX 8320, 32GB DDR3 1800, GTX 670 4GB, GTX 950 2GB(Non-SLI configuration.)
CitizenFX.log file:
"[ 0] Initialized system mapping!
[ 17813] GlobalError: Could not load component nui-core.dll - Windows error code 127."
.dmp files
https://ufile.io/86uwe1 (494de74b-db0d-4a29-b768-162dfa17341e.dmp)

Also add what you already tried so far.

I've tried deleting the nui-core.dll and allow a new one to be generated, I've completely removed FiveM and installed again. Uninstall, reboot, install of GTAV. Disabled AV and firewalls. reinstalled vcredist 2005 x86 and x64. Closed all non-essential programs in the background (Teamviewer, Twich chat(Curse). I even tried someone elses nui-core.dll same error.

Edit: No there is not a steam_api64.dll in my system32 folder.

game freezes when i click on it

i have windows 7 and when i start the game up it gives me windows 10 error then it gives me this.

fivemerror

i have reinstalled the game 4 times and it still gives me that.
it has worked before in the past with this error
i have installed the lspdfr mod in my gtaV folder and a mod menu installed also

WARNING: NON-EXISTENT NATIVE 2a488c176d52cca5

When i use Vdist native command, I get this error in my console:
WARNING: NON-EXISTENT NATIVE 2a488c176d52cca5
i found the script who create the error (code/components/citizen-scripting-core/src/ScriptHost.cpp). It's seems like i call a non registered command into fivem

Failing to mute player

This is more a question than an issue, sorry for the misuse, I thought you guys would be more reachable here.
Have you implemented the capability for a player to mute/unmute (voice chat) another one?
If not, can a player lower the volume of another player (voice chat again)?

Or isolating some players in some sort of channels?

Have a good day, best regards,

Issue with internal constructors

When I have a class that has a base class of BaseScript with a internal constructor, the client tries to load the class and fails because it can't find a accessible constructor.

Removing platform/ and other random files should trigger integrity checking

[Window Title]
FiveM Fatal Error

[Main Instruction]
FiveM has stopped working

[Content]
An error caused FiveM to stop working. A crash report is being uploaded to the FiveM developers. If you require immediate support, please visit FiveM.net and mention the details below.

[^] Ocultar detalhes [Close]

[Expanded Information]
Crash ID: b212139d-856f-4a3a-a7f5-28a9e0682d7f (use Ctrl+C to copy)

Server loaded Handling file crash on load

Just to put some context in, I develop a server, I never disconnect before shutting down the server.
Every now and again when I try to rejoin the server the game will crash. Considering the handling file loading via server is new I thought I should mention this. I have also attached the handling file.

handling.meta

An exception occurred (c0000005 at 0x7ffa91c9dd8c) during loading of resource:/vrp/lib/handling.meta in data file mounter class CVehicleHandlingFileMounter. The game will be terminated.

Unable to have more than 24 players.

At the time of writing, the released version of FiveM only supports up to 24 players in an instance. This is a hard coded limit, and I've been told that people who modify the source to allow more than 24 players are removed from the server listings.

As a game server admin, I find it highly frustrating when a game or service has a hard coded limit such as this. It prevents me from being able to expand my communities by purchasing more powerful hardware in order to allow the game or service to be run. It also raises management issues, by preventing staff from being able to use the server due to the low limits of users. It also encourages stagnation of these communities, as people who want to play can be locked out of the servers for hours. For those who make a living from Twitch Streaming, fivem is appearing to fast become a unappealing thing to stream, as these limits can mean that, with how commonly fivem crashes, their entire plan for the evening stream is screwed up -- nobody wants to watch someone stream a server list for an hour as they try to get back into the RP community again. I have seen streamers lose large numbers of viewers due to this exact issue.

There are some communities that are getting around this by setting up multiple instances of the fivem software. However, this is a waste of resources, and makes community management much more difficult, as more staff is needed for each server created to watch each server, instead of allowing a small dedicated team watch a large number of users on a single server.

Game administrators should be able to test and set the user limits themselves. Whether a server can support 10, 24, or even 100 players should be up to the testing of the administration team and the resources they have provided to the service. Look at other games, such as Minecraft, which vary between as few as 5 on a server to hundreds of players at once, with the limit set by the administrator with such things as the community size and server resources in mind.

Support For CSharp

Is there plan to add CSharp support here near future?

Not a big fan of lua and C# is a much faster then lua is.

Exports does not return metatable attached to the table

Description: Exports does not return metatable attached to the table

Repro:

  1. Create a class on a resource and inherit from that class and also add an export for the inherited class
Player = {
    health = 100,
    new = function(self, o)
		o = o or {}
		setmetatable(o, {__index = self})
		return o
	end
}

Police = Player:new({
    armor = 100,
})
console.log(Police.armor, Police.health)
-- Result will be 100, 100

exports("Police", function()
    return Police
end)
  1. On other resource call the export and try to fetch inherited class
Police = expoorts.base:Police()
console.log(police.armor, police.health)
-- Result will be 100, nil and if you try to get metatable will be also nil
getmetatable(Police) --> result will be nill

Expected behavior: exports should return metatable attached to the table

NUI scrollbar bug

Hello,

I'm using FiveM and scripting my server for a few months now (thanks for your awesome work !). Last week, I've started developing an interface using NUI, but I'm facing a problem with scrollbars. I can scroll a div only if the cursor is about 200 or 300px left from the scrollbar. The JS scroll event stop triggering when the cursor is not enough left. And if my scrollable block has too small width, I can't scroll it...
The bug is reproducible on the FiveM client home page or server list. I've only noticed it yesterday, so I don't know if it's a regression from a recent update or if it's an old bug.

Did you already noticed, started working on it or is it unsolvable ?

Thanks

Win32k user crit slowness detection

A player reported frequent hitches while playing the game. ETW tracing showed the main thread blocking on the render thread, with one frame spending 300ms+ on the message loop in there:

image

Deeper nesting checks showed a lot of nested calls into uxtheme, dinput8 or win32k directly, mostly landing on win32kbase.sys!EnterCrit:

image

There should be a warning when this occurs in a sufficiently egregious fashion.

Provide hooks allowing interception of players.json

Would it be possible to output every online player's in-game coordinates in a server players.json file? I've been digging in the FiveM source on GitHub, but have had no success in finding the relevant code.

It seems that the player object is constructed here:

type Player$Properties = {

I am uncertain how x y and z coordinates could be added.

Could @nta or @blattersturm help me out here?

RDR3 fwPoolBase assertions show instead of the custom pool error

FatalErrorNoExcept("%s Pool Full, Size == %d%s", poolName, pool->GetSize(), extraWarning);

Since probably 1311 the game has a number of assertions in code that normally would int 3 or just error out silently, this also includes a lot of pool failure code paths, leading to confusing 'FFFFFFFF' errors instead of the custom message saying which pool ran out.

[Question] Tools and methods for hooks

Spread across the code base is things like this:

static hook::thiscall_stub<rage::fiCollection*(rage::fiCollection*)> packfileCtor([] ()
{
	return hook::pattern("44 89 41 28 4C 89 41 38 4C 89 41 50 48 8D").count(1).get(0).get<void>(-0x1E);
});

Which, even to an experienced programmer, would be utter nonsense: it's just a hex string that somehow connects to actual data.

So my question is:
How is this written? What tools and methods are used to create lines of code like this and bring FiveM to life?

Faim et soif

Faim et soif qui diminue graduellement, avec des items qui permettent de régénérer ces valeurs

Hey @WeAreFailure, ca fais quoi quand on tombe a 0

Can't build the server

Hi All,

I have tried to build the client and finally managed to.
However I don't see the the server inside.
Is the server a separate repository?

Thanks,
Mockba the Borg

VehicleHash.cs does not contain updated vehicles!

Hello!

I am trying to spawn some of the newer vehicles which have been added to GTA, such as the Phantom Wedge, the APC, and a few others.

I am sure they're in my client files, however they are not spawning even when I spawn by the explicit ID(0x9DAE1398 OR 2645431192 OR -1649536104 (Phantom Wedge))

Below is the link of the current vehicle hash list which I was able to find.
Is there a way to even spawn these, or would the server need to have an updated hashkey list as well as the client to get past the model checks, etc?
https://github.com/citizenfx/fivem/blob/b36c2d66ac9cd91d411dc741e084fa43287f5c4a/code/client/clrcore/External/VehicleHash.cs

Kind regards

Jump list entries should save a build argument

Since we're starting the game anyway from these entries, we should save the last build this server was seen with and launch with the -bX argument directly so users don't have to switch from the last used build.

Huge stuttering

While running fivem, I notice huge stuttering spikes that do not happen when running in solo game mode ( even online).
I'm running with a gtx 970, 8Gb RAM and an i5 3350P.
Is there any way for me to optimize fivem? Do you think it's more probably a network connection issue rather than an I/O issue?
Thanks.

GET_NUM_PLAYER_INDICES increases by # of clients on server on each call

The below code on its own on a fresh server keeps printing a higher and higher number each time; if server is empty it stays constant, if server has one player, it increases by one every time etcetera.

Citizen.CreateThread(function()
  while true do
    Citizen.Trace(string.format("GetNumPlayerIndices: %s\n", GetNumPlayerIndices()))
    Citizen.Wait(10000)
  end
end)

GET_NUM_PLAYER_INDICES and most likely the problem itself to be found here here:

static thread_local std::vector<std::weak_ptr<fx::Client>> clients;

The issue seems to be that GET_NUM_PLAYER_INDICES expects static thread_local std::vector<std::weak_ptr<fx::Client>> clients; to be empty every time it is called, but it keeps the same value.

At the same time GET_PLAYER_FROM_INDEX expects it not to be empty since it expects clients contains all the clients already... (Assumes GET_NUM_PLAYER_INDICES will always get called before it gets called itself maybe?)

I guess GET_NUM_PLAYER_INDICES should either clear the vector or make sure to add only new clients to the list, and GET_PLAYER_FROM_INDEX should maybe make sure the client vector is up to date before it queries from it.

ROS auto-signin errors may crash

https://forum.cfx.re/t/kernelbase-dll-34ed9-crash/4419602

image

Sadly, this RedM build did not have symbols uploaded, but a quick analysis of the compiled DLL in IDA shows this fails during the 'Error' code path:

image

if (!j["Status"].get<bool>())
{
#ifdef IS_RDR3
FatalError("Error during Steam ROS signin: %s %s", j["Error"].value("Code", ""), j.value("Message", ""));

A quick fix would be to ignore a missing Message field, but this would need some checking of what an actual error response here looks like.

In addition, it may be needed to not fatal out of this since Epic and MTL may still succeed (e.g. if the user is not using a Steam copy, though this doesn't seem to be the case in the linked issue).

Set up a series of issue forms

For transparency, we may want to have public issue reporting for code tasks. I've gone ahead and enabled issues, but without issue forms for each type of issue this may become a bit of a mess.

GitHub supports this feature as of recently, we should investigate what this could look like and make some.

Avoid cheaters - Client resources checksum ?

Hello guys.

Seems that values spoofing with tools like Cheat Engine is possible, but that's theorical, cheating is not part of my habits ;)
Anyhow, we encountered obvious cheating on servers (including our own) where ScriptHook usage is disabled like specified in the citmp-server.yml config file.

So I'm asking.
Which mecansims are implemented within FiveM to ensure that client resources are not altered ?
If so, can the server prevent those altered resources form being used ?

If none are present. How can we successfully avoid these kind of cheating ?
How can we detect using the server console output any attempt from a client to cheat ?

If you need any detailed examples of obvious cheat ingam, we are able to discribe them if it can help.

Many thanks

Commit 835ebc5 broke "defer" in C# (also broke "setReason" callback to deny connect)

Mendelevium's commit 835ebc5 broke "defer" implementation in C#. Reverting the commit makes them work again. Currently, as soon as you call the defer.update equivalent in C#, the server terminates without a message.

See minimal reproduction below.

namespace Test
{
    class Test : BaseScript
    {
        public Test()
        {
            EventHandlers["playerConnecting"] += new Action<CitizenFX.Core.Player, string, CallbackDelegate, System.Dynamic.ExpandoObject>(PlayerConnecting);
        }

        void PlayerConnecting([FromSource] CitizenFX.Core.Player source, string alsoPlayerName, CallbackDelegate noReason, System.Dynamic.ExpandoObject deferCallbacks)
        {
            Debug.WriteLine($"Player '{source.Name}' ({alsoPlayerName}) is connecting");
            Dictionary<string, CallbackDelegate> DeferCallbacksDictionary = deferCallbacks.ToDictionary(c => c.Key, c => (CallbackDelegate)c.Value);
            Debug.WriteLine($@"Callback names: '{String.Join(", ", DeferCallbacksDictionary.Keys)}'");
            // Does nothing it seems like
            DeferCallbacksDictionary["defer"]();
            // Crashes server without any message
            DeferCallbacksDictionary["update"]("Wait...");
        }
    }
}

GetGameplayCamRot not working anymore

GetGameplayCamRot(0)
return always 0 before it return Vertor3

It's the same with
Citizen.InvokeNative(0x837765A25378F0BB, Citizen.PointerValueIntInitialized(0))

Allow direct servers in the server list

  • Allow direct connect server to be added as favourites

It would be nice to be able to save some direct connection server, this way you can save these servers.

nui mousemove/click, keyboard event while loading

Would it be possible to send mousemove/click event to the loading page to make it interactive ? I actually use a css animation and i think it would be usefull i my server could display rules in a menu or even a minigame while loading.

It seems that Nui need to be loaded to send the event but i'm not sure how it works.
I see there https://github.com/citizenfx/fivem/blob/master/code/components/nui-core/src/CefInput.cpp how the event are sent but i didn't find a way to use them while loading

Can't get a list of loaded resources

when a resource is restarted their is no way to get a list of all loaded Resources on the client. This is necessary when the resource ha reload the appropriate files from other loaded resources. The only way to achieve this is to restart all the required resources

SDK guest uses the same browser data directory as the SDK host

A user reported that DUI instances created while in FxDK 'break' youtube.com until deleting nui-storage-fxdk.

This initially seemed weird as this directory is mostly meant for the SDK host, not the SDK guest, but is explainable by the fact that both host and guest do use the same CEF cache/data directory:

std::wstring cachePath = MakeRelativeCitPath(fmt::sprintf(L"data\\nui-storage%s", ToWide(launch::GetPrefixedLaunchModeKey("-"))));

std::wstring cachePath = MakeRelativeCitPath(ToWide(fmt::sprintf("data\\nui-storage%s\\", launch::GetPrefixedLaunchModeKey("-"))));

if (IsSDK() || IsSDKGuest())
{
return "fxdk";

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.