Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Mighty on August 28, 2013, 11:11:58 am

Title: [Unit] OnAdminCommand SC3
Post by: Mighty on August 28, 2013, 11:11:58 am
Introduction
I believe we really need 2-3 things to be added to Script Core 3 before we can start scripting more seriously with it (Player.Admin, OnAdminCommand, OnTCPAdminCommand). I decided to make a unit implementing one of those: OnAdminCommand.

Description
Unit splits OnCommand into ScriptOnPlayerCommand and ScriptOnAdminCommand. It remembers the admins (HWID), so once logged they stay logged.

Notes
Download
Attachment (http://forums.soldat.pl/index.php?action=dlattach;topic=42845.0;attach=30456)

Example
Code: [Select]
uses Admin;

function OnAdmCmd(p: TActivePlayer; cmd: string): boolean;
begin
Result := FALSE;
WriteLn('ADMIN CMD');
end;

begin
ScriptOnAdminCommand := @OnAdmCmd;
end.

Epilogue
I wanted to make it array IsAdmin[1..32] of Bool but that requires taking at least one from Game.OnLeave and Game.OnJoin, which I wanted to avoid.
Title: Re: [Unit] OnAdminCommand SC3
Post by: Falcon` on August 28, 2013, 11:53:51 am
OnTCPAdminCommand is planned. IsAdmin as well. The idea is that IsAdmin eliminates the need for OnAdminCommand so it won't be implemented.
Title: Re: [Unit] OnAdminCommand SC3
Post by: Mighty on August 28, 2013, 12:01:20 pm
Yeah, I know, I'm just being a little impatient ;)