Yes, I just looked at this. Helpful stuff but not all natives are in there, I am looking for ALL natives available to GTA, not just the ones that FiveReborn uses.
If I am making a script, does natives.lua have to exist with my mod.lua in the same folder?
Or is this just for reference and auto completion?
Also, I see in examples of other people’s Lua’s, they call native.PLAYER/VEHICLE/WEAPON.SET_xxx etc.
Example:
function onlineFunctions.removeAllWeapons§
if(Preformatted textPlayer§:Exists() then
natives.WEAPON.REMOVE_ALL_PED_WEAPONS(Player§.ID,true)
end
end
Why do some peoples code call natives. before a namespace while others do not?
natives.lua is just used by the client, no you don’t need it in any server folder and it doesn’t have anything to do with the server really, it’s just downloaded server resources for the client to use.
Do you have a name of a native you couldn’t find in natives.lua? Some natives are not yet known so they are displayed as “N_0x56c8b608cfd49854”.
Also, I see in examples of other people’s Lua’s, they call native.PLAYER/VEHICLE/WEAPON.SET_xxx etc.
Example:
function onlineFunctions.removeAllWeapons(p)
if(Preformatted textPlayer(p):Exists() then
natives.WEAPON.REMOVE_ALL_PED_WEAPONS(Player(p).ID,true)
end
end
Why do some peoples code call natives. before a namespace while others do not?
I don’t know where that’s from but RemoveAllPedWeapons(ped, true) is what you should use in lua and it’ll work.
Yeah, that’s not how you call natives from the mod, I really don’t know where that came from. You just call the natives from the client resources following the function names and arguments of the natives.lua file. If there’s an underscore, remove the underscore and search it in the natives.lua file, make sure the function name matches, it’s case sensitive as well.
PLAYER. SET_MOVE_SPEED_MULTIPLIER(Player player, float multiplier)
^Namespace/^Function name^____^Arguments ^
^ Native
Hash and arguments?-> { invoke(0x6DB47AA77FD94E09, player, multiplier); }
Hash name-> // 0x6DB47AA77FD94E09 0x825423C2
So why does everywhere else say to use underscores in the function name for lua?
Are there just no underscores in the natives.lua for FiveReborn? or if I am making a mod for just single player, standard GTA, do I then use the underscores? or not at all?
I don’t use the hashes obviously, but I have to ask; where did the natives.lua come from?
Would there be a way to add to the natives.lua in the client to expand upon the toolbox?
Well there are different mods and other mods may use underscores but FiveReborn also known as pλ does not. You just call everything from a client resource the way it’s shown in that natives.lua file. natives.lua is the main native file for FiveReborn that is used to call upon game native functions when players invoke one of the lua functions in it, that’s all it is.
About auto-complete, in the future I may do something like that for notepad++, don’t know about sublime text, maybe I do, I don’t know at the moment.
Sure, get rid of return mymods though (it’s not even in a function). return is supposed to be used inside functions that return values only, or to halt the execution of a function. The return must also be before the end of the function declared by “end”.
Any of these that started with _ are a guessed name that did not match the old Jenkins hash. These can change names at any time based on community documentation.
natives.lua is a snapshot from nativedb created quite a while ago, but the long (int64) hashes will always match.
Generated by a tool by a developer a long time ago.
Namespaces are a nonsensical idea anyway that only helped for categorizing natives during initial research. R* themselves doesn’t even use those in their scripting language anyway.