Author Topic: PublicTools  (Read 2920 times)

0 Members and 1 Guest are viewing this topic.

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
PublicTools
« on: March 19, 2013, 12:34:55 pm »
Script Name: Publictools
Script Description: basic script to the public servers
Author: skrX
Core Version: 2.7.5

Basic commands:

!1 !2 !5
!rate ID
!track ID
!ping ID
!nextmap !vote

lack balance
« Last Edit: March 27, 2014, 10:24:23 am by skrX »

Offline rOy

  • Soldier
  • **
  • Posts: 120
Re: PublicTools
« Reply #1 on: March 19, 2013, 12:52:23 pm »
Hello
Good Job :)
But I've next idea:

Code: [Select]
procedure OnPlayerSpeak(Id: byte; Text: string);
var
i: byte;
begin

if (Text='!1') or (Text='!red') then begin
Command('/setteam1 '+inttostr(ID));
end;

if (Text='!2') or (Text='!blue') then begin
Command('/setteam2 '+inttostr(ID));
end;

if (Text='!5') or (Text='!spec') then begin
Command('/setteam5 '+inttostr(ID));
end;

if (Text = '!nextmap') then
begin
WriteConsole(ID,'Next map will be: '+NextMap,Color);
WriteConsole(ID,'Use (!m or !v) to vote.', Color);
end;

if (Text='!map') then begin
WriteConsole(ID,'Current map is: '+CurrentMap, Color);
end;

if (Text='!time') then begin
WriteConsole(ID,'Current server time is: '+FormatDate('hh:nn:ss')+' (GTM+1)'+' Date is: 'FormatDate(dd-mm-yyyy), Color);
end;

Also, I would use:
Code: [Select]
if MaskCheck(lowercase(Text),'!<result>') then begin
end;

Add too: function OnPlayerCommand
Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
     if LowerCase(Text) = '/red' then Command('/setteam1 ' + IntToStr(ID));
     if LowerCase(Text) = '/blue' then Command('/setteam2 ' + IntToStr(ID));
     if LowerCase(Text) = '/spec' then Command('/setteam5 ' + IntToStr(ID));
     end;
end;
« Last Edit: March 19, 2013, 01:09:41 pm by rOy »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: PublicTools
« Reply #2 on: March 19, 2013, 01:39:58 pm »
you can use switch block instead of those ifs.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: PublicTools
« Reply #3 on: March 19, 2013, 01:43:25 pm »
@rOy:

Not necessarily.
Probably no one would use the function OnPlayerCommand to move to the specified team.

but thx for help :)

(FIX) Error:
Code: [Select]
if (Text='!time') then begin
   WriteConsole(ID,'Current server time is: '+FormatDate('hh:nn:ss')+' (GTM+1)'+' Date is: 'FormatDate(dd-mm-yyyy), Color);
end;
« Last Edit: March 19, 2013, 01:55:02 pm by skrX »

Offline rOy

  • Soldier
  • **
  • Posts: 120
Re: PublicTools
« Reply #4 on: March 19, 2013, 01:53:38 pm »
Code: [Select]
const
color = $FFFF00;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin

if (Text='!time') then begin
   WriteConsole(ID,'Current server time is: '+FormatDate('hh:nn:ss')+' (GTM+1)'+' Date is: '+FormatDate('dd-mm-yyyy'), Color);
   end;
end;

This is a possible (tested)

Offline rOy

  • Soldier
  • **
  • Posts: 120
Re: PublicTools
« Reply #5 on: March 25, 2013, 10:37:42 am »
Quote
Script Name: PublicTools
Script version: 1.0.0
Release Date: 19th of March 2013
Core Version: v2.6.0

I don't know the version 2.6.0
I tested only for 2.7.3 (server version) / Soldat version 1.6.3
« Last Edit: March 25, 2013, 10:44:43 am by rOy »

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: PublicTools
« Reply #6 on: March 25, 2013, 02:47:46 pm »
up
« Last Edit: October 19, 2013, 04:34:43 am by skrX »

Offline rOy

  • Soldier
  • **
  • Posts: 120
Re: PublicTools
« Reply #7 on: March 26, 2013, 03:26:36 pm »
Next idea ;D
Deleted: Max_Players = 32;

Code: [Select]
const
Color = $4efffc;
White = $ffffff;
Red = $FFFF4444;

VotePerc = 65;
VoteTime = 30;
AddTime = 8;

var
Voted: array [1..32] of boolean;
kills: array [1..32] of byte;
« Last Edit: March 26, 2013, 03:29:03 pm by rOy »

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: PublicTools
« Reply #8 on: March 27, 2013, 01:40:15 pm »
up
« Last Edit: October 19, 2013, 04:34:36 am by skrX »