Author Topic: [Snippit] Multiple Custom Commands in One Command  (Read 1574 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
[Snippit] Multiple Custom Commands in One Command
« on: September 03, 2007, 09:48:16 am »
Script Name: Multiple Custom Commands in One Command
Script Description: This doesn't work with actual server commands, only custom commands, although can be useful if there are a ton of commands a player wants to use in one swoop. Commands are separated by ";". Example: "/woosh;yes!;eat pie now" will do 3 separate commands, "/woosh", "/yes!" and "/eat pie now" within the CText variable. Please note that the commands are executed in order from left to right. DO NOT DO: "/woosh; yes!; eat pie now", which will make the script not work.. Maybe in a future version I will implement that, but for now, make sure there is no space after the ";" and there is no "/" too.
Original Author: Curt
Core Version: 2.6.2
Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
  CText: string;
  CText := GetPiece(Text,';',0);

//Custom commands go here! use CText instead of Text though
//Script does not work with "normal" commands, only custom commands using CText variable

if ContainsString(Text,';') then OnPlayerCommand(ID,'/' + Copy(Text,Length(CText) + 2,Length(Text)));

Offline Master Chief43

  • Soldier
  • **
  • Posts: 223
  • When life gives you lemons, eat them :D
Re: [Snippit] Multiple Custom Commands in One Command
« Reply #1 on: September 03, 2007, 04:32:36 pm »
thats pretty nice... i see your stil having fun with the scripts =D i still want you to teach me more... XD
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]