I Need help creating a command.

08/03/2010 22:34 xXxTwiztedKidxXx#1
Ok im useing 5165 and i need to know how to create a command to give cps to others and display a message. If you can help me that would be great.
08/03/2010 22:47 .Beatz#2
I will not show you how to do this but I will point you in the right direction. I will show you some things from a 5165 source and hopefully you will be able to work at it and get the command right. This is not be being nasty, this is me helping you to learn.

Take this as an example.
Code:
if (Cmd[0] == "/ctele" && GC.AuthInfo.Status == "[PM]")
                        {
                            Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                            if (C != null)
                                GC.MyChar.Teleport(C.Loc.Map, C.Loc.X, C.Loc.Y);
                        }
Then also take this as an example.
Code:
if (Cmd[0] == "/cps")
                            GC.MyChar.CPs = uint.Parse(Cmd[1]);
Using these two examples you should be able to create a command that will award a player CPs.

hint:
if (Cmd[0] == "/cps" && GC.AuthInfo.Status == "[PM]")
{
}


Hope this helps.
Add me on msn if you truly cant figure this out and I will help you some more
08/03/2010 22:50 pro4never#3
Phone net so can't write it fully..


If(cmd[0] == "givecp")
{
//foreach loop throuugh your dict or hashtable of connected clients. Our loop will be 'chr'
if(chr.value.name == cmd[1])
{
Chr.value.cps += cmd[2];
Chr.value.send(//chat packet with what's happenned);
break;
}
}
08/03/2010 22:59 _DreadNought_#4
so
Code:
if (Cmd[0] == "/cps && GC.AuthInfo.Status == "[PM]")
{
foreach(Game.Character Server in Game.World.H_Chars.Values)
{
int CPs = Int.Parse(Cmd[1])
SendMsgToAll(2011, "You all get + " CPs + " cps free.");
Server.CPs += mehmehmeh
}
}
Kinda did it all for you there, but theres crap you needa change ;)
08/03/2010 23:23 xXxTwiztedKidxXx#5
Im trying to come up with one that give 1 person cps and it says something like "soandso got "the amount given" for recuiting people."
08/03/2010 23:36 Fish*#6
Code:
if (Cmd[0] == "/givecps")
{
foreach(Game.Character C in Game.World.H_Chars.Values)
{
if (Cmd[1] == C.Name)
{
C.CPs += uint.Parse(Cmd[2]);
World.SendMsgToAll(2011, C.Name + "have got CPs from " + GC.MyChar.Name);
}
}
}
ex.
Quote:
/givecps testaccount 1000000
08/04/2010 02:33 Arcо#7
Quote:
Originally Posted by grillmad View Post
Code:
if (Cmd[0] == "/givecps")
{
foreach(Game.Character C in Game.World.H_Chars.Values)
{
if (Cmd[1] == C.Name)
{
C.CPs += uint.Parse(Cmd[2]);
World.SendMsgToAll(2011, C.Name + "have got CPs from " + GC.MyChar.Name);
}
}
}
ex.
The hell?
Do what matty did and do the char from name.

if (Cmd[0] == "/givecp")
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if(C != null)
{
C.Cps += uint.Parse(Cmd[2]);
C.MyClient.LocalMessage(2005, "You have recieved "+ Cmd[2] +" Cps from the GM.");
}
}

So

/givecp Arco 220
08/04/2010 17:47 Zkiller110#8
ahaaha there r so many ways to do this you got to be very specific on what you want the command to do and what you want the player to type for the command