Author Topic: How edit Bomber mod?  (Read 775 times)

0 Members and 1 Guest are viewing this topic.

Offline L4D

  • Major(1)
  • Posts: 8
How edit Bomber mod?
« on: December 29, 2009, 05:23:30 am »
How edit that mod to only admin can use bomb (for other player ) and only admin can defusing.

Code: [Select]
// Vyka's Bombing Time Script
// ver. 1.4.0
//
//      /bomb - putting bomb on yourself
//      /bomb (ID)   - putting bomb on somebody    (admin command)
//      /bombing    -  activate or deactivate script (player command)
//      /defuse   -   defusing bomb
//      /bombinfo  -  ON / OFF information on join
//
//          Change log:
//          ----- v.1.2.0:
//        added timer
//        !bomb changed to /bomb
//        -----v.1.3.0
//        added  "/defuse" command
//        added   configuration
//        -----v.1.4.0
//        fixed admin command
//        added   informations on joining game
//        added   /bomber  command



// configuration
const
colormessages=$ff000; // msg colors
colortimer=$baff00; // color timer
colorboom=$ff0000; // color of BOOM msg
timer=40; // time between two explo
timerboom=11; // time to explo after activate bomb

var
time1, time2, time3: byte;
bomber: byte;
bomberbool, status, welcome: boolean;

procedure ActivateServer();
begin
time1:=0;
status:=false;
time3:=timer;
writeln('Bombing Time Deactivated');
welcome:=false;
end;

procedure OnJoinGame(ID, Team: byte);
begin
if ((welcome=true) and (status=true)) then
begin
DrawText(ID,'Bombing Time Activated!'+chr(13)+chr(10)+
' informations - /bomber',
600,RGB(255,157,0),0.12,85,350);
end;
end;

function OnCommand(ID: Byte; Text: string): boolean;
begin
if (Text = '/bombing') then
begin
if status=false then
begin
status:=true;
Writeconsole(0,'Bombing Time Activated', colormessages);
writeln('Bombing time Activated');
end
else
begin
status:=false;
Writeconsole(0,'Bombing Time Deactivated', colormessages);
writeln('Bombing Time Deactivated');
end;
end;
if RegExpMatch('^/bomb \d+$', Text) then
begin
if ((status=true) and (bomberbool=false)) then
begin
bomber:=StrToInt(GetPiece(Text, ' ', 1));
Writeconsole(0,'Admin put bomb on '+IDToName(bomber)+'. To defuse write "/defuse"', $fff000);
Writeln('Admin put bomb on '+IDToName(bomber));
time3:=0;
time2:=timerboom;
bomberbool:=true;
end;
end;
if (Text = '/bomber') then
begin
WriteConsole(ID, 'Bombing Time Script made by Vyka', colormessages);
WriteConsole(ID, '/bomb (ID) puts bomb on player', colormessages);
WriteConsole(ID, '/bombing - ON / OFF script', colormessages);
WriteConsole(ID, '/bombinfo - ON / OFF welcome message', colormessages);
WriteConsole(ID, '/bomber - info about script', colormessages);
end;
if (Text = '/bombinfo') then
begin
if welcome=false then
begin
welcome:=true;
Writeconsole(ID,'Bombing Time INFO Activated', colormessages);
writeln('Bombing Time info Activated');
end
else
begin
welcome:=false;
Writeconsole(0,'Bombing Time INFO Deactivated', colormessages);
writeln('Bombing Time info Deactivated');
end;
end;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
if (Text = '/bomb') then
begin
if status=true then
begin
if time3=0 then
begin
if GetPlayerStat(ID,'Health') > 0 then
begin
if ((bomberbool=false) and (time2=0)) then
begin
WriteConsole(ID, 'Bomb Activated! Prepare to DIE!', colormessages);
bomber:=ID;
bomberbool:=true;
time2:=timerboom;
Writeln(+idtoname(bomber)+' activated bomb');
end
else
begin
WriteConsole(ID, 'Wait until he dies!', colormessages);
end;
end
else
begin
WriteConsole(ID, 'To Activate bomb you must be ALIVE!', colormessages);
end;
end
else
begin
WriteConsole(ID, 'To activate, wait '+inttostr(time3)+'seconds.', colormessages);
end;
end;
end;
if ((Text = '/defuse') and (bomberbool=true)) then
begin
writeln(IDToName(bomber)+' defused bomb');
bomberbool:=false;
end;
if (Text = '/bomber') then
begin
WriteConsole(ID, 'Bombing Time Script made by Vyka', colormessages);
WriteConsole(ID, '/bomb - puts bomb on yourself', colormessages);
WriteConsole(ID, '/defuse - defuses bomb', colormessages);
WriteConsole(ID, '/bomber - info about script', colormessages);
end;
end;

procedure Wave(X,Y,Direction,Offset,Radius,Speed,Power,RoomPerBullet,Radiation: single; Bullettype,Bulletcount,Owner: byte);
var i: integer;
    angle,centerX,centerY: single;
begin
  centerX:=X-cos(Direction)*Radius;
  centerY:=Y-sin(Direction)*Radius;
  angle := (Bulletcount * RoomPerBullet) / (2 * pi * Radius);
  for i:=-Bulletcount div 2 to Bulletcount div 2 + Bulletcount mod 2 do
    CreateBullet(centerX+cos(Direction+angle*i)*Radius+cos(Direction)*Offset,centerY+sin(Direction+angle*i)*Radius+sin(Direction)*Offset, cos(Direction+angle*i*Radiation)*Speed, sin(Direction+angle*i*Radiation)*speed,power,Bullettype,Owner);
end;

procedure AppOnIdle(Ticks: integer);
begin
Ticks:=60;
if status=true then
begin
if time3>=1 then
begin
time3:=time3-1;
end
else
begin
time3:=0;
end;
begin
if time2>time1 then
begin
if time3=0 then
begin
time2:=time2-1;
if time2>0 then
begin
if ((GetPlayerStat(bomber,'Health') > 0) and (bomberbool=true)) then
begin
WriteConsole(0, +IDToName(bomber)+' is going to explode in '+inttostr(time2)+'sec.', colortimer);
end
else
begin
WriteConsole(0, +IDToName(bomber)+' died or defused bomb!', colormessages);
time2:=0;
time3:=timer;
bomberbool:=false;
end;
end;
end;
end;
if ((time2=0) and (bomberbool=true)) then
begin
WriteConsole(0, ' ---> Kamikadze! <---', colorboom);
CreateBullet(GetPlayerStat(bomber,'x'), GetPlayerStat(bomber,'y') - 1, 0, 0,300, 2, 3);
CreateBullet(GetPlayerStat(bomber,'x'), GetPlayerStat(bomber,'y') - 0, -1, 0,400, 2, 3);
bomberbool:=false;
DoDamage(bomber, 4000);
Wave(GetPlayerStat(bomber,'X'),GetPlayerStat(bomber,'Y'),-2.9,15,10,15,2000,4,1,13,4,bomber);

Can u help me? Wave(GetPlayerStat(bomber,'X'),GetPlayerStat(bomber,'Y'),-0.3,15,10,15,2000,4,1,13,4,bomber);
time3:=timer;
end;
end;
end;
end;

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: How edit Bomber mod?
« Reply #1 on: December 29, 2009, 02:53:14 pm »
Change function OnPlayerCommand(ID: Byte; Text: string): boolean; to function OnCommand(ID: Byte; Text: string): boolean;.