Easy networking question
by Ted Lilljegren · in Technical Issues · 02/26/2008 (3:22 pm) · 11 replies
My question is as follows: can a client send an clientCommand to another client? My guess would be no
About the author
#2
Edit: why is that? Would users abuse this freedom, to mess with other users?
02/26/2008 (11:33 pm)
Ok nice thanksEdit: why is that? Would users abuse this freedom, to mess with other users?
#3
There is a way to send a command from one client to another, but it has to be funneled through the server so as to prevent cheating of that nature. If you have a gameplay element that requires something like this you can have client1 do a commandToServer, which would in turn call a commandToClient on client2.
02/27/2008 (6:10 am)
Of course they would, well, the ones that ruin things for everyone else would at least.There is a way to send a command from one client to another, but it has to be funneled through the server so as to prevent cheating of that nature. If you have a gameplay element that requires something like this you can have client1 do a commandToServer, which would in turn call a commandToClient on client2.
#4
Is it really that surprising? It's like godmode, wall hacks, aimbots, ect...
I still remember when they implemented file checking in tribes 1 to prevent people from replacing models on their clients, they'd replace the flag with one 40' tall, so it'd stick out like a beacon no matter where you hid. Suddenly a whole clan I played against regularly became completely unable to find someone hiding with the flag.
02/27/2008 (11:38 am)
Yeah, given the option to ruin other people's games, a sadly large group of people would do whatever they could. Do some research into Halo hacks and xbox live account hacks, people have had their accounts taken over and disabled merely for doing better than their opponents.Is it really that surprising? It's like godmode, wall hacks, aimbots, ect...
I still remember when they implemented file checking in tribes 1 to prevent people from replacing models on their clients, they'd replace the flag with one 40' tall, so it'd stick out like a beacon no matter where you hid. Suddenly a whole clan I played against regularly became completely unable to find someone hiding with the flag.
#5
02/27/2008 (12:11 pm)
Yeah i figured it had to be made with a call to the server as a intermediate step. I just wanted to make sure i was unable to do this, which i can do in the standalone mode(which is really annoying)
#6
//Somewhere in server script
%clientHandle = %handle;
%arg1 = 1;
%arg2 = 2;
commandToserver(%clientHandle, 'serverFunctionCalledFromServer', %arg1, %arg2);
or would the following be more correct:
%clientHandle = %handle;
%arg1 = 1;
%arg2 = 2;
commandToserver('serverFunctionCalledFromServer', %clientHandle, %arg1, %arg2);
?
02/28/2008 (3:40 pm)
Instead of making a new thread i thought i just make another question here: can i call a commandToServer() function FROM the server? And iF so, should i provide an extra argument, ahead of the server functions name that provides the client handle? Eg://Somewhere in server script
%clientHandle = %handle;
%arg1 = 1;
%arg2 = 2;
commandToserver(%clientHandle, 'serverFunctionCalledFromServer', %arg1, %arg2);
or would the following be more correct:
%clientHandle = %handle;
%arg1 = 1;
%arg2 = 2;
commandToserver('serverFunctionCalledFromServer', %clientHandle, %arg1, %arg2);
?
#7
02/29/2008 (7:42 am)
Why would you need to use the commandToserver() function? If you're on the server I would think you could just call the function directly..
#8
03/01/2008 (3:48 pm)
Yes but the function has to be able to be called from the client also. The function is therefore declared CommandToserver function. Can i still call it directly from the server with a normal function call, ot do i have to use the commandToserver() (console?) function?
#9
If you have a function like this
On the client call it like this:
On the server call it like this:
Hope that helps,
Nathan
03/01/2008 (4:47 pm)
Oh sure, you can do that.If you have a function like this
function serverCmdSuicide(%client)
{
if (isObject(%client.player))
%client.player.kill("Suicide");
}On the client call it like this:
commandToServer('suicide');On the server call it like this:
serverCmdSuicide(%client);
Hope that helps,
Nathan
#10
03/02/2008 (6:09 am)
Yes it does, and i then guess that extra parameters beside the compulsory %client parameter could just be added after?
#11
Nathan
03/02/2008 (7:15 am)
Yes, as long as the function's definition has more parameters. In the commandToServer and serverCmdSuicide examples above you would just add a comma and then put in your new parameter.Nathan
Torque 3D Owner Andrew Wiblemo