Skip to content

Commit

Permalink
feat(core): sendRconCommand support charset
Browse files Browse the repository at this point in the history
  • Loading branch information
dockfries committed May 7, 2024
1 parent a882d09 commit 9623b00
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/controllers/gamemode/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as w from "core/wrapper/native";

import { I18n } from "../i18n";
import { logger } from "../../logger";
import { SendRconCommand } from "core/utils/helperUtils";

export default {
use(plugin: IFilterScript, ...options: Array<any>) {
Expand Down Expand Up @@ -50,7 +51,7 @@ export default {
},
getWorldTime: w.GetWorldTime,
setTeamCount: w.SetTeamCount,
sendRconCommand: w.SendRconCommand,
sendRconCommand: SendRconCommand,
addPlayerClass: w.AddPlayerClass,
addPlayerClassEx: w.AddPlayerClassEx,
createExplosion(
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/utils/helperUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ export const BanEx = (
return samp.callNative("BanEx", "ia", playerId, buf);
};

export const SendRconCommand = (command: string, charset = "utf8"): number => {
const [flag, processCommand] = processMsg(command, charset);
return samp.callNative("SendRconCommand", flag, processCommand);
};

export const CreateDynamic3DTextLabel = (
charset: string,
text: string,
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/wrapper/native/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export const UnBlockIpAddress = (ip_address: string): number => {
return samp.callNative("UnBlockIpAddress", "s", ip_address);
};

export const SendRconCommand = (command: string): number => {
return samp.callNative("SendRconCommand", "s", command);
};

export const gpci = (playerId: number, charset: string): string => {
const [ret] = samp.callNative("gpci", "iAi", playerId, 41);
return I18n.decodeFromBuf(I18n.getValidStr(ret), charset);
Expand Down

0 comments on commit 9623b00

Please sign in to comment.