Custom rcon commands?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
SA007
Lance Corporal
Posts: 24
Joined: Thu Sep 03, 2009 10:17 pm

Custom rcon commands?

Post 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.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Re: Custom rcon commands?

Post 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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply