Author Topic: Small Bit of Help Needed Please!  (Read 933 times)

0 Members and 1 Guest are viewing this topic.

Offline Uncle_FuXX0r

  • Major(1)
  • Posts: 16
Small Bit of Help Needed Please!
« on: April 05, 2010, 05:11:35 pm »
Okay, so I was helping a Soldat friend write a script. He admins several servers for the !EliteCTF community and I admin a couple. This script is supposed to use a '/tempmute' command that is only on !Elite servers (as far as I know). You have the server scripts in "Soldat Server\scripts\". The script that contains the /tempmute is in "Soldat Server\scripts\XtraCommands\XtraCommands.pas". This script we wrote needs to use /tempmute depending on whether or not a player uses certain words when chatting in-game using "OnPlayerSpeak". However, if I use "Command('/tempmute time ID');" it simply does not do anything. I tried putting our script file in "scripts\XtraCommands" but everytime a player says something it simply says "XtraCommands -> OnPlayerSpeak: Out Of Range" (or something to that effect). How can I fix this?

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Small Bit of Help Needed Please!
« Reply #1 on: April 05, 2010, 05:28:42 pm »
Post the whole source of your script please.
The truth is out there? Does anyone know the URL?
The URL is here

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Small Bit of Help Needed Please!
« Reply #2 on: April 05, 2010, 06:38:52 pm »
I am assuming time and ID are variables with the numbers you need.

At the moment, the command is not recognosing the variables, as the quotes around them tell the compiler to treat it as a string. If you want it to use the variables, you need to split your string up, like so:
Code: (pascal) [Select]
Command('/tempmute ' +inttostr(time) +' ' +inttostr(ID));
The + when used with strings allows you to join them together, and inttostr() treats the intigers as strings, so they can be used with the +. Also, if you are wondering what the +' ' is for, it puts a space between the time and ID, otherwise the command /tempmute 12 2 would come out as /tempmute 122, which wouldn't work.
« Last Edit: April 05, 2010, 11:43:15 pm by chutem »
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Small Bit of Help Needed Please!
« Reply #3 on: April 06, 2010, 02:44:13 am »
Command() only works for default commands, but you can trigger OnCommand event in other script which will work just as good:
Code: [Select]
CrossFunc([255,'/tempmute ' +inttostr(time) +' ' +inttostr(ID)],'XtraCommands.OnCommand');