Writing my first line of code in c# need some help

10/16/2008 05:48 demonscim#1
Hey guys, I am busy trying to write a little command that gives a player a starter pack, but it's a little confusing. I wanna make it to where if the players IP has already received a starter pack he will be unable to do it again.

sigh, I wish this was php, would be so much easier >.< . Here is what I have so far.

Code:
                                        if (Splitter[0] == "/starter")
                                        {
                                            MyChar.CPs += 54;
                                            MyChar.Silvers += 10000;
                                        }
Which from as far as I know, is as basic as basic gets.

EDIT:Sigh, I must be doing this wrong, even this small command is not working correctly. Any advice/help?
10/16/2008 06:53 kinshi88#2
Code:
                                        if (Splitter[0] == "/starter")
                                        {
                                            MyChar.CPs += 54;
                                            MyChar.Silvers += 10000;
                                        }
Alright, so this is what you have right now right?

Well, since there is a Server and a Client, you have to deal with both.
With that code you are adding silvers and cps to the Server, but you must make it reflect back on the Client.

So you use packets to send information between the Server and Client.
In this case, we will need to send the Vital packet, with the correct ID.

For CPs, the ID is 30.
So we send the packet:
Code:
SendPacket(General.MyPackets.Vital((long)MyChar.UID, 30, MyChar.CPs));
Now the CPs reflect on the Client.
And for Silvers, we do the same, just change the ID for silvers, which is 4.
Code:
SendPacket(General.MyPackets.Vital((long)MyChar.UID, 4, MyChar.Silvers));
So, now we have a working "Starter" command to add CPs and Silvers:
Code:
if (Splitter[0] == "/starter")
{
    MyChar.CPs += 54;
    SendPacket(General.MyPackets.Vital((long)MyChar.UID, 30, MyChar.CPs));
    MyChar.Silvers += 10000;
    SendPacket(General.MyPackets.Vital((long)MyChar.UID, 4, MyChar.Silvers));
}
10/16/2008 08:15 pauldexter#3
kinshi was right.
If you want that your command is only for 1 use then you need to use the mysql.
Or just edit the CreateCharacter in DataBase.cs that it will give cps or money or items for the first create character.

hope you get me
10/16/2008 13:15 demonscim#4
Thank you both, I understand well.
10/16/2008 16:51 taguro#5
Wow, nice to see E*Pvpers being used to help people and not to sell things... nice one Kinshi.
10/16/2008 18:41 felipeboladao#6
lol go to Database insert money and cps to creat chars