Author Topic: [v1.3]Experimental Script  (Read 7863 times)

0 Members and 1 Guest are viewing this topic.

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
[v1.3]Experimental Script
« on: July 23, 2007, 09:56:25 am »
Script Name: Experimental Script
Script Description: It's for entertainment and experimental purposes. Open to be modified and used by others. Please post new ideas and inform me about any bugs and flaws. If used please give credit to me and all users who updates this script. (Uses Health Regeneration Script by Avkon)
Original Authors: Malcolm "Master Chief43" Diggins and "Avkon"
Core Version: 2.6.1
Code:
---------------------------------------------------------------------------------------------------------------                                                                       Core.pas
---------------------------------------------------------------------------------------------------------------
Code: [Select]
{$VERSION 2.6.0}
const
  MAX_HEALTH = 65; // Set to 150 for non-realistic mode, else set to 65.
  DROP_VALUE = 1;   // Value of each 'drop' of health, def: 5.
const
//Teams
  ALPHA = 1;
  BRAVO = 2;
  CHARLIE = 3;
  DELTA = 4;
  SPECTATOR = 5;
//Game Modes
  DEATHMATCH = 0;
  POINTMATCH = 1;
  TEAMMATCH = 2;
  CTF = 3;
  RAMBO = 4;
  INF = 5;
  HTF = 6;
//Weapons
  DEAGLES = 1;
  HKMP5 = 2;
  AK74 = 3;
  STEYR = 4;
  SPAS = 5;
  RUGER = 6;
  M79 = 7;
  BARRET = 8;
  MINIMI = 9;
  MINIGUN = 10;
  FLAMER = 11;
  BOW = 12;
  FLAMEBOW = 13;
  SOCOM = 0;
  KNIFE = 14;
  CHAINSAW = 15;
  LAW = 16;
var
  Disabled: tstringarray;

procedure ActivateServer();
begin
end;

procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
  if Ticks mod (9999 * 1) = 0 then begin
  for  i := 1 to 32 do
    if (GetPlayerStat(i,'Health') < (MAX_HEALTH - (DROP_VALUE - 1))) then begin
      DoDamage(i,-DROP_VALUE);
    end else begin
      DoDamage(i,-(MAX_HEALTH - (GetPlayerStat(i,'Health'))));
    end;
  end;
end;

function OnCommand(ID: Byte; Text: string): boolean;
var
  i,Line: integer;
begin
  Result := false;
  if (GetPiece(Text,' ',0) = '/disable') and (Text <> '/disable disable') and (Text <> '/disable enable') then begin
    SetArrayLength(Disabled,GetArrayLength(Disabled) + 1);
    Disabled[GetArrayLength(Disabled) - 1] := Copy(Text,10,Length(Text));
  end else if GetPiece(Text,' ',0) = '/enable' then begin
    Line := -1;
    for i := 0 to GetArrayLength(Disabled) - 1 do if Copy(Text,9,Length(Text)) = Disabled[i] then begin
      Line := i;
      Break;
    end;
    if Line <> -1 then begin
      for i := Line to GetArrayLength(Disabled) - 2 do Disabled[i] := Disabled[i + 1];
      SetArrayLength(Disabled,GetArrayLength(Disabled) - 1);
    end;
  end;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
var
  Allow: boolean;
  i: integer;
begin
  Case Text of
    '/deagles': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),1);
    '/hkmp5': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),2);
    '/ak74': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),3);
    '/steyr': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),4);
    '/spaz': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),5);
    '/ruger': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),6);
    '/m79': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),7);
    '/barret': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),8);
    '/minimi': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),9);
    '/minigun': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),10);
    '/socom': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),11);
    '/knife': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),12);
    '/saw': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),13);
    '/law': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),14);
    '/stat': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),15);
    '/medic': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),16);
    '/nade': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),17);
    '/flame': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),18);
    '/armor': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),19);
    '/pred': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),20);
    '/berserk': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),21);
    '/cluster': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),22);
    '/commands': begin
      WriteConsole(ID,'Commands: /deagles /hkmp5 /ak74 /steyr /spaz /ruger /m79 /barret /minimi /minigun',$EE81FAA1);
      WriteConsole(ID,'/socom /knife /saw /law /stat',$EE81FAA1);
      WriteConsole(ID,'/medic /nade /flame /armor /pred /berserk /cluster',$EE81FAA1);
    end;
    '/test': DrawText(0,'Test!',330,RGB(255,255,255),0.20,40,240);
  end;
  Allow := true;
  for i := 0 to GetArrayLength(Disabled) - 1 do if Copy(Text,2,Length(Disabled[i])) = Disabled[i] then begin
    Allow := false;
    Break;
  end;
  if Allow then Result := false else Result := true;
end;

procedure OnException(ErrorMessage: string);
begin
//  WriteFile('ErrorLog.txt', ErrorMessage);
end;
---------------------------------------------------------------------------------------------------------------                                                                    Network.pas
---------------------------------------------------------------------------------------------------------------
Code: [Select]
function OnRequestGame(IP: string; State: integer): integer;
begin
  Result := State;
end;

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
end;

procedure OnJoinGame(ID, Team: byte);
begin
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  SayToPlayer(ID, 'This server runs the following Scripts:');
  SayToPlayer(ID, 'Health Regeneration Script v1.2 (by Avkon)');
  SayToPlayer(ID, 'Experimental Script v1.3 (by Master Chief43)');
  SayToPlayer(ID, '*URGENT* Press /commands to see list of commands *URGENT*');
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
end;

procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);
begin
  DrawText(ID,'Run!',330,RGB(255,255,255),0,40,240);
end;

procedure OnFlagReturn(ID, TeamFlag: byte);
begin
  DrawText(ID,'Good Job!',330,RGB(255,255,255),0,40,240);
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
  DrawText(ID,'w00t!',330,RGB(255,255,255),0,40,240);
end;

procedure OnMapChange(NewMap: string);
begin
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
end;

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  // Victim = Player Damaged // Shooter = Player doing the damage
  result := Damage;
end;

procedure OnPlayerRespawn(ID: byte);
begin
  SayToPlayer(ID, '.:|RESPAWNED|:.');
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
begin
end;
Update#1 on July 23, 2007, 01:06:39 PM by DorkeyDear Neater commands
Update#2 on July 23, 2007, 04:36:10 PM by DorkeyDear Add /disable and /enable
« Last Edit: July 24, 2007, 12:56:51 am by Master Chief43 »
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: [v1.1]Experimental Script
« Reply #1 on: July 23, 2007, 11:31:38 am »
wouldn't using
Code: [Select]
Case Text of
  '/deagles': SpawnObject(...
  '/hkmp5': SpawnObject(...
  ....
end;
be a little more.. clean?

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.1]Experimental Script
« Reply #2 on: July 23, 2007, 11:53:37 am »
Hm... Okay! Just PM me with renewed script and I'll update post or I can do it manually... I never knew that. I learning something new everyday.  ;)
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: [v1.1]Experimental Script
« Reply #3 on: July 23, 2007, 12:02:50 pm »
i dont feel like opening up the pm thing so..
Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
  Case Text of
    '/deagles': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),1);
    '/hkmp5': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),2);
    '/ak74': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),3);
    '/steyr': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),4);
    '/spaz': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),5);
    '/ruger': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),6);
    '/m79': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),7);
    '/barret': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),8);
    '/minimi': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),9);
    '/minigun': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),10);
    '/socom': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),11);
    '/knife': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),12);
    '/saw': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),13);
    '/law': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),14);
    '/stat': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),15);
    '/medic': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),16);
    '/nade': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),17);
    '/flame': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),18);
    '/armor': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),19);
    '/pred': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),20);
    '/berserk': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),21);
    '/cluster': SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),22);
    '/commands': begin
      WriteConsole(ID,'Commands: /deagles /hkmp5 /ak74 /steyr /spaz /ruger /m79 /barret /minimi /minigun',$EE81FAA1);
      WriteConsole(ID,'/socom /knife /saw /law /stat',$EE81FAA1);
      WriteConsole(ID,'/medic /nade /flame /armor /pred /berserk /cluster',$EE81FAA1);
    end;
    '/test': DrawText(0,'Test!',330,RGB(255,255,255),0.20,40,240);
  end;
  Result := false;
end;
that looks right.

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.1]Experimental Script
« Reply #4 on: July 23, 2007, 12:05:16 pm »
Kool! Thanks! Ill update now!
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: [v1.2]Experimental Script
« Reply #5 on: July 23, 2007, 12:35:19 pm »
Might I recommend:

Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
var Ltext: string:
begin
  Ltext := LowerCase(Text);
  Case Ltext of
...

this makes commands not case sensitive.
Can't think of anything original to put here...

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.2]Experimental Script
« Reply #6 on: July 23, 2007, 12:49:36 pm »
hm... Seems good but aren't they already case sensitive?

[EDIT]
Avarax just informed that I should input that. How do I input it anyway? Send me PM of the new script and I'll update post and give credits. :D
« Last Edit: July 23, 2007, 01:30:32 pm by Master Chief43 »
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: [v1.2]Experimental Script
« Reply #7 on: July 23, 2007, 02:08:24 pm »
heres the thing u wanted..
Code: [Select]
var
  Disabled: tstringarray;

function OnCommand(ID: Byte; Text: string): boolean;
var
  i,Line: integer;
begin
  Result := false;
  if (GetPiece(Text,' ',0) = '/disable') and (Text <> '/disable disable') and (Text <> '/disable enable') then begin
    SetArrayLength(Disabled,GetArrayLength(Disabled) + 1);
    Disabled[GetArrayLength(Disabled) - 1] := Copy(Text,10,Length(Text));
  end else if GetPiece(Text,' ',0) = '/enable' then begin
    Line := -1;
    for i := 0 to GetArrayLength(Disabled) - 1 do if Copy(Text,9,Length(Text)) = Disabled[i] then begin
      Line := i;
      Break;
    end;
    if Line <> -1 then begin
      for i := Line to GetArrayLength(Disabled) - 2 do Disabled[i] := Disabled[i + 1];
      SetArrayLength(Disabled,GetArrayLength(Disabled) - 1);
    end;
  end;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
var
  Allow: boolean;
  i: integer;
begin
  Allow := true;
  for i := 0 to GetArrayLength(Disabled) - 1 do if Copy(Text,2,Length(Disabled[i])) = Disabled[i] then begin
    Allow := false;
    Break;
  end;
  if Allow then Result := false else Result := true;
end;

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.2]Experimental Script
« Reply #8 on: July 23, 2007, 02:56:43 pm »
I'll be sure to update this in!
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: [v1.2]Experimental Script
« Reply #9 on: July 23, 2007, 03:06:46 pm »
i thought u said it would be v1.3, lol.. doesnt matter

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.3]Experimental Script
« Reply #10 on: July 23, 2007, 03:38:52 pm »
It's v1.3 now... Have Fun!
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline Mikeman

  • Soldier
  • **
  • Posts: 150
    • Nuke Corruption
Re: [v1.3]Experimental Script
« Reply #11 on: July 23, 2007, 03:47:41 pm »
That timer feature would be handy ;)

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.3]Experimental Script
« Reply #12 on: July 23, 2007, 04:06:23 pm »
I'll try to add that in or you can make the progress faster by PMing me the new script and I'll update post and give you credits. But right now, it will take awhile for me because I'm still trying to do something.
« Last Edit: July 23, 2007, 04:08:40 pm by Master Chief43 »
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]

Offline Avkon

  • Soldier
  • **
  • Posts: 136
  • Ah, whatever.
Re: [v1.3]Experimental Script
« Reply #13 on: July 24, 2007, 12:35:53 am »
Hmm... if I were spawning objects, I'd spawn them just a little above the player, so that it immediately falls on him... If you spawn one exactly on his coordinates, what does happen? Are you able to see the object at all, or is it acquired by the player instantly? Nice one anyway. :)
« Last Edit: July 24, 2007, 12:43:00 am by Avkon »

Offline Flacid Assassin

  • Camper
  • ***
  • Posts: 450
  • Gorby The Grunt
Re: [v1.3]Experimental Script
« Reply #14 on: July 24, 2007, 12:38:38 am »
well when i tested the  server the problem was u could basicly have everything at one time

such as Clusters, Armour, Medic whenever needed, FlameGod, Beserker, Spawn anyweapon u want


and that stupid message when you die saying Respawning


Offline Avkon

  • Soldier
  • **
  • Posts: 136
  • Ah, whatever.
Re: [v1.3]Experimental Script
« Reply #15 on: July 24, 2007, 12:43:59 am »
You can remove those messages... even I think they seem a bit unnecessary.

Offline Flacid Assassin

  • Camper
  • ***
  • Posts: 450
  • Gorby The Grunt
Re: [v1.3]Experimental Script
« Reply #16 on: July 24, 2007, 12:47:20 am »
yeah for real i dont knwo what the purpose of those were too

and  what about changing the things you can get like maybe earning them like every 10 kills you get an upgrade on what you can add and what not

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: [v1.3]Experimental Script
« Reply #17 on: July 24, 2007, 12:48:28 am »
Its an experemental script, quit shouting nonsence at Master Chief, its yours to edit.

Offline Avkon

  • Soldier
  • **
  • Posts: 136
  • Ah, whatever.
Re: [v1.3]Experimental Script
« Reply #18 on: July 24, 2007, 12:53:10 am »
It is an experimental script, which means it's still in development, and suggesting ideas or giving positive feedback isn't a bad thing, it it? I'm sure the author isn;t complaining.

Offline Master Chief43

  • Soldier
  • **
  • Posts: 224
  • When life gives you lemons, eat them :D
Re: [v1.3]Experimental Script
« Reply #19 on: July 24, 2007, 12:54:12 am »
Yea... It's their to experiment with shing and I figured "what would happen if I did this?" And I figured it out. I edited my server not to do that "-|RESPAWNED|-" message every time your respawn again. I also added "DrawText" to flag return, capture, and flag taken.
In-Game Name: "Master Chief43"
Favorite Map: ctf_Ash
Favorite Mods: Special Operation 2.0, Original Soldier 1.9
Favorite Guns: [MP5][AK74][socom][Barret]