Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Make a packet


PKDemon
 Share

Recommended Posts

i have been looking throw the code and trying to learn how everything is done but there is one thing that i would like to add but my knowledge with EO is limited

i am trying to make a packet where u can send a command through like php to be able to display the total people online (in a number) and another one to list all the character names that is online

i have been trying but all i have came up with is this little bit of code and dont even know if it will work

only thing i can figure out is how to set it up when i send the command to the server how to send the data back to whatever sent the command

but here is what little bit of code i have came up with

```

If IsLoggedIn = True Then

If GetPlayerAccess(index) = 9 Then

s = s & "**" & GetPlayerName(index) & "**"

Else

s = s & GetPlayerName(index)

End If

End If

```
Link to comment
Share on other sites

i will look through the post and see what i can come up with but what i am having problems with is that how i send the command from a php script to the server and then the server send the info back to the script to display it
Link to comment
Share on other sites

Why're you using a PHP script in EO?

EO utilizes a byte packet array system. If you follow the patterns used in modClientTCP, modHandleData, modEnumerations and modServerTCP you'll find a grand example of how packets work in EO.

You use an instance of the buffer class, which can be found in each project (client and server) and write your data. Then the recipient handles that data through the modHandleData procedures.

In this case, you'd have something trigger the packet to be sent, maybe the client loading the GUI, and it'll send the packet you've written in modClientTCP, say you named it GetPlayersOnline, and then when the Server received this packet with modHandleData.

It would then process the received information through a defined procedure in that module, and in turn send another packet with ServerTCP that returns the requested information, which once again, is then handled by the module modHandleData by the Client.

The client then uses its handling code written in that module, to receive the information sent by the server.

The tutorial provided above shows all this and more.
Link to comment
Share on other sites

@[rose:

> link=topic=79593.msg853673#msg853673 date=1335228823]
> Why're you using a PHP script in EO?
>
> EO utilizes a byte packet array system. If you follow the patterns used in modClientTCP, modHandleData, modEnumerations and modServerTCP you'll find a grand example of how packets work in EO.
>
> You use an instance of the buffer class, which can be found in each project (client and server) and write your data. Then the recipient handles that data through the modHandleData procedures.
>
> In this case, you'd have something trigger the packet to be sent, maybe the client loading the GUI, and it'll send the packet you've written in modClientTCP, say you named it GetPlayersOnline, and then when the Server received this packet with modHandleData.
>
> It would then process the received information through a defined procedure in that module, and in turn send another packet with ServerTCP that returns the requested information, which once again, is then handled by the module modHandleData by the Client.
>
> The client then uses its handling code written in that module, to receive the information sent by the server.
>
> The tutorial provided above shows all this and more.

what i mean by using php is

sending a command to the server say like "getnames" to the server using php and then when the server gets that command it will then get all the names of the players that are online (if any) and then send that information back to the php script which in return will display it on the website
Link to comment
Share on other sites

Well since these packets work as byte arrays, you have to match their format.

I'm no PHP expert but explore the clsBuffer and try [this](http://stackoverflow.com/questions/2473203/how-to-write-byte-by-byte-to-socket-in-php)?

All you really have to send is the data telling the server what packet its receiving so it knows how to handle it.
Link to comment
Share on other sites

well i know there is another 2g engine out there that does i am trying to do on this engine but i dont like the other enigine so i guess i will keep trying and trying until i get it to work i guess or someone else figures it out
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...