Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: Master Chief43 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
---------------------------------------------------------------------------------------------------------------
{$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
---------------------------------------------------------------------------------------------------------------
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
-
wouldn't using
Case Text of
'/deagles': SpawnObject(...
'/hkmp5': SpawnObject(...
....
end;
be a little more.. clean?
-
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. ;)
-
i dont feel like opening up the pm thing so..
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.
-
Kool! Thanks! Ill update now!
-
Might I recommend:
function OnPlayerCommand(ID: Byte; Text: string): boolean;
var Ltext: string:
begin
Ltext := LowerCase(Text);
Case Ltext of
...
this makes commands not case sensitive.
-
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
-
heres the thing u wanted..
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;
-
I'll be sure to update this in!
-
i thought u said it would be v1.3, lol.. doesnt matter
-
It's v1.3 now... Have Fun!
-
That timer feature would be handy ;)
-
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.
-
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. :)
-
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
-
You can remove those messages... even I think they seem a bit unnecessary.
-
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
-
Its an experemental script, quit shouting nonsence at Master Chief, its yours to edit.
-
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.
-
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.
-
relax u wanted feed back so i gave it to you
-
I didn't get mad at you... Just saying that don't expect everything to be perfect. This is only a open experimental script.
-
nahh i wasnt talking to you i was talking to the other guy
-
oh ok