Making an Packet

11/28/2013 20:22 raventh1984#1
Hi elitepvpers,

I am strungeling on how to create an new packet.

This is what i have so far

MsgHdr.h
#define PACKETTYPE_UPDATETEST (WORD)0xDD000012

inside
DPClient.cpp
PHP Code:
void CDPClient::SendTestu_long idPlayerint IsRaven)
{
    
BEFORESENDSOLEarPACKETTYPE_UPDATETESTDPID_UNKNOWN );
    
ar << idPlayer << IsRaven;
    
SENDarthisDPID_SERVERPLAYER )

inside DPClient.h
PHP Code:
void    SendTestu_long idPlayerint IsRaven); 
now inside MoverRender.cpp i need to let it work
PHP Code:
if( IsRaven //I thought it has to be something like this however its not not sure what to add here then
        
{
            
CString strName;
            
strName szName;
            
strName += " [Bird]";
            
strcpyszName, (LPCTSTR)strName );
        } 
Maybe you can give me some pointers in this situation so i can learn on how to create it.

With kind regards
11/28/2013 21:48 alfredico#2
First you should start by learning C/C++.
11/28/2013 21:58 raventh1984#3
Best answer i ever heard.

I am learning and developing my skills in this matter. I dont ask for the whole solution but i only ask for tips. And yes you have given an tip but that is not the tip i was looking for xD.

I always say practice is the best learning way.
11/29/2013 13:42 Ryunat#4
Function call:

SendTest(idPlayer, IsRaven);
11/29/2013 18:20 xTwiLightx#5
Well, IsBird seems to be an boolean (is or is not), so try is with TRUE, FALSE.

SendTest( 1337, true );
11/29/2013 19:38 raventh1984#6
Thank you both i will see what i can do. I have only 1 question left about this.

Since its conserning MoverRender.cpp
Do i need to have it only in DPClient

Cause when i use SetSMMode inside DPClient its giving me the error that its not an Mover class. But its inside Mover.cpp/h And when i do it inside MoverSkill.cpp its working like it should be.

So again thank you for the tips i will see what i can do about it.
11/29/2013 19:47 alfredico#7
Maybe if you explain what are you trying to do, we may be able to help.
11/29/2013 19:53 raventh1984#8
Ok i am using this [Only registered and activated users can see links. Click Here To Register...]

To make an Premium system i like the way how sMMode functions.

So the TAG of the player is updated when ever the player is using the II_PREMIUM scroll
However there needs to be an packet sended so that its visible for evey other player.

Once i get the hang on how to create an packet and offcourse calling it the correct way. Then i can work on the rest of the script and also other futures.

I get the hang of c++ but i never experience on making and handeling packets. So thats way i am asking so i can learn it an bit faster. Then instead of 2 days of trying and mess more up then anything else.
11/29/2013 20:16 .SnoX#9
Quote:
Originally Posted by raventh1984 View Post
Ok i am using this [Only registered and activated users can see links. Click Here To Register...]

To make an Premium system i like the way how sMMode functions.

So the TAG of the player is updated when ever the player is using the II_PREMIUM scroll
However there needs to be an packet sended so that its visible for evey other player.

Once i get the hang on how to create an packet and offcourse calling it the correct way. Then i can work on the rest of the script and also other futures.

I get the hang of c++ but i never experience on making and handeling packets. So thats way i am asking so i can learn it an bit faster. Then instead of 2 days of trying and mess more up then anything else.
You dont need it.. SM Mode sucks..

Use this..
Quote:
#ifdef __PREMIUM
if( HasBuff( BUFF_ITEM, II_PREMIUM ) )
{
CString strName;
strName = szName;
strName += " [Premium]";
strcpy( szName, (LPCTSTR)strName );
}
#endif
11/29/2013 20:41 alfredico#10
You don't need to create a new function or "packet" to do this. There is already a function in MoverRender to render name CMover::RenderName and it's update in server somewhere, just by edit the function you can do the same without a new function.
The SnoX code should work.