Page 1 of 1

Custom rcon commands?

Posted: Wed Nov 04, 2009 12:06 am
by SA007
I there a way to create real rcon commands?

Setting cvars is nice and all, but only allows for one argument.
Not 0 or > 1.

At the moment i've got a 'command' that needs 2 parameters and i do that by supplying 2 cvars with data, but there a catch, i have to type 2 rcon commands.

At the moment i've got this thread:

Code: Select all

monitorIPrint:
  setcvar "iprint" "-1"
  while(1) {
    local.iprint = int(getcvar "iprint")
    local.iprinttext = (getcvar "iprinttext")
    if (local.iprint != -1) {
      for (local.p=1;local.p<=$player.size;local.p++)
      {
        if ($player[local.p].entnum == local.iprint)
          $player[local.p] iprint local.iprinttext   
      }
      setcvar "iprint" "-1"
    }
    waitframe
    waitframe
    waitframe
    waitframe
    waitframe
  }
end
Which i call right behing waittill spawn.
It works fine, but doing:
rcon iprinttext "Hello there"
rcon iprint 4

Takes up valueble time whilst being shot at :)
I'd like to shorten that to one line ;)

I tried if rcon iprint 4 "Hello there" make some sort of array, but didn't really manage to filter that.

I probably could make something like this work:
rcon iprint "4 Hello there"
And split the first number off the var by looping trough the text as an array, but thats kindof ugly and there is probably a nicer way to deal with that.

Re: Custom rcon commands?

Posted: Wed Nov 04, 2009 11:36 pm
by Rookie One.pl
SA007 wrote:I probably could make something like this work:
rcon iprint "4 Hello there"
And split the first number off the var by looping trough the text as an array, but thats kindof ugly and there is probably a nicer way to deal with that.
Nope, that's probably your best shot. That's what I'd do, anyway.