Author Topic: Retrieving Server-Sided Information  (Read 1271 times)

I am trying to retrieve a text file from the server via a client mod. Does anyone know how to do this?

the server can send data by doing commandtoclient(%client, 'Mycommand', %data);

This will trigger the corresponding clientcmdMycommand(%data) on that client

It's like servercmd except the other way around


You need a server mod too.
yes, that's essentially what nexus said

yes, that's essentially what nexus said
What

commandtoClient and commandtoserver are default functions

commandtoClient and commandtoserver are default functions
No stuff, lol.

Nexus said:
Code: [Select]
//server code
commandtoclient(%client, 'acommand', %data);

//client code
clientcmdACommand(%data)
{
//stuff
}

What

commandtoClient and commandtoserver are default functions
reread, then kick yourself a few times

Oh. derp..

Here I go not thinking about what I'm reading again.

So, how do I call a server function via the client?

commandToServer('name', %data);


commandToServer('name', %data, %moredata);
Is this how you handle multiple args?


Note that the arguments each have a maximum length of 255 characters.

'Lil exemple of what i learnt by asking the same question 1 month ago:

Server Sided:
server.cs

function serverCmdGetfruits(%client)
Code: [Select]
{
    commandToClient(%client, 'ReceiveData', %client.apple, %client.kiwi);
}

Client Sided:
client.cs

Code: [Select]
function clientCmdReceiveData(%apple, %kiwi)
{
echo("You have "@%apple@" apples and "@%kiwi@" kiwis! ");
}

I know you already have been answered but I just want to make sure :P

Now, how would I create a file?

i.e. config/server/test/whatever.txt ?