Alexander Blade Posted June 20, 2014 Share Posted June 20, 2014 (edited) NATIVE DB Script/Native Documentation and Research Describing and researching what actually GTA V scripts do as well as describing native (i.e. script api functions) names, parameters and giving them a description. This topic is related to the NATIVE DB project, which is aimed to gather every piece of information about script native functions that we have, think of it as of native wiki where anyone who wants to contribute can do so and everyone who needs the latest script documentation or the header with natives for ScriptHook can get it in one click! #SCRIPTS GTA V has around 700 scripts which are involved almost in every aspect of the game, understanding the scripts is a key to understand the whole thing. All this scripts decompiled to a C-like code are published below, in order to view them we mostly use Notepad++, if you are going to use it then don't forget to select C syntax highlighter. Archive with decompiled scripts can be found below. Decompiled PC scripts, build 372, 393, 463, 505, 573, 617, 678 Mar 2016 #NATIVES GTA V features ~5200 natives and almost all of these functions are in use in the original game scripts, this means that while building game's main executable only the natives required by the scripts are included (IV had ~3000 natives and the scripts were using only 2/3 of them). There is no original native name list in GTA V, name hashes were used instead, however during initial research we were managed to recover ~2600 native names using bruteforce and manual checking afterwards. The good thing is that we know for sure how many parameters and results each one of these natives has (because when script calls native it uses this values and all natives are in use), so we need to name their params and types here as well. In order to put more understanding in whatever natives do they were grouped the way original developers grouped them, it makes code more readable and when you see an unknown native you already know which group it belongs to. If you want to make large description for some native/group of natves or publish some enum list then you need to post it on gtaforums/gtamodding and put the link into corresponding native description here. GTA V PC version has native hashes replaced with random 64 bit values, which may differ between patches, however NATIVE DB runs on original PC hashes (call it hashes anyway) as well as ScriptHookV and accompanying tools which are performing native hash translation for natives from patches. Actual native name hash check is perfomed using real hashes from x360 version. #NAMING NATIVES Since we are using native groups (namespaces) and a lot of natives require to be named we must stick to the simple native naming convention, which should be applied to any tool that uses natives in a way seen to a user. Native naming convention Template: GROUP :: (_)NAME // 0xHASH 1. All UPPERCASE letters 2. Starts with a GROUP name followed by :: 3. Custom named natives (name does not match hash) must have _ prefix before the NAME 4. Hash must present when custom name is used, it's optional for real names Examples: PLAYER::GET_PLAYER_PED -- native with real name PLAYER::PLAYER_ID -- native with real name as well PLAYER::_PLAYER_ID // 0x8DD5B838 -- native with custom which does the same as PLAYER::PLAYER_ID How to choose custom native name 1. Always start with _ prefix 2. Look at declarations of the known natives around yours (included file #5) 3. Make it simple and avoid long names When you are mentioning custom natives please always specify the hash, because custom native names could be changed. Name bruteforcing In order to find the names we are using well optimized template based native name bruteforce with multithread support. Description is in the readme. Multithreaded native bruteforce Edited March 20, 2016 by Alexander Blade SxmpraT, Alexander, hasan_gta_beli and 42 others 44 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/ Share on other sites More sharing options...
Maro Hannover Posted June 22, 2014 Share Posted June 22, 2014 (edited) YOU ARE THE MOST Genius Guy in this FORUMS! Will it be possible to write missions like the SCM engine in GTA SA? GTA IV Opcodes were useless and difficult Edited June 22, 2014 by Maro Hannover Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648752 Share on other sites More sharing options...
Silent Posted June 22, 2014 Share Posted June 22, 2014 Will it be possible to write missions like the SCM engine in GTA SA? GTA IV Opcodes were useless and difficult Obviously not. SCM is over. Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648767 Share on other sites More sharing options...
Maro Hannover Posted June 22, 2014 Share Posted June 22, 2014 The most important thing will i be able to create missions (I am not talking about DYOM I am talking about coding) ? Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648789 Share on other sites More sharing options...
Silent Posted June 22, 2014 Share Posted June 22, 2014 will i be able to create missions (I am not talking about DYOM I am talking about coding) ? YOU won't. The others might be. Xyn, stef538, BS_BlackScout and 3 others 6 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648877 Share on other sites More sharing options...
Delta India Echo Posted June 22, 2014 Share Posted June 22, 2014 Console modding allowed now? Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648902 Share on other sites More sharing options...
Silent Posted June 22, 2014 Share Posted June 22, 2014 Console modding allowed now? It's more of a preparation for a PC release. Delta India Echo 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648907 Share on other sites More sharing options...
Maro Hannover Posted June 22, 2014 Share Posted June 22, 2014 What are you saying! i am a coder! the last 3 days i was practicing and thinking about c# i swear! So stop making fun or will ban you because there will be 1 billion views in this threads as our text is in the Top. Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648910 Share on other sites More sharing options...
TJGM Posted June 22, 2014 Share Posted June 22, 2014 What are you saying! i am a coder! the last 3 days i was practicing and thinking about c# i swear! So stop making fun or will ban you because there will be 1 billion views in this threads as our text is in the Top. I see why you're in the 'special members' group. Konijima, Link2012, s-paco and 16 others 18 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065648944 Share on other sites More sharing options...
Alexander Blade Posted June 22, 2014 Author Share Posted June 22, 2014 Most useful links added , enjoy the research and use it smart Silent, pogo_01, TJGM and 1 other 4 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065650475 Share on other sites More sharing options...
Noox Posted June 22, 2014 Share Posted June 22, 2014 Thanks! Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065650638 Share on other sites More sharing options...
LordOfTheBongs Posted June 22, 2014 Share Posted June 22, 2014 too bad the first thread is being bombarded by Maro's wackiness... lol Keep up the good work Alexander leftas and Skorpro 2 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065650744 Share on other sites More sharing options...
Noox Posted June 22, 2014 Share Posted June 22, 2014 I don't know if this is the right place to ask but any clues on why they are using these weird function names (not hashes) such as sub_27F();? Element-43 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651009 Share on other sites More sharing options...
Alexander Blade Posted June 22, 2014 Author Share Posted June 22, 2014 this is the functions that are in script , not the natives , the one who generates such names is me , such functions have no names so I need to name them somehow , so I'm doing it in a classic way as sub_ (which stands for subroutine) with function address in script Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651057 Share on other sites More sharing options...
Noox Posted June 22, 2014 Share Posted June 22, 2014 (edited) Ah alright, sorry but it's a little bit confusing. So once you you get the hash list should it be easier to understand the code? Also thanks for all the effort into this Edited June 22, 2014 by Noox Element-43 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651070 Share on other sites More sharing options...
bread Posted June 22, 2014 Share Posted June 22, 2014 What are you saying! i am a coder! the last 3 days i was practicing and thinking about c# i swear! So stop making fun or will ban you because there will be 1 billion views in this threads as our text is in the Top.Get a life. Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651117 Share on other sites More sharing options...
XBLToothPik Posted June 22, 2014 Share Posted June 22, 2014 (edited) I knew you guys had something good in store for everyone, nice topic and research! Fixes on your list: Was: Any _0x499747B6(Any p0); // 0x499747B6Now: char *GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(Vehicle veh); // 0x499747B6 Was: Any NET_BUT(); // 0x6970BA94Now: bool NETWORK_IS_HOST_OF_THIS_SCRIPT(); // 0x6970BA94 My edits to the list (parameters, returns..ect..) Namespace Vehicle: void SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle veh, int r, int g, int b); // 0x8DF9F9BCvoid GET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle veh, int *r , int *g, int *b); // 0x1C2B9FEFvoid CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle veh); // 0x51E1E33D Vehicle CREATE_VEHICLE(uint vehicleHash, float X, float Y, floayt Z, float heading, bool unk1, bool unk2); // 0xDD75460Avoid DELETE_VEHICLE(Vehicle *veh); // 0x9803AF60 void SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle veh, int r, int g, int b); // 0x9D77259Evoid GET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle veh, int *r, int *g, int *b); // 0x3FF247A2void CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle veh); // 0x7CE00B29 void SET_VEHICLE_NUMBER_PLATE_TEXT(Vehicle veh, char* plateText); // 0x400F9556char* GET_VEHICLE_NUMBER_PLATE_TEXT(Vehicle veh); // 0xE8522D58void SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(Vehicle veh, int plateindex); // 0xA1A1890E bool IS_VEHICLE_ATTACHED_TO_TRAILER(Vehicle veh); // 0xE142BBCCbool IS_VEHICLE_ON_ALL_WHEELS(Vehicle veh); // 0x10089F8Evoid SET_VEHICLE_SIREN(Vehicle veh, bool sirenOn); // 0x4AC1EFC7bool IS_VEHICLE_SIREN_ON(Vehicle veh); // 0x25EB5873bool IS_VEHICLE_SEAT_FREE(Vehicle veh, int seatIndex); // 0xDAF42B02 Namespace Player char *GET_PLAYER_NAME(Player player); bool IS_PLAYER_TARGETTING_ANYTHING(Player player); // 0x456DB50Dbool IS_PLAYER_FREE_AIMING(Player player); // 0x1DEC67B7bool IS_PLAYER_FREE_AIMING_AT_ENTITY(Player player, Entity e); // 0x7D80EEAAbool IS_PLAYER_DEAD(Player player); // 0x140CA5A8bool IS_PLAYER_PLAYING(Player p); // 0xE15D777F int GET_MAX_WANTED_LEVEL(); // 0x457F1E44 Namespace Entity uint GET_ENTITY_MODEL(Entity e); // 0xDAFCB3ECint GET_ENTITY_HEIGHT_ABOVE_GROUND(Entity e); // 0x57F56A4Dbool IS_ENTITY_A_PED(Entity e); // 0x55D33EABbool IS_ENTITY_A_MISSION_ENTITY(entity e); // 0x2632E124bool IS_ENTITY_A_VEHICLE(Entity e); // 0xBE800B01bool IS_ENTITY_AN_OBJECT(Entity e); // 0x3F52E561 void ATTACH_ENTITY_TO_ENTITY(Entity attachEntity, Entity targetentity, int unk1, float relativeXCoord, float relativeYCoord, float relativeZCoord, float relativeXRotation, float relativeYRotation, float relativeZRotation , int unk2, int unk3, int unk4, int unk5, int unk6, int unk7); // 0xEC024237 void DELETE_ENTITY(Entity *e); // 0xFAA3D236void DETACH_ENTITY(Entity e, int unk1, int unk2); // 0xC8EFCB41void FREEZE_ENTITY_POSITION(Entity e, bool freeze); // 0x65C16D57void SET_ENTITY_ROTATION(Entity e, float rX, float rY, float rZ, int unk1, int unk2); // 0x0A345EFEvoid SET_ENTITY_VISIBLE(Entity e, bool visible); // 0xD043E8E1bool IS_ENTITY_VISIBLE(Entity e); // 0x120B4ED5 Namespace Ped bool IS_PED_A_PLAYER(Ped p); // 0x404794CA Vehicle veh GET_VEHICLE_PED_IS_IN(Ped p, int unk); // 0xAFE92319bool IS_PED_IN_ANY_VEHICLE(Ped p, int unk1); // 0x3B0171EE Namespace Gameplay void SET_BIT(int* location, int bt); // 0x4EFE7E6Bvoid CLEAR_BIT(int* location, int bit); // 0x8BC9E618bool IS_BIT_SET(int location, int bit); // 0x902E26AC void SET_TIME_SCALE(char* timeScaleName); // 0xA7F84694 bool IS_STRING_NULL(char* location); // 0x8E71E00Fbool IS_STRING_NULL_OR_EMPTY(char* location); // 0x42E9F2CA uint GET_GAME_TIMER(); // 0xA4EA0691uint GET_FRAME_TIME(); // 0x96374262uint GET_FRAME_COUNT(); // 0xB477A015 int GET_RANDOM_FLOAT_IN_RANGE(int min, int max); // 0x0562C4D0float GET_RANDOM_INT_IN_RANGE(float min, float max); // 0x4051115B void DISPLAY_ONSCREEN_KEYBOARD(int language, char *gxtName, char *unk1, char *defaultText, char *unk2, char* unk3, char* unk4, int maxMessageLen); // 0xAD99F2CEint UPDATE_ONSCREEN_KEYBOARD(); // 0x23D0A1CEchar *GET_ONSCREEN_KEYBOARD_RESULT(); // 0x44828FB3 Edited June 23, 2014 by XBLToothPik Frank.s, Colata and Alexander Blade 3 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651342 Share on other sites More sharing options...
NTAuthority Posted June 22, 2014 Share Posted June 22, 2014 NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT //0x6970BA94 AH YES THAT'S EXACTLY THE THING WITH RAGE NETWORKING, RESPONSIBILITY MIGRATION AND EXACTLY THE ONE THING NEEDED FOR LARGE SCALE WORLDS WITH MULTIPLE COMMON SCRIPTS AS OPPOSED TO IV'S SPECIFIC GAMEMODES Deji 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651567 Share on other sites More sharing options...
unknown modder Posted June 22, 2014 Share Posted June 22, 2014 Are the native name groups the different functions in the executable that list all the natives, because there are about 40 functions in there that list native hashes Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651569 Share on other sites More sharing options...
NTAuthority Posted June 22, 2014 Share Posted June 22, 2014 Are the native name groups the different functions in the executable that list all the natives, because there are about 40 functions in there that list native hashes going by past research by these people, yes. Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651574 Share on other sites More sharing options...
Alexander Blade Posted June 22, 2014 Author Share Posted June 22, 2014 Are the native name groups the different functions in the executable that list all the natives, because there are about 40 functions in there that list native hashes This groups are that functions , 1 function is 1 group , just the order of groups we have here is different from the order that functions are being called Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065651582 Share on other sites More sharing options...
Skorpro Posted June 23, 2014 Share Posted June 23, 2014 OFF: I'm in vacation and I have partied... so I still drunk (since 3 days... ) POLISH PARTY rulez <- beautiful girls and cheap high proof ALC Anyway...I know why I mention Alexander Blade in all my mods!!! He's the most important guy in this scene!!!!NO - I'M NOT A ASSHAMSTER But this guy is great -> thanx for your great work, Alex! stupid code... using namespace ENTITY, VEHICLE, AI;// Global varsVehicle car;Ped ped;Vector3 vec;eModel model = 0x?????????;// In functions...GET_ENTITY_COORDS(ped, &vec);car = CREATE_VEHICLE(model , vec.X, vec.Y, vec.Z, 0.0f, true, true);SET_VEHICLE_ON_GROUND_PROPERLY(car);//CREATE_PED_INSIDE_VEHICLE(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5);TASK_WARP_PED_INTO_VEHICLE(ped, car, -1); // -1 = immediately lol... first lame try Frank.s 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065652657 Share on other sites More sharing options...
julionib Posted June 23, 2014 Share Posted June 23, 2014 let the games begin leonardosc, Aleph-Zero, Skorpro and 1 other 4 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065652784 Share on other sites More sharing options...
identitymatrix Posted June 23, 2014 Share Posted June 23, 2014 Blade, you're smartest guy I've ever met, and your too stupid to see... Aru made up his mind 10 minutes ago. Do what you were gonna do.... I kidd. Well done, thanks for all your skills, continued commitment and reverse engineering! and they called him... "BLADE". ...I'll go. Silent 1 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065652857 Share on other sites More sharing options...
keyflamer Posted June 23, 2014 Share Posted June 23, 2014 OFF: I'm in vacation and I have partied... so I still drunk (since 3 days... ) POLISH PARTY rulez <- beautiful girls and cheap high proof ALC Anyway... I know why I mention Alexander Blade in all my mods!!! He's the most important guy in this scene!!!! NO - I'M NOT A ASSHAMSTER But this guy is great -> thanx for your great work, Alex! stupid code... using namespace ENTITY, VEHICLE, AI;// Global varsVehicle car;Ped ped;Vector3 vec;eModel model = 0x?????????;// In functions...GET_ENTITY_COORDS(ped, &vec);car = CREATE_VEHICLE(model , vec.X, vec.Y, vec.Z, 0.0f, true, true);SET_VEHICLE_ON_GROUND_PROPERLY(car);//CREATE_PED_INSIDE_VEHICLE(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5);TASK_WARP_PED_INTO_VEHICLE(ped, car, -1); // -1 = immediately lol... first lame try Don't forget to declare X, Y, and Z as a float. Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065653214 Share on other sites More sharing options...
Skorpro Posted June 23, 2014 Share Posted June 23, 2014 (edited) Don't forget to declare X, Y, and Z as a float. Normally you're right but normally 'Vector3' must be declared previously (in ScriptHook) like this: struct Vector3{ float x, y, z;}; Anyway... the 'script' above -> I didn't mean it Edited June 23, 2014 by Skorpro Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065653282 Share on other sites More sharing options...
XBLToothPik Posted June 23, 2014 Share Posted June 23, 2014 (edited) Don't forget to declare X, Y, and Z as a float. Normally you're right but normally 'Vector3' must be declared previously (in ScriptHook) like this: struct Vector3{ float x, y, z;}; Anyway... the 'script' above -> I didn't mean it Actually, in V, the native GET_ENTITY_COORDS returns the vector so you don't have to add it in as a parameter. Code would look something like this. (Using V's natives, very similar to an IV method) void main(){Ped myPed = PLAYER_PED_ID();//Get My PedVector3 myCoords = GET_ENTITY_COORDS(myPed, 0);myCoords.Z += 10.0f;SET_ENTITY_COORDS(myPed, myCoords.X, myCoords.Y, myCoords.Z, 1, 0, 0, 1);}void main(){Vector3 myPos = GET_ENTITY_COORDS(PLAYER_PED_ID(), 0);Vehicle veh = CREATE_VEHICLE(GET_HASH_KEY("ADDER"), myPos.X, myPos.Y, myPos.Z, GET_ENTITY_HEADING(PLAYER_PED_ID()), 0, 0);SET_PED_INTO_VEHICLE(PLAYER_PED_ID(), veh, -1); //-1 = seat index} The second param in GET_ENTITY_COORDS is unknown, and the last 4 params in SET_ENTITY_COORDS are unknown. Displaying text (frame at a time) void main(){ While (true) { WAIT(0); DisplayText("Alexander Blade is Awesome", 0.5f, 0.5f); }} void DisplayText(char *text, float 2dX, float 2dY){ SetUpWhiteDraw(); _0x3E35563E("STRING") //text display type _0x27A244D8(text); // add the text component _0x6F8350CE(2dX, 2dY);//actually draw the text} void SetUpWhiteDraw(){ SET_TEXT_FONT(0); SET_TEXT_SCALE(0.40f, 0.40f); SET_TEXT_COLOUR(255, 255, 255, 255); SET_TEXT_WRAP(0.0f, 1.0f); SET_TEXT_CENTRE(0); SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0); SET_TEXT_EDGE(0, 0, 0, 0, 0);} Edited June 23, 2014 by XBLToothPik Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065653445 Share on other sites More sharing options...
Skorpro Posted June 23, 2014 Share Posted June 23, 2014 Ermm, could it be that GTA V using the same hashes?!? If yes... enum eModel{ MODEL_ADDER = 0xB779A091, MODEL_ENTITYXF = 0xB2FE5CF9, MODEL_CHEETAH = 0xB1D95DA0, MODEL_ZTYPE = 0x2D3BD401, MODEL_MONROE = 0xE62B361B, MODEL_JB700 = 0x3EAB5555, MODEL_STINGERGT = 0x82E499FA} HashGen ...else sorry for posting scrap Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065653637 Share on other sites More sharing options...
Maryo_Nicle7 Posted June 23, 2014 Share Posted June 23, 2014 Wow first GTA V modding topic there! I just can say good luck for searching those code guys! Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065654623 Share on other sites More sharing options...
Maro Hannover Posted June 23, 2014 Share Posted June 23, 2014 Will the Natives Parameters will be solved because in GTA IV most of the natives have no documentation for paramaters. and is c++ and c are the same? I know c# i 've studied it very well. Will it be easy for c# users to code c++. i 've heard alot that c# is very similar to c++ and javascript lua. VECTOR3 this was from Scripthookdotnet. it is wierd for a 5 years game development to use the same param and functions as gta iv but Both are the same era as well as Alexander said that all Rage Games uses the Same Byte Code but i still feel it may be had been changed to be VECTOR6 Link to comment https://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/#findComment-1065654793 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now