|
You last visited: Today at 20:45
Advertisement
Commands
Discussion on Commands within the CO2 Private Server forum part of the Conquer Online 2 category.
11/10/2013, 10:42
|
#1
|
elite*gold: 0
Join Date: Apr 2011
Posts: 28
Received Thanks: 0
|
Commands
My character is a PM, and here is a command:
Code:
if (GC.AuthInfo.Status != "[PM]") return false;
switch (Cmd[0])
{
case "/day":
{
Game.World.ScreenColor = 0;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
GC.LocalMessage(2011, "Haa day has arrived good morning everyone");
}
catch { }
return true;
}
]
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:
Code:
if (GC.AuthInfo.Status != "[GM]" && GC.AuthInfo.Status != "[PM]") return false;
switch (Cmd[0])
{
case "/lucky":
{
GC.LocalMessage(2000, "Lucky time: " + GC.MyChar.LuckyTime);
return true;
}
This one didn't work..
|
|
|
11/10/2013, 13:43
|
#2
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
Change && to ||.
&& means and, || means or.
|
|
|
11/10/2013, 19:22
|
#3
|
elite*gold: 0
Join Date: Apr 2011
Posts: 28
Received Thanks: 0
|
Quote:
Originally Posted by Super Aids
Change && to ||.
&& means and, || means or.
|
I have already tried it, didn't work..
|
|
|
11/10/2013, 19:26
|
#4
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
|
Quote:
Originally Posted by Super Aids
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
|
#5
|
elite*gold: 0
Join Date: Dec 2010
Posts: 105
Received Thanks: 13
|
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
|
#6
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
|
Quote:
Originally Posted by Smallxmac
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
|
#7
|
elite*gold: 0
Join Date: Apr 2011
Posts: 28
Received Thanks: 0
|
The problem: The commands doesn't work.
Here is a bigger part of the code:
Code:
public static bool PmandGMCommand(Main.GameClient GC, string[] Cmd, string Message)
{
//string[] Cmd = Message.Split(' ');
if (GC.AuthInfo.Status != "[GM]" || GC.AuthInfo.Status != "[PM]") return false;
switch (Cmd[0])
{
case "/xp":
{
GC.MyChar.StatEff.Add(NewestCOServer.Game.StatusEffectEn.XPStart);
GC.MyChar.Buffs.Add(new Game.Buff() { StEff = NewestCOServer.Game.StatusEffectEn.XPStart, Lasts = 20, Started = DateTime.Now, Eff = NewestCOServer.Features.SkillsClass.ExtraEffect.None });
return true;
}
case "/life":
{
GC.MyChar.CurMP = (ushort)GC.MyChar.MaxMP;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
return true;
}
case "/scroll":
{
if (Cmd[1] == "tc")
GC.MyChar.Teleport(1002, 432, 380);
if (Cmd[1] == "bi")
GC.MyChar.Teleport(1015, 716, 575);
if (Cmd[1] == "pc")
GC.MyChar.Teleport(1011, 193, 261);
if (Cmd[1] == "dc")
GC.MyChar.Teleport(1000, 500, 650);
if (Cmd[1] == "ac")
GC.MyChar.Teleport(1020, 565, 562);
if (Cmd[1] == "ma")
GC.MyChar.Teleport(1036, 211, 196);
if (Cmd[1] == "pka")
GC.MyChar.Teleport(1005, 50, 50);
if (Cmd[1] == "house")
GC.MyChar.Teleport(1099, 44, 40);
if (Cmd[1] == "ship")
//This works only if you have the ship map
GC.MyChar.Teleport(9999, 67, 52);
return true;
}
}
return false;
}
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
|
#8
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
|
I'm pretty sure that the string array Cmd is empty, try breakpointing it to see the values inside.
|
|
|
11/11/2013, 21:35
|
#9
|
elite*gold: 0
Join Date: Apr 2011
Posts: 28
Received Thanks: 0
|
Quote:
Originally Posted by turk55
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
|
#10
|
elite*gold: 0
Join Date: Dec 2010
Posts: 105
Received Thanks: 13
|
You really need to use breakpoints to see if the case is being called at all...
|
|
|
11/11/2013, 23:07
|
#11
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
|
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
|
#12
|
elite*gold: 0
Join Date: Apr 2011
Posts: 28
Received Thanks: 0
|
Quote:
Originally Posted by Fang
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:
Code:
if (GC.AuthInfo.Status != "[PM]") return false;
switch (Cmd[0])
{
case "/day":
{
Game.World.ScreenColor = 0;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
GC.LocalMessage(2011, "Haa day has arrived good morning everyone");
}
catch { }
return true;
}
And those works, but none of the commands inside the one for PM and GM
|
|
|
11/16/2013, 11:25
|
#13
|
elite*gold: 0
Join Date: Apr 2011
Posts: 28
Received Thanks: 0
|
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
|
#14
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
|
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.

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.
|
|
|
 |
Similar Threads
|
need gm commands
08/14/2011 - Rappelz - 5 Replies
hi guys
i have a privet server and i need some gm's command to get tools and pot
|
GM Commands
07/18/2011 - Flyff - 5 Replies
FlyFF V15 Item ID's and Buff ID's
------------------------------------------------- --------------------
************************************************* ****************************
Ultimate Weapon ID's
************************************************* ****************************
"Ultimate Vampire Yo-Yo" 010832
"Ultimate Vampire Bow" 010830
"Ultimate Vampire Staff" 010828
"Ultimate Vampire Wand" 010826
"Ultimate Vampire...
|
some Gm commands
12/22/2010 - Dekaron Private Server - 4 Replies
here is some
i,M a GM on SPECTRUS DEKARON so tha r a little old but tha can help some ppl out
my fav is 3728 gives coppers silver and golds lol fun fun
|
[Key Commands] Default Key Commands for the beginners
10/01/2008 - General Gaming Releases - 0 Replies
Default keybindings:
Abilities Window V
Backpack Window: B
Career Window: K
Character Window: C
Battlegroup Window: Left Alt + R
Developer Window: ;
Guild Window: G
Help Window: H
|
All times are GMT +1. The time now is 20:45.
|
|