View Full Version : How to make a server input client variables?
jv_map
11-03-2002, 02:50 PM
Hello everyone at this forum. I'm working on a script that will allow AIs in a multiplayer map. I'm also trying to make them respond to player commands. Therefore I need to input user variables with my script but I don't know how to do that. If anyone knows would he please tell me? Otherwise :( will happen.
See also:
http://www.modtheater.com/forum/showthread.php?s=&threadid=2591
Thanks!
Shockwave
11-05-2002, 10:13 AM
You can declare a variable for the game server if you have access to the console like this:
set my_variable 123
If you have the developer cvar set to 2, you should see a response like this:
Cvar_Set2: my_variable 123
Of course, you'll want to pick a name that isn't already in use or you'll step on something that you shouldn't. You can also display the current and default settings for a declared variable simply by typing its name in the console. If you get a response, it means it's been declared and will look something like this:
"my_variable" is:"123" default:"123"
The default is simply the initial value it was given when it was declared. I use some custom server variables in my server administration tool to perform certain functions and they work great.
I hope this helps.
jv_map
11-05-2002, 11:20 AM
Thanks for helping me, but it doesn't help. I want to make the server look for a variable set on the client. Your idea will only work to set a variable on the server, but clients are not allowed to set a server side var.
Thanks anyway.
DogMeat
11-05-2002, 03:05 PM
If your running your pk3 on the server then you can use "stuffcmd" to have it set serverside cvars, however this currently only works on Linux, not Win32. (EA is aware of the problem and supposedly fixed it in Spearhead)
stuffcmd "sets my_cvar mystring"
stuffcmd "sets my_longcvar \"this is a long string\""
Of course to go the other way you use "stufftext" to send the client a command.
Hope this helps in some way, shape or form. ;)
jv_map
11-07-2002, 07:44 AM
No sorry, doesn't help. The command needs to go the other way around, i.e. from client to server. I want clients to be able to send AI commands that can be read by the script that necessarily runs on the server, remember.
Thanks for trying to help anyway.
Really appreciate that.
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.