Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

[C++] Phone Based Mod Menu


gopro_2027
 Share

Recommended Posts

Hello Gta Forums!

I don't post much here because I only mod PS3, but I have something you may like!

Below I have some code snippets for creating a phone based menu design, reversed mainly from the settings app script.

Video of it in action:

Okay so the code!

I am just releasing the snippets and not a full base because I don't code pc stuff so I don't know how to do that but it's all natives, except for one bug fix (for when the game tried to close the phone, so not necessary but useful) that I had to reverse from DESTROY_MOBILE_PHONE.

Code (pastebin.com/i88X3wkE):

//By gopro_2027void func_38(int scaleform, char *thang, float uParam2, float fParam3, float fParam4, float fParam5, float fParam6){	GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(scaleform, thang);	GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(uParam2);	if (fParam3 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam3);	}	if (fParam4 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam4);	}	if (fParam5 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam5);	}	if (fParam6 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam6);	}	GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();}void func_14(char *uParam0, bool stringsAreGXT = false){	if (stringsAreGXT == false) {		GRAPHICS::_BEGIN_TEXT_COMPONENT("STRING");		UI::_ADD_TEXT_COMPONENT_STRING(uParam0);	} else {		GRAPHICS::_BEGIN_TEXT_COMPONENT(uParam0);	}	GRAPHICS::_END_TEXT_COMPONENT();}void func_20(int uParam0, char *uParam1, float uParam2, float fParam3, float fParam4, float fParam5, float fParam6, char *uParam7, char *uParam8, char *uParam9, char *uParam10, char *uParam11, bool stringsAreGXT = false){	GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(uParam0, uParam1);	GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(uParam2);	if (fParam3 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam3);	}	if (fParam4 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam4);	}	if (fParam5 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam5);	}	if (fParam6 != -1.0f)	{		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(fParam6);	}	if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(uParam7))	{		func_14(uParam7,stringsAreGXT);	}	if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(uParam8))	{		func_14(uParam8,stringsAreGXT);	}	if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(uParam9))	{		func_14(uParam9,stringsAreGXT);	}	if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(uParam10))	{		func_14(uParam10,stringsAreGXT);	}	if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(uParam11))	{		func_14(uParam11,stringsAreGXT);	}	GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();}int currentOption = 0;bool createPhone = false;int phonescaleForm = -1;float sizeOfEachRow = 1.0f/maxOptions;int phoneCurrentRender = 0;int lastAmountOptionsPhone = 0;int phonerenderid = 0;#define PHONE_TYPE 22.0f//int phoneBackgroundImage = 0;int phoneTheme = 1;int phoneType = 2;float phoneSize = 500.0f;void updatePhoneTitle();void setPhoneKey(int buttonSpot, float unk1, float icon, char *unk3) {	func_20(phonescaleForm, "SET_SOFT_KEYS", buttonSpot, unk1, icon, -1.0f, -1.0f, unk3, 0, 0, 0, 0);}void setupPhone() {	phoneCurrentRender = 0;	MOBILE::GET_MOBILE_PHONE_RENDER_ID(&phonerenderid);	//check to make sure phone wasn't closed by game	/*	bugfix for when the game disposes of the phone when you get a call or something	if (submenu != Closed)		if (*(char*)0x1D6D888 == 0)//check if phone is closed or not			createPhone = true;	*/		//create phone if requested	if (createPhone) {		MOBILE::CREATE_MOBILE_PHONE(phoneType);//0 is multiplayer phone		//get render id		MOBILE::GET_MOBILE_PHONE_RENDER_ID(&phonerenderid);		createPhone = false;	}	//setting phone properties	MOBILE::SET_MOBILE_PHONE_SCALE(phoneSize);	Vector3 phonePos = {99.62,-45.305,-113};	Vector3 phoneRot = {-90,0,0};	MOBILE::SET_MOBILE_PHONE_POSITION(phonePos.x,phonePos.y,phonePos.z);	MOBILE::SET_MOBILE_PHONE_ROTATION(phoneRot.x,phoneRot.y,phoneRot.z,0);	//starting rendering based stuff	UI::SET_TEXT_RENDER_ID(phonerenderid);	phonescaleForm = GRAPHICS::REQUEST_SCALEFORM_MOVIE("cellphone_ifruit");		//clear options	for (int i = 0; i < lastAmountOptionsPhone; i++)		func_38(phonescaleForm, "SET_DATA_SLOT_EMPTY", PHONE_TYPE, i, -1, -1, -1);	//func_38(phonescaleForm, "SET_BACKGROUND_IMAGE", phoneBackgroundImage, -1.0f, -1.0f, -1.0f, -1.0f);//not useful for this phone, but should work	func_38(phonescaleForm, "SET_THEME", phoneTheme, -1.0f, -1.0f, -1.0f, -1.0f);	//func_20(phonescaleForm, "SET_SOFT_KEYS", 3.0f, 1.0f, 6.0f, -1.0f, -1.0f, "CELL_202", 0, 0, 0, 0);//white phone in slot 3	setPhoneKey(3,1,6,"CELL_202");	setPhoneKey(2,1,3,"CELL_225");	setPhoneKey(1,1,4,"CELL_206");	updatePhoneTitle();	lastAmountOptionsPhone = 0;}//updatePhoneTitle() calls this functionvoid updatePhoneProvider(){	int uLocal_54,iLocal_34,iLocal_55 = 0;	Vector3 c = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);	uLocal_54 = ZONE::GET_ZONE_SCUMMINESS(ZONE::GET_ZONE_AT_COORDS(c.x,c.y,c.z));	switch (uLocal_54)	{		case 0:			iLocal_34 = 5;			break;				case 1:			iLocal_34 = 5;			break;				case 2:			iLocal_34 = 4;			break;				case 3:			iLocal_34 = 4;			break;				case 4:			iLocal_34 = 3;			break;				case 5:			iLocal_34 = 2;			break;				default:			iLocal_34 = 3;			break;	}	iLocal_55 = GAMEPLAY::GET_RANDOM_INT_IN_RANGE(0, 8);	if (iLocal_55 < 2)	{		if (iLocal_34 > 2)		{			iLocal_34--;		}	}	int uLocal_33 = Global(87755).imm(11664).arr(Global(10434).get<int>(),20).imm(8).get<int>();//this needs to be updates to pc if u want it	func_38(phonescaleForm, "SET_PROVIDER_ICON", uLocal_33, iLocal_34, -1.0f, -1.0f, -1.0f);}int currentMinutes = 0;void updatePhoneTitle() {	int iLocal_36 = TIME::GET_CLOCK_MINUTES();	if (iLocal_36 != currentMinutes)	{		currentMinutes = iLocal_36;		int uLocal_35 = TIME::GET_CLOCK_HOURS();		int uLocal_37 = TIME::GET_CLOCK_DAY_OF_WEEK();		char cLocal_38[16];		switch (uLocal_37)		{			case 0:				strncpy(cLocal_38, "CELL_920", 16);				break;						case 1:				strncpy(cLocal_38, "CELL_921", 16);				break;						case 2:				strncpy(cLocal_38, "CELL_922", 16);				break;						case 3:				strncpy(cLocal_38, "CELL_923", 16);				break;						case 4:				strncpy(cLocal_38, "CELL_924", 16);				break;						case 5:				strncpy(cLocal_38, "CELL_925", 16);				break;						case 6:				strncpy(cLocal_38, "CELL_926", 16);				break;						default:				strncpy(cLocal_38, "CELL_206", 16);				break;		}		func_20(phonescaleForm, "SET_TITLEBAR_TIME", uLocal_35, iLocal_36, -1.0f, -1.0f, -1.0f, cLocal_38, 0, 0, 0, 0,true);		updatePhoneProvider();	}}void AddPhoneTitle(char *text) {	UI::SET_TEXT_RENDER_ID(phonerenderid);	//set header	phonescaleForm = GRAPHICS::REQUEST_SCALEFORM_MOVIE("cellphone_ifruit");	GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(phonescaleForm, "SET_HEADER");	GRAPHICS::_BEGIN_TEXT_COMPONENT("STRING");	UI::_ADD_TEXT_COMPONENT_STRING(text);	GRAPHICS::_END_TEXT_COMPONENT();	GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();}void AddPhoneOption(char* text,int icon = 0){	UI::SET_TEXT_RENDER_ID(phonerenderid);		phonescaleForm = GRAPHICS::REQUEST_SCALEFORM_MOVIE("cellphone_ifruit");	func_20(phonescaleForm, "SET_DATA_SLOT", PHONE_TYPE, phoneCurrentRender, icon/*this is the icon next to it*/, -1.0f, -1.0f, text, 0, 0, 0, 0);		phoneCurrentRender += 1;	lastAmountOptionsPhone = phoneCurrentRender;}int getSelectedPhoneOption() {	return currentOption;}void drawThePhone() {	UI::SET_TEXT_RENDER_ID(phonerenderid);	func_38(phonescaleForm,"DISPLAY_VIEW",PHONE_TYPE,currentOption-1,-1,-1,-1);//this is for like the current selected option	GRAPHICS::DRAW_SCALEFORM_MOVIE(phonescaleForm,0.1f,0.179f,0.2,0.356,255,255,255,255);}//this function allow you to get out of the phone rendering spot and render on the screenvoid resetRendering() {	UI::SET_TEXT_RENDER_ID(UI::GET_DEFAULT_SCRIPT_RENDERTARGET_RENDER_ID());}example:void hook() {	setupPhone();	AddPhoneTitle("Mod Menu");	AddPhoneOption("Option 1");	AddPhoneOption("Option 2");	AddPhoneOption("Option 3");	drawThePhone();} 

Thanks!

~gopro_2027

Edited by gopro_2027
  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.