0 Members and 2 Guests are viewing this topic.
function OnCommand(ID: Byte; Text: string): boolean;
varsmth:integer;smth2:integer;(...)function OnCommand(ID: Byte; Text: string): boolean;begin case LowerCase(GetPiece(Text,' ',0)) of '/change': case LowerCase(GetPiece(Text,' ',1)) of 'smth': smth:=strtoint(GetPiece(Text,' ',2)); 'smth2': smth2:=strtoint(GetPiece(Text,' ',2)); end; end; Result := false;end;(...)
if RegExpMatch('^/ktkchange \d+$', Text) then begin ilosc:=StrToInt(GetPiece(Text, ' ', 1)); end;
guys, u all fail...There's no function which could get the pointer to the whichever variable from string, there isnt anything like "changevariable(variable:string,newvalue:sometype)"...If you have only some variable to change and u know which are they u can do it like that:Code: [Select]varsmth:integer;smth2:integer;(...)function OnCommand(ID: Byte; Text: string): boolean;begin case LowerCase(GetPiece(Text,' ',0)) of '/change': case LowerCase(GetPiece(Text,' ',1)) of 'smth': smth:=strtoint(GetPiece(Text,' ',2)); 'smth2': smth2:=strtoint(GetPiece(Text,' ',2)); end; end; Result := false;end;(...)I didnt compile that code, just get the spirit
You could try a custom admin command on procedureCode: [Select]function OnCommand(ID: Byte; Text: string): boolean;