Author Topic: Hide and Seek Script Modification  (Read 1125 times)

0 Members and 1 Guest are viewing this topic.

Offline Bolt

  • Major
  • *
  • Posts: 64
  • {MLP}
    • http://www.darkdemon.org/bolt/
Hide and Seek Script Modification
« on: September 30, 2008, 08:42:45 pm »
Hey, IQ made the really awesome Hide and Seek script, however I'm looking to spice it up.

What I would like done is the following:
  • When the admin says "/start" it initiates the has weapon mod (/loadwep has)
  • After the map is picked and the players spawn for the first time it will say "If you get stuck in the weapons menu, type "!stuck" and you can return to the weapons menu."
  • Instead of Bravo team having no weapons they can have the USSOCOM which will stay with them for the game unless they drop it.
  • An admin can "/repick" command which will execute the /stop and /start commands automatically when said.
It may not seem like much, but I'm a very basic scripter, all I can really do is change values of numbers, edit the words the server says and remove comments : P





Here's the original code:
Code: [Select]
{
HnS (Hide 'n Seek) script by Iq-Unlimited / A Furreh!
Betatesting by MerZ, Clan Mp5 |, and a bunch of other people.

Commands:
Admin: /start to start game
/stop to stop game
Player: /version to show current script version
!stuck if you are stuck in the wepsmenu
!nospy if you are seeking to stop spectators showing you where other people are
}



//I commented like...none of this. If you want me to PM me and i'll comment it out.
//Also, the code is REALLY MESSY and not always the same style, I'll go back and fix that some day if I'm bored.
//Also Also, report all bugs to me so I can fix them whenever I'm just that bored.

const
Color = $FFFFFF;
ScriptVersion = '1.1.6';
CountTime = 20;
Maxplayer = 14; //whats stupid is i only use this like...twice, dunno why its even in here, guess to save some loop resources.
var
count, pop: byte;
countbool, Game, TMap: boolean;
it: array [1..32] of boolean;
counting, nospy: array [1..32] of boolean;
seeker: array [1..32] of boolean;
Notplaying: array [1..32] of boolean;
Freeze: array [1..32] of boolean;
First: boolean;
Firstt: byte;
X,Y: array [1..32] of single;


procedure StartGame;
var
Ran, Ran2: byte;
i: byte;
begin
for i := 1 to 32 do begin
Command('/setteam2 ' + inttostr(i));
end;
for i := 1 to 255 do begin
Ran := Random(1, Maxplayer);
if GetPlayerStat(Ran, 'Active') then begin
it[Ran] := true;
break;
end;
end;
for i := 1 to 32 do begin
Notplaying[i] := false;
nospy[i] := false;
if it[i] then begin
Command('/setteam1 ' + inttostr(i));
end else if not it[i] then begin
if not Notplaying[i] then begin
Command('/setteam2 ' + inttostr(i));
end;
end;
end;
for i := 1 to 14 do begin
SetWeaponActive(0,i,false);
SetWeaponActive(0,6,true);
end;
WriteConsole(0, IDToName(Ran) + ' is now it! Choosing random map...',Color);
TMap := true;
Game := true;
sleep(2000);
Ran2 := Random(1, 31);
case Ran2 of
1: begin
Command('/map Airpirates');
end;
2: begin
Command('/map Bigfalls');
end;
3: begin
Command('/map Bigfalls');
end;
4: begin
Command('/map inf_Moonshine');
end;
5: begin
Command('/map Bigfalls');
end;
6: begin
Command('/map Blox');
end;
7: begin
Command('/map inf_Moonshine');
end;
8: begin
Command('/map Bunker');
end;
9: begin
Command('/map Cambodia');
end;
10: begin
Command('/map ctf_Ash');
end;
11: begin
Command('/map ctf_B2b');
end;
12: begin
Command('/map ctf_Boit');
end;
13: begin
Command('/map ctf_Equinox');
end;
14: begin
Command('/map ctf_Laos');
end;
15: begin
Command('/map ctf_Maya2');
end;
16: begin
Command('/map ctf_Maya');
end;
17: begin
Command('/map ctf_Run');
end;
18: begin
Command('/map ctf_Voland');
end;
19: begin
Command('/map Flashback');
end;
20: begin
Command('/map Flashback');
end;
21: begin
Command('/map HH');
end;
22: begin
Command('/map inf_Abel');
end;
23: begin
Command('/map inf_Argy');
end;
24: begin
Command('/map inf_Fortress');
end;
25: begin
Command('/map inf_Industrial');
end;
26: begin
Command('/map inf_Messener');
end;
27: begin
Command('/map inf_Moonshine');
end;
28: begin
Command('/map inf_Warehouse');
end;
29: begin
Command('/map Jungle');
end;
30: begin
Command('/map Krab');
end;
31: begin
Command('/map Flashback');
end;
end;
WriteConsole(0, 'Map chosen, good luck have fun.',Color);
end;

procedure StopGame;
var
i: byte;
begin
WriteConsole(0, 'Game Stopped :(',Color);
Game := false;
TMap := false;
First := false;
Firstt := 0;
count := 0;
countbool := false;
for i := 1 to 32 do begin
it[i] := false;
Notplaying[i] := false;
counting[i] := false;
seeker[i] := false;
Freeze[i] := false;
nospy[i] := false;
X[i] := 0;
Y[i] := 0;
end;
for i := 1 to 14 do begin
SetWeaponActive(0,i,true);
end;
end;

procedure ResetGame(ISIT: byte);
var
i, Ran: byte;
begin
it[ISIT] := true;
for i := 1 to 32 do begin
Notplaying[i] := false;
nospy[i] := false;
if it[i] then begin
Command('/setteam1 ' + inttostr(i));
end else if not it[i] then begin
if not Notplaying[i] then begin
Command('/setteam2 ' + inttostr(i));
end;
end;
ForceWeapon(i, 30, 30, 0);
end;
for i := 1 to 14 do begin
SetWeaponActive(0,i,false);
SetWeaponActive(0,6,true);
end;
WriteConsole(0, IDToName(ISIT) + ' is now it! Choosing random map...',Color);
sleep(2000);
TMap := true;
Game := true;
Ran := Random(1, 31);
case Ran of
1: begin
Command('/map Airpirates');
end;
2: begin
Command('/map Bigfalls');
end;
3: begin
Command('/map Bigfalls');
end;
4: begin
Command('/map inf_Moonshine');
end;
5: begin
Command('/map Bigfalls');
end;
6: begin
Command('/map Blox');
end;
7: begin
Command('/map inf_Moonshine');
end;
8: begin
Command('/map Bunker');
end;
9: begin
Command('/map Cambodia');
end;
10: begin
Command('/map ctf_Ash');
end;
11: begin
Command('/map ctf_B2b');
end;
12: begin
Command('/map ctf_B2b');
end;
13: begin
Command('/map ctf_Equinox');
end;
14: begin
Command('/map ctf_Laos');
end;
15: begin
Command('/map ctf_Maya2');
end;
16: begin
Command('/map ctf_Maya');
end;
17: begin
Command('/map ctf_Run');
end;
18: begin
Command('/map ctf_Voland');
end;
19: begin
Command('/map Flashback');
end;
20: begin
Command('/map Flashback');
end;
21: begin
Command('/map HH');
end;
22: begin
Command('/map inf_Abel');
end;
23: begin
Command('/map inf_Argy');
end;
24: begin
Command('/map inf_Fortress');
end;
25: begin
Command('/map inf_Industrial');
end;
26: begin
Command('/map inf_Messener');
end;
27: begin
Command('/map inf_Moonshine');
end;
28: begin
Command('/map inf_Warehouse');
end;
29: begin
Command('/map Jungle');
end;
30: begin
Command('/map Krab');
end;
31: begin
Command('/map Flashback');
end;
end;
WriteConsole(0, 'Map chosen, good luck have fun.',Color);
end;

procedure ActivateServer();
begin
count := 0;
countbool := false;
Game := false;
TMap := false;
end;

procedure AppOnIdle(Ticks: integer);
var
i: byte;
begin
if Game then begin
if count <> 0 then begin
WriteConsole(0, inttostr(count),Color);
count := count - 1;
end;
if countbool then begin
if count = 0 then begin
for i := 1 to 32 do begin
if counting[i] then begin
counting[i] := false;
WriteConsole(0, 'Ready or not, here I come!',Color);
ForceWeapon(i, 7, 7, 0);
seeker[i] := true;
countbool := false;
Freeze[i] := false;
end;
end;
end;
end;
for i := 1 to 32 do begin
if counting[i] then begin
DrawText(i,'||',200,RGB(0,0,0),40,-2500,-500);
end;
end;
for i := 1 to 32 do begin
if nospy[i] then begin
DrawText(i,'||',200,RGB(0,0,0),40,-2500,-500);
end;
end;
for i := 1 to 32 do begin
if Freeze[i] then begin
if GetPlayerStat(i, 'X') <> X[i] then begin
MovePlayer(i, X[i], Y[i]);
end if GetPlayerStat(i, 'Y') <> Y[i] then begin
MovePlayer(i, X[i], Y[i]);
end;
end;
end;
end;
if Game then begin
if pop > 1 then begin
if BravoPlayers = 0 then begin
for i := 1 to 32 do begin
it[i] := false;
seeker[i] := false;
end;
ResetGame(Firstt);
First := false;
Firstt := 0;
end;
end;
end;
if Game then begin
for i := 1 to 32 do begin
if seeker[i] then begin
if GetPlayerStat(i, 'Primary') <> 7 then begin
ForceWeapon(i, 7, 7, 0);
end;
end;
end;
end;
if Game then begin
if pop = 0 then begin
StopGame;
end;
end;
end;

procedure OnMapChange(NewMap: string);
var
i: byte;
begin
if TMap then begin
for i := 1 to 32 do begin
if it[i] then begin
WriteConsole(i, '!start to start counting.',Color);
TMap := false;
end;
end;
end;
end;


procedure OnJoinGame(ID, Team: byte);
begin
Notplaying[ID] := true;
pop := pop + 1;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
if Game then begin
if Notplaying[ID] then begin
if Team <> 5 then begin
Command('/setteam5 ' + inttostr(ID));
end;
end;
end;
if Game then begin
if not it[ID] and not counting[ID] and not seeker[ID] then begin
if not NotPlaying[ID] then begin
if Team <> 2 then begin
Command('/setteam2 ' + inttostr(ID));
end;
end;
end;
end;
if Game then begin
if it[ID] then begin
if Team <> 1 then begin
Command('/setteam1 ' + inttostr(ID));
end;
end;
end;
if Game then begin
if counting[ID] then begin
if Team <> 1 then begin
Command('/setteam1 ' + inttostr(ID));
end;
end;
end;
if Game then begin
if seeker[ID] then begin
if Team <> 1 then begin
Command('/setteam1 ' + inttostr(ID));
ForceWeapon(ID, 7, 7, 0);
end;
end;
end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
pop := pop - 1;
if Game then begin
if pop <> 0 then begin
if it[ID] or counting[ID] or seeker[ID] then begin
WriteConsole(0, 'The seeker has left the game! Lamer! resetting game...',Color);
StartGame;
end;
end;
if (Firstt = ID) then begin
if pop > 1 then begin
WriteConsole(0, 'The person that''s going to be it left! Lamer! Next person to die will be it next round',Color);
First := true;
Firstt := 0;
end else StopGame;
end;
it[ID] := false;
seeker[ID] := false;
NotPlaying[ID] := true;
counting[ID] := false;
Freeze[ID] := false;
end;
end;

function OnCommand(ID: Byte; Text: string): boolean;
var
Text1: string;
begin
if Lowercase(Text) = '/start' then begin
if not Game then begin
StartGame;
end;
end;
if Lowercase(Text) = '/stop' then begin
if Game then begin
StopGame;
end;
end;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
if Game then begin
if LowerCase(Text) = '/version' then begin
WriteConsole(ID, 'Scriptversion: ' +ScriptVersion+ '.',Color);
end;
end;
Result := false;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
var
i: byte;
begin
if Game then begin
if it[ID] then begin
if Lowercase(Text) = '!start' then begin
for i := 1 to 32 do begin
ForceWeapon(i, 255, 255, 0);
if GetPlayerStat(i, 'Active') then begin
NotPlaying[i] := false;
end;
end;
for i := 1 to 14 do begin
SetWeaponActive(0,i,false);
end;
it[ID] := false;
count := CountTime;
counting[ID] := true;
countbool := true;
Game := true;
Freeze[ID] := true;
GetPlayerXY(ID,X[ID],Y[ID]);
end;
end;
if Lowercase(Text) = '!stuck' then begin
SetWeaponActive(ID, 6, true);
end;
if Lowercase(Text) = '!sitout' then begin
NotPlaying[ID] := true;
end;
if seeker[ID] then begin
if LowerCase(Text) = '!stopspy' then begin
for i := 1 to 32 do begin
if GetPlayerStat(i, 'Team') = 5 then begin
nospy[i] := true;
end;
end;
end;
end;
end;
end;

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
if Game then begin
if it[Victim] or counting[Victim] or seeker[Victim] or counting[shooter] then begin
Result := -99999;
end else Result := Damage;
end else Result := Damage;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if Game then begin
if seeker[killer] then begin
if not First then begin
Firstt := Victim;
First := true;
Notplaying[Victim] := true;
WriteConsole(0, IDToName(Victim) + ' was the first and will be it next round!',Color);
Command('/setteam5 ' + inttostr(Victim));
end else begin
Notplaying[Victim] := true;
Command('/setteam5 ' + inttostr(Victim));
WriteConsole(0, IDToName(Victim) + ' was killed!',Color);
end;
end;
if Killer = Victim then begin
if not First then begin
Firstt := Victim;
First := true;
Notplaying[Victim] := true;
WriteConsole(0, IDToName(Victim) + ' was the first and will be it next round!',Color);
Command('/setteam5 ' + inttostr(Victim));
end else begin
Notplaying[Victim] := true;
Command('/setteam5 ' + inttostr(Victim));
WriteConsole(0, IDToName(Victim) + ' was killed!',Color);
end;
end;
end;
end;

procedure OnPlayerRespawn(ID: byte);
begin
if Game then begin
if seeker[ID] then begin
ForceWeapon(ID, 7, 7, 0);
end else begin
ForceWeapon(ID, 30, 30, 0);
end;
end;
end;

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
if Game then begin
if not seeker[ID] then begin
if PrimaryNum = 7 then begin
ForceWeapon(ID, 255, 255, 0);
end;
end;
end;
end;

Offline Norbo

  • Camper
  • ***
  • Posts: 338
Re: Hide and Seek Script Modification
« Reply #1 on: October 01, 2008, 11:53:07 am »
  • When the admin says "/start" it initiates the has weapon mod (/loadwep has)
make the weaponmod and attach it here first

  • After the map is picked and the players spawn for the first time it will say "If you get stuck in the weapons menu, type "!stuck" and you can return to the weapons menu."
you cant let the player just to choose a weapon from the wweapon menu at an time, you have to kill him
however im not sure... correct me if im wrong.. also what u mean by "stuck"?

  • Instead of Bravo team having no weapons they can have the USSOCOM which will stay with them for the game unless they drop it.
and what will be the socom used for?

  • An admin can "/repick" command which will execute the /stop and /start commands automatically when said.
er... point?

please be more specific...
« Last Edit: October 01, 2008, 11:55:19 am by Norbo »

Offline Bolt

  • Major
  • *
  • Posts: 64
  • {MLP}
    • http://www.darkdemon.org/bolt/
Re: Hide and Seek Script Modification
« Reply #2 on: October 01, 2008, 05:08:18 pm »
  • When the admin says "/start" it initiates the has weapon mod (/loadwep has)


make the weaponmod and attach it here first
I can do that. I just didn't think it would be required from a scripter's point of view...
  • After the map is picked and the players spawn for the first time it will say "If you get stuck in the weapons menu, type "!stuck" and you can return to the weapons menu."
you cant let the player just to choose a weapon from the wweapon menu at an time, you have to kill him
however im not sure... correct me if im wrong.. also what u mean by "stuck"?
When the seeker says !start before you pick the ruger it locks up your weapons menu, making you unable to move. Saying !stuck fixes this, however nowhere does it say that you can do this. I think a little server message would be very helpful for these instances.
  • Instead of Bravo team having no weapons they can have the USSOCOM which will stay with them for the game unless they drop it.
and what will be the socom used for?
For a small boost. This is irrelevant to the scripting though, isn't it?

  • An admin can "/repick" command which will execute the /stop and /start commands automatically when said.
er... point?

please be more specific...
So if the person doesn't say !start they can simple be put into the Bravo team and another tagger can continue in another game. Also, if it messes up at the end of the game, I could use that command to do the same thing, basically for the same purpose.

Anyway, here's the weapons mod at the minimalist point, with just the USSOCOM changed. When the script is finished, or when I have time I will make all the other weapons basically useless, as they are unrequired.