How to block some commands in certain maps.
Hello!This is my second tutorial on ragezone.:D:
There is already one in ragezone on how to block some commands in some maps but it didn't work.It's made by Ehab.Link
Well Credits to Ehab for him former Tut.:lol:
First,you will have to go to your commands .java files.
Which will be here src/net/sf/odinms/client/messages/commands/
or here
src/net/sf/odinms/client/messages/
Open it with notepad or wordpad.
Find the command that you want to block in some map.
Let's use @spinel as an exmaple.We want to block it in FM or other map.Find the code for the map you want to block,in my case it will be 910000000.
You will find the command @spinel.
So, it will be like this.
Code:
else if (splitted[0].equals("@spinel")) {
NPCScriptManager.getInstance().start(c, 9000020);
}
Add this,so that the players can't use it in fm.
Code:
if (player.getMapId() == 910000000){
mc.dropMessage("You cannot use this command in this map");
}
After this.
Code:
else if (splitted[0].equals("@spinel")) {
Then this,
Code:
else{
NPCScriptManager.getInstance().start(c, 9000020);
}
Before the last }.
So,the result code will be like this.
Code:
else if (splitted[0].equals("@spinel")) {
if (player.getMapId() == 910000000){
mc.dropMessage("This command have been block from this map.");
}else{
NPCScriptManager.getInstance().start(c, 9000020);
}
}
Compile and restart the server.
If you want to block in multiple maps,add the map id and ||.Like this
Code:
else if (splitted[0].equals("@spinel")) {
if (player.getMapId() == 910000000 || player.getMapId() == another map id || player.getMapId() == another map id){
mc.dropMessage("This command have been block from this map.");
}else{
NPCScriptManager.getInstance().start(c, 9000020);
}
}
If you want to block other command,the method is the same.
Add
Code:
if (player.getMapId() == Map ID){
mc.dropMessage("This command have been block from this map.");
}else{
After
Code:
else if (splitted[0].equals("your command")) {
And add a extra } at the end of the command.
Hope this helps.:lol: :D: :rolleyes: :thumbup: :ott: :w00t:
Re: How to block some commands in certain maps.
else if (splitted[0].equals("@spinel")) {
if (!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
mc.dropMessage("This command have been block from this map.");
}else{
NPCScriptManager.getInstance().start(c, 9000020);
}
}
wrong.
do it like this
else if (splitted[0].equals("command here")) {
if (player.isBlockedMap()) mc.dropMessage("NO USING COMMANDS HERE");
else {
add rets of command here
}
in maplecharacter add
public void isBlockedMap(int x) {
int[] blockedMaps = {/*add ids here separated by commas*/};
for(int i : blockedMaps) if (map.getId() == i) return true;
return false;
}
Re: How to block some commands in certain maps.
Quote:
Originally Posted by
jakesdexless
else if (splitted[0].equals("@spinel")) {
if (!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
mc.dropMessage("This command have been block from this map.");
}else{
NPCScriptManager.getInstance().start(c, 9000020);
}
}
wrong.
do it like this
else if (splitted[0].equals("command here")) {
if (player.isBlockedMap()) mc.dropMessage("NO USING COMMANDS HERE");
else {
add rets of command here
}
in maplecharacter add
public void isBlockedMap(int x) {
int[] blockedMaps = {/*add ids here separated by commas*/};
for(int i : blockedMaps) if (map.getId() == i) return true;
return false;
}
That's a alternative way.But mine also works.:(::(:
But people will be not sure where to put
Code:
public void isBlockedMap(int x) {
int[] blockedMaps = {/*add ids here separated by commas*/};
for(int i : blockedMaps) if (map.getId() == i) return true;
return false;
}
Re: How to block some commands in certain maps.
Quote:
Originally Posted by
naylinn12
That's a alternative way.But mine also works.:(::(:
But people will be not sure where to put
Code:
public void isBlockedMap(int x) {
int[] blockedMaps = {/*add ids here separated by commas*/};
for(int i : blockedMaps) if (map.getId() == i) return true;
return false;
}
Yours will not work because
Code:
if (!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
mc.dropMessage("This command have been block from this map.");
Means if they are not on maps 910000000, 100000000, or 200000000, it will display a message saying...
Code:
mc.dropMessage("This command have been block from this map.");
Remove the ! and it will check for those maps, otherwise it will check to see if they aren't on those maps to display the message.
EDIT: He also said people would add that in MapleCharacter.
Re: How to block some commands in certain maps.
if (!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
mc.dropMessage("This command have been block from this map.");
it has to be
!player.getMapId() == 910000000 || player.getMapId() ==100000000 || player.getMapId() ==200000000
Re: How to block some commands in certain maps.
Quote:
Originally Posted by
jakesdexless
if (!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
mc.dropMessage("This command have been block from this map.");
it has to be
!player.getMapId() == 910000000 || player.getMapId() ==100000000 || player.getMapId() ==200000000
Ohh:(::(:
---------- Post added at 04:47 PM ---------- Previous post was at 04:38 PM ----------
Quote:
Originally Posted by
bboy242
Yours will not work because
Code:
if (!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
mc.dropMessage("This command have been block from this map.");
Means if they are
not on maps 910000000, 100000000, or 200000000, it will display a message saying...
Code:
mc.dropMessage("This command have been block from this map.");
Remove the ! and it will check for those maps, otherwise it will check to see if they aren't on those maps to display the message.
EDIT: He also said people would add that in MapleCharacter.
But where in MapleCharacter.java.I know but some people will ask :blush:
If they are not in FM,Henesys,Oribs,they will be able to use the command rite?
Re: How to block some commands in certain maps.
If you have a ! before checking the maps, like you had, like this...
!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
It would check to make sure they are not on those maps. According to your command, if they weren't on those maps, it would display the message that the command is blocked. Change it to this...
PHP Code:
} else if (splitted[0].equals("@spinel")) {
if (player.getMapId() == 910000000 || player.getMapId() == 100000000 || player.getMapId() == 200000000) {
mc.dropMessage("This command have been block from this map.");
}else{
NPCScriptManager.getInstance().start(c, 9000020);
}
}
This will check to see if they are on those maps. If they are on those maps, it will say the command is blocked. Read the command like this.
IF player is on map (FM, Henesys, Orbis), tell them the command is blocked.. ELSE let them talk to the NPC.
Get it?
Re: How to block some commands in certain maps.
Quote:
Originally Posted by
bboy242
If you have a ! before checking the maps, like you had, like this...
!player.getMapId() == 910000000 || 100000000 || 200000000 || map id){
It would check to make sure they are not on those maps. According to your command, if they weren't on those maps, it would display the message that the command is blocked. Change it to this...
PHP Code:
} else if (splitted[0].equals("@spinel")) {
if (player.getMapId() == 910000000 || player.getMapId() == 100000000 || player.getMapId() == 200000000) {
mc.dropMessage("This command have been block from this map.");
}else{
NPCScriptManager.getInstance().start(c, 9000020);
}
}
This will check to see if they are on those maps. If they are on those maps, it will say the command is blocked. Read the command like this.
IF player is on map (FM, Henesys, Orbis), tell them the command is blocked..
ELSE let them talk to the NPC.
Get it?
Ok,thanks for fixing my mistake. :D::D::D:
Re: How to block some commands in certain maps.
Re: How to block some commands in certain maps.
I believe this tutorial has been posted before by Ehab I think here the link and I believe you leeched it from his tutorial as well. You just added a few more things like extra map id's. Here's the link to his tutorial http://forum.ragezone.com/f428/block...n-maps-605421/
Re: How to block some commands in certain maps.
Wowa this is usefull :) I will try it later tho
Re: How to block some commands in certain maps.
He or she's just trying to gain e-fame by writing some shitty tuts from leeched ones.
Re: How to block some commands in certain maps.
Quote:
Originally Posted by
xHerDesire<33
He or she's just trying to gain e-fame by writing some shitty tuts from leeched ones.
o.o The other one was incorrect.
Re: How to block some commands in certain maps.
What the hell? this is MINE!!
Re: How to block some commands in certain maps.
Wouldn't it be easier to just use
Code:
} else if ((splitted[0].equalsIgnoreCase("@spinel")) && (!inBlockedMap())) {
NPCScriptManager.getInstance().start(c, 9000020);