0 Members and 1 Guest are viewing this topic.
function OnCommand(ID: Byte; Text: string): boolean;beginif LowerCase(GetPiece(Text,' ',0)) = '/spawn' thenSpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),StrToInt(GetPiece(Text,' ',1)));end;
function OnCommand(ID: Byte; Text: string): boolean;Parameter Info:ID (Byte): ID of the player who sent the command. (255 = Server)Text (String): Command which has been sent.Description:This procedure will be called every time an ingame Admin or TCP Admin send a / command.You may add your own commands here.Examples:begin if Text = '/test' then begin WriteLn('Test successful!'); end; Result := false; // Return true if you want to ignore the command typed.end;
Quotefunction OnCommand(ID: Byte; Text: string): boolean;Parameter Info:ID (Byte): ID of the player who sent the command. (255 = Server)Text (String): Command which has been sent.Description:This procedure will be called every time an ingame Admin or TCP Admin send a / command.You may add your own commands here.Examples:begin if Text = '/test' then begin WriteLn('Test successful!'); end; Result := false; // Return true if you want to ignore the command typed.end;RTFM!
Quote from: Zapper on April 07, 2010, 08:39:39 amQuotefunction OnCommand(ID: Byte; Text: string): boolean;Parameter Info:ID (Byte): ID of the player who sent the command. (255 = Server)Text (String): Command which has been sent.Description:This procedure will be called every time an ingame Admin or TCP Admin send a / command.You may add your own commands here.Examples:begin if Text = '/test' then begin WriteLn('Test successful!'); end; Result := false; // Return true if you want to ignore the command typed.end;RTFM!Did you eat drugs?
But what's wrong with his script? As long as it works..
RegExpMatch('^/(steyr|aug)$', lowercase(Text))
WriteConsole(ID,'A command has been entered',$EEFF0000);
Try this, less code but same effect.Code: [Select]function OnCommand(ID: Byte; Text: string): boolean;beginif LowerCase(GetPiece(Text,' ',0)) = '/spawn' thenSpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),StrToInt(GetPiece(Text,' ',1)));end;
regExpMatch('^/(flame god|Flame god|Flame God|Flamegod|FlameGod|flame|Flame|flamegodmode|Flamegodmode|FlameGodMode|flame god mode|Flame god mode|Flame God mode|Flame God Mode|bon3|Bon3|bon 3|Bon 3|bon-3|Bon-3)$',lowercase(Text))