Jump to content

How to Add a PSSliderCell to Your PreferenceBundle


13 posts in this topic

Recommended Posts

Updated

Fy7mUys.png

In this tutorial, I will show you how you can add a PSSliderCell in your Patcher/PreferenceBundle project.

Step 1. Start a new theos project.

Step 2:

This is the code required in Tweak.xm:


#import <substrate.h>
#import <Foundation/Foundation.h>

#define PLIST_PATH @"/var/mobile/Library/Preferences/YOUR PLIST NAME HERE.plist"
 
inline bool GetPrefBool(NSString *key) {
	return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];
}

inline int GetPrefInt(NSString *key) {
	return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] intValue];
}

%hook Coins
- (int)have {
	if(GetPrefBool(@"key1")) { // Your key name here
			int newValue = GetPrefInt(@"key1slider"); // Your key name here
			return newValue;
		} else {
			return %orig;
	}
}
%end

Step 3: Now in your preferences plist file, you will need to add two cells. One is a button to toggle the PSSliderCell on/of and the other is the PSSliderCell itself.


                <dict>
			<key>cell</key>
			<string>PSSwitchCell</string>
			<key>default</key>
			<false/>
			<key>defaults</key>
			<string>iosgods.com.pouslider</string>
			<key>key</key>
			<string>key1</string>
			<key>label</key>
			<string>Enable Coins Hack</string> <!-- The text of your switch -->
		</dict>
		<dict>
			<key>cell</key>
			<string>PSSliderCell</string>
			<key>default</key>
			<integer>50</integer> <!-- Default value of the slider -->
			<key>defaults</key>
			<string>iosgods.com.pouslider</string> <!-- Your package name here -->
			<key>key</key>
			<string>key1slider</string> <!-- Your key name here -->
			<key>max</key>
			<real>99</real> <!-- Enter your maximum value here -->
			<key>min</key>
			<real>1</real> <!-- Enter your minimum value here -->
			<key>showValue</key> <!-- Show the value of the slider. true or false. -->
			<true/>
		</dict>

Now save and compile and you should be good to go!

If you have any questions or need any help, post down below. :)

  • Like 1
Posted
This is very useful.

But my problem is that I want an example, parameters are offset attack function is 0x234567, I know that in most cases this is a floating-point functions, if I want to attack the original attack 1-10 times, how to write code tweak.xm Lane? This is the problem has been bothering me, I hope I can help DIDA@@DiDA

Posted

 

This is very useful.
But my problem is that I want an example, parameters are offset attack function is 0x234567, I know that in most cases this is a floating-point functions, if I want to attack the original attack 1-10 times, how to write code tweak.xm Lane? This is the problem has been bothering me, I hope I can help DIDA@@DiDA

 

You want to return a custom value in a function instead of a huge amount?

Posted

@DiDA i want to return several times attack values. such as ,if orig attack value is 1000,then return 2 times,it is 2000

.if return 5 times ,it is 1000*5=5000

players can select himself times to attack.

i want to you can give me code example.

I wonder if you know what I mean.

Posted

@DiDA i want to return several times attack values. such as ,if orig attack value is 1000,then return 2 times,it is 2000

.if return 5 times ,it is 1000*5=5000

players can select himself times to attack.

i want to you can give me code example.

I wonder if you know what I mean.

PM me. :)

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
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines