Commands

11/10/2013 10:42 Galyrion#1
My character is a PM, and here is a command:

And that one worked!

I have made some of the commands working for both PM and GM, but why doesn't this command works.. It shold be working for both GM and PM:
This one didn't work..
11/10/2013 13:43 Super Aids#2
Change && to ||.

&& means and, || means or.
11/10/2013 19:22 Galyrion#3
Quote:
Originally Posted by Super Aids View Post
Change && to ||.

&& means and, || means or.
I have already tried it, didn't work..
11/10/2013 19:26 Spirited#4
Quote:
Originally Posted by Super Aids View Post
Change && to ||.

&& means and, || means or.
That would not fix his problem. If you reverse that statement (the one you just suggested that he used), that would be "If the user is a GM and a PM". It should be kept as an AND in his statement so that it reads "If the user is not a GM and not a PM, then return false".

Going back to the command, what exactly are you expecting this command to do? What exactly is the problem? What's the context of the command? Have you tried debugging it? Either white box or black box testing would work. My signature contains good white box testing techniques. Black box testing is just putting some write lines to the console in places you expect it to run by.
11/11/2013 01:56 Smallxmac#5
I also would suggest adding a system to where it reads the account type from a row in the database and use that to check what type of account you have. This can be handy for a system I did to where when some one is logging in if they are not a staff member they will be closed and the custom server message will come up but if they are staff it will pass them into the server.
11/11/2013 06:48 Spirited#6
Quote:
Originally Posted by Smallxmac View Post
I also would suggest adding a system to where it reads the account type from a row in the database and use that to check what type of account you have. This can be handy for a system I did to where when some one is logging in if they are not a staff member they will be closed and the custom server message will come up but if they are staff it will pass them into the server.
He already has that, it's just with strings instead of a numerical / enumerated values. He doesn't need to do any work on that part of his project. It's also not very polite to bring up whatever irrelevant work you've done before making an attempt to solve his problem. It's kinda like saying "Oh, you have a broken knee? Why don't you try my new bike?" Gotta fix the problem he's experiencing first before introducing new problems.
11/11/2013 21:17 Galyrion#7
The problem: The commands doesn't work.

Here is a bigger part of the code:

I have tried all those commands, with both GM account and PM(And also Normal player of course).. Didn't work..
11/11/2013 21:30 turk55#8
I'm pretty sure that the string array Cmd is empty, try breakpointing it to see the values inside.
11/11/2013 21:35 Galyrion#9
Quote:
Originally Posted by turk55 View Post
I'm pretty sure that the string array Cmd is empty, try breakpointing it to see the values inside.
Honestly, i don't understand that breakpointing thing.. Have never used it before! I have it enabled on this line:
The line with red color is where my breakpointing is:
Code:
case "/life":
                    {
                        GC.MyChar.CurMP = (ushort)GC.MyChar.MaxMP; //<-- This is where i used the breakpoint.
                        GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
                        return true;
                    }
And i debug, and play game.. And i try the command, still not working.. And still no errors showing.
11/11/2013 22:07 Smallxmac#10
You really need to use breakpoints to see if the case is being called at all...

[Only registered and activated users can see links. Click Here To Register...]
11/11/2013 23:07 Spirited#11
Or, you could use my tutorial in my signature, but back to the code... As I said, Super Aids was wrong. The line where you have "if (GC.AuthInfo.Status != "[GM]" || GC.AuthInfo.Status != "[PM]") return false;" shouldn't have been changed. Think about it, it currently reads "If the game client's auth info status is not a Gm or not a Pm, return false." That's not right at all. It should be if the player isn't a GM and isn't a PM. That would mean the player isn't staff and shouldn't access the codes. Right now it will always be true, and the function will always return false.
11/12/2013 18:38 Galyrion#12
Quote:
Originally Posted by Fang View Post
Or, you could use my tutorial in my signature, but back to the code... As I said, Super Aids was wrong. The line where you have "if (GC.AuthInfo.Status != "[GM]" || GC.AuthInfo.Status != "[PM]") return false;" shouldn't have been changed. Think about it, it currently reads "If the game client's auth info status is not a Gm or not a Pm, return false." That's not right at all. It should be if the player isn't a GM and isn't a PM. That would mean the player isn't staff and shouldn't access the codes. Right now it will always be true, and the function will always return false.
Ugh, have been trying out stuff now, can't figure it out..

I also have commands for only PM:
And those works, but none of the commands inside the one for PM and GM
11/16/2013 11:25 Galyrion#13
I can't figure out, omg..

EDIT: I tried it like this, to check if it works for only PM's:
Code:
public static bool PmandGMCommand(Main.GameClient GC, string[] Cmd, string Message)
        {
           // string[] Cmd = Message.Split(' ');
            if (GC.AuthInfo.Status != "[PM]") return false;
That didn't work either!, and i have tried both ways, with all 3, PM, GM and normal character
11/16/2013 12:19 Spirited#14
I've already given you the answer in detail. I really have absolutely no idea what more you could want when the code has been posted for you. If you're still struggling, then what do you expect from us? You will not be able to make a respectable server without knowing how to program, and something so basic as to changing a very simple selection statement... it makes me wonder how you've made it this far to begin with.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

I really recommend you do something about your programming incapability. Online tutorials, classes at your local community college, what not - you have a lot of resources available to you. You're not going to be able to progress very quickly ignoring your problems with programming.