View Full Version : 317 - Making items Donar/Staff only
iMPeX
June 29th, 2010, 00:42
Yes, this is easy, and should be known by all.
Go into your client.java, server sided.
Then find...
public boolean wear(int wearID, int slot)
Sometimes wear, may be Equip.
Next, under the bracket...
This is for donar, so put...
if(wearID == #### && donator < 1)
{
sM("You must be a donar to wear this item.");
return false;
}
Obviously, changing #### to the item ID.
Now, if you want to make it staff only, you do this...
if(wearID == #### && playerRights < #)
{
sM("You must be a member of staff to wear this.");
return false;
)
Again, changing #### to the item ID.
Now, where it says playerRights < #, if you want it to be mod only, you'd put 1, but if you don't want owners or admins to wear it, you'd put...
if(wearID == #### && (playerRights < 1 || playerRights > 1))
{
sM("You must be a member of staff to wear this.");
return false;
)
That makes it so ONLY mods can wear that item, not donars, admins, or owners.
You can do the same thing with Admin, and owner.
Thanks
iMPeX
Aaron
June 29th, 2010, 00:46
Thank you so much me and ALL my friends needed this!
iMPeX
June 29th, 2010, 01:00
Thank you so much me and ALL my friends needed this!
Lol, no problem Aaron, happy to help.
Xdragon
June 29th, 2010, 11:31
if(wearID == #### && donator < 1)
{
sM("You must be a donar to wear this item.");
}
if(wearID == #### && playerRights < #)
{
sM("You must be a member of staff to wear this.");
)
if(wearID == #### && (playerRights < 1 || playerRights > 1))
{
sM("You must be a member of staff to wear this.");
)
Fail lol At the Donator Thing the < is wrong it needs to be > or == Bc if u do < its for Donators and Lower ranks if u do > Its for Donator and higher rank but if u do == its only For Donator Same whith the staff thing...
Mohammad
July 1st, 2010, 10:04
Yo,
Add return false; and the end and fix it because it won't work.
Anyways......... good try.
iMPeX
July 2nd, 2010, 20:12
Fail lol At the Donator Thing the < is wrong it needs to be > or == Bc if u do < its for Donators and Lower ranks if u do > Its for Donator and higher rank but if u do == its only For Donator Same whith the staff thing...
Lol...? the donator < 1 means, if you're not a donar, you get the sM Message, which is what you want...
Also, Mohammad, thanks for pointing that out, forgot about it.
Xdragon
July 3rd, 2010, 17:53
Lol when i do < 1 Every Regular player can wear the items. lol?
Zero Mercy
July 4th, 2010, 03:25
Lol...? the donator < 1 means, if you're not a donar, you get the sM Message, which is what you want...
Also, Mohammad, thanks for pointing that out, forgot about it.
He's right...
< is lesser then
> is greater then
== is equal to
>= is equal to or greater then
<= is equal to or lesser then
!= Not equal to
Only the registered members can see the link.
iMPeX
July 7th, 2010, 20:20
He's right...
< is lesser then
> is greater then
== is equal to
>= is equal to or greater then
<= is equal to or lesser then
!= Not equal to
Only the registered members can see the link.
I know, but within the code, it's like...
if(donator < 1) {
Iif(weariD == ####) {
sM("Message");
return false;
}
}
That means, if you're not a donar, and you're trying to wear the item, you get the sM message, and the return false makes it so it doesn't equip.
lukespook
July 7th, 2010, 20:59
man, this gives me 40 errors and i dont know ewhy, any solutions?
Mohammad
July 8th, 2010, 06:29
Yes you suck thats the solution.
hehe,
Luke come on skype your taking ages.
elf run1
July 8th, 2010, 09:26
man, this gives me 40 errors and i dont know ewhy, any solutions?
post your errors
CoolDude12
July 9th, 2010, 00:21
this is a good tut.
i'll try to add
gilles
July 9th, 2010, 03:12
if(wearID == #### && (playerRights < 1 || playerRights > 1))
{
sM("You must be a member of staff to wear this.");
return false;
)
You better change this to:
if(wearID == #### && playerRights != 1)
{
sM("You must be a Moderator to wear this.");
return false;
)
This will make it is Moderator only, like you said, but it's mutch easyer.
Pyro Sauce
August 24th, 2010, 07:15
I have Project Insanity so i cant find
public boolean wear(int wearID, int slot)
in my client.java
iDani3l
September 20th, 2010, 14:25
I have Project Insanity so i cant find
public boolean wear(int wearID, int slot)
in my client.java
Needs to be in your server..
%YOURSERVERURLYHERE%\src\server\model\players\Clie nt.java
With a capital C..
bwuk
September 20th, 2010, 14:27
Everyone should know this, It's easy lol.
Wel thanks for this guide ;)
Angel`
September 27th, 2010, 03:59
good tut, this is where I would +1 ur rep if we had rep on this forums.
tijgertje
October 31st, 2010, 21:29
works perfect for me :) THX
`Conner
November 1st, 2010, 15:50
I know, but within the code, it's like...
if(donator < 1) {
Iif(weariD == ####) {
sM("Message");
return false;
}
}
That means, if you're not a donar, and you're trying to wear the item, you get the sM message, and the return false makes it so it doesn't equip.
Dude, you are still using integers to imitate booleans. And why aren't you using a switch/case statement? Whenever you deal with numbers for more than just two cases, you should...
Meatball
November 8th, 2010, 21:43
Not trying to bicker and such, but there was never, and never will be (Donator/Donater/donar etc..)
The correct spelling is: Donor.
And again, i'm just saying so you can make your server more... let's just say.. Professional?
ctk62
December 12th, 2010, 04:43
didnt work
ctk62
December 14th, 2010, 04:08
sorry for that was using a bad source before, my lil bro got this to work with marcscape and everything he has up there 100% works no switching > for < or whatever
Sweet Ride
January 7th, 2011, 14:14
Needs to be in your server..
%YOURSERVERURLYHERE%\src\server\model\players\Clie nt.java
With a capital C..
Not all sources are the same. I use PI and it is NOT in Client.java
I believe it's WearItem.java
Not sure because I only know things I've come across before. :p
Not trying to bicker and such, but there was never, and never will be (Donator/Donater/donar etc..)
The correct spelling is: Donor.
And again, i'm just saying so you can make your server more... let's just say.. Professional?
Donator is a word. Donater, donar, and donor, are not in the English dictionary. They are shortened versions completely made up by people.
CRAIZYBART
January 7th, 2011, 14:25
is very helpful :D isnt give any errors woot! ;)
tehswedish
January 8th, 2011, 14:09
i can't find the client.java.. were is it?
Powered by vBulletin® Version 4.1.9 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.