[Tutorial] The server and the client (basic explaination)
#1

Hello.

I've seen a several questions from people whom are making the server and client. I'll explain that (I guess - I ever was very sure about something, which seemed to be false. This time, I'm (again) very sure that I'm right). Let's get started.

What is the client?
To explain it more easy for some people: That is you. You are the client. The client sends commands to the server.
An example in SAMP: You send the command /help. The client sends the information with (atleast) your ID, and the sent command to the server. The server does stuff with this (see below). Then the server returns it to the client and the client (you) displays the information that the server gave to you.

What is the server?
The server is the "computer". This is the smart one. You can compare this with a calculator:
1- You (the client) send the command '1+1' to the calculator (the server)
2- The calculator (the server) receives this and calculates (proccess) this.
3- The output from the calculator (the server) will be displayed on the screen (sent back to the client)
4- You (the client) can see this and can do stuff with this.
That's actually basically what it is. It's comparable with a calculator. For example, the /help command. You as client send this to the server, the server receives (for example): playerid:0, command:/help. Then the server goes check what he should do (as scripted in the .pwn file, the OnPlayerCommandText (or offcourse a command proccessor)). If you have this:
pawn Code:
if(!strcmp(cmdtext, "/help")) return SendClientMessage(playerid, 0xFFFFFFAA, "Call 666 for help");
the server will send to 'playerid' (0 in this case) the white (0xFFFFFFAA) message "Call 666 for help". The client displays this.

I hope that that was clear. This was only basic stuff, not very professional. But this is what the differences are. The client is the one who gives the commands, the server is the 'smart one' that will listen to the command and does stuff with it (eg. calculating 1+1) and gives that information back to the client.

Kind Regards,
Kevin

Oh by the way,
It's possible that this has been made before. I used the search function and couldn't find a topic with this information, but that doesn't mean it doesn't yet exist
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)