Author Topic: 2 last script request !  (Read 3297 times)

0 Members and 1 Guest are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
2 last script request !
« on: May 30, 2010, 10:52:43 am »
1-When a player do damage to another that give to him a random number between (1-10) of life
2-bravo team forceweapon SAW

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: 2 last script request !
« Reply #1 on: May 30, 2010, 12:03:39 pm »
Code: [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  Result:= Damage;
  DoDamage(Shooter,Random(-10,-1));
end;

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if (PrimaryNum <> 16) and (PrimaryNum <> 255) then ForceWeapon(ID,16,255,0);
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #2 on: May 30, 2010, 12:28:49 pm »
 :-\   
Code: [Select]
[Error] (5:35): Invalid number of parameters

DarkCrusade

  • Guest
Re: 2 last script request !
« Reply #3 on: May 30, 2010, 12:30:27 pm »
@mich: Which line is line 5

@gizd:
15 = Chainsaw
16 = LAW

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #4 on: May 30, 2010, 12:33:08 pm »
Code: [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  Result:= Damage;
  DoDamage(Shooter,Random(-10,-1));
end;  //This one ??????????????

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if (PrimaryNum <> 16) and (PrimaryNum <> 255) then ForceWeapon(ID,16,255,0);
end;

« Last Edit: May 30, 2010, 12:36:56 pm by mich1103 »

DarkCrusade

  • Guest
Re: 2 last script request !
« Reply #5 on: May 30, 2010, 12:39:58 pm »
Code: [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  DoDamage(Shooter,-R);
end; 

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15
    ForceWeapon(ID,15,255,0);
end;
« Last Edit: May 30, 2010, 12:57:07 pm by DarkCrusade »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #6 on: May 30, 2010, 12:42:49 pm »
[Error] (7:23): Invalid number of parameters
Don't worry be happy  :D  :D

DarkCrusade

  • Guest
Re: 2 last script request !
« Reply #7 on: May 30, 2010, 12:58:18 pm »
Is this little script the only thing you run on the server?

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #8 on: May 30, 2010, 01:01:32 pm »
No i use other small script !
My server version is 2.7.0 i dont know if its the problem !

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: 2 last script request !
« Reply #9 on: May 30, 2010, 01:09:18 pm »
I think DoDamageBy replaced the old DoDamage (not 100% certain), so you need a "damage by" parameter in calling the DoDamage function.

EDIT: yup http://enesce.com/help/index.html?Functions/DoDamage.html & @ changelog too it says it.

DarkCrusade

  • Guest
Re: 2 last script request !
« Reply #10 on: May 30, 2010, 01:53:18 pm »
Then use this:

Code: [Select]
Function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  DoDamage(Shooter,Shooter,-R);
end; 

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15
    ForceWeapon(ID,15,255,0);
end;

Also, if you don't want players to get more health than the default amount (150) use this:

Code: [Select]
Function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  if R + GetPlayerStat(Shooter,'Health') <= 150 then
    DoDamage(Shooter,Shooter,-R);
  else
    DoDamage(Shooter,Shooter,GetPlayerStat(Shooter,'Health') - 150);
end; 

Procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15
    ForceWeapon(ID,15,255,0);
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #11 on: May 30, 2010, 02:44:43 pm »
forceweaponb -> [Error] (13:5): 'THEN' expected

DarkCrusade

  • Guest
Re: 2 last script request !
« Reply #12 on: May 30, 2010, 02:49:11 pm »
Happens if you edit the code of someone else :3

Code: [Select]
Function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  DoDamage(Shooter,Shooter,-R);
end; 

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15 then
    ForceWeapon(ID,15,255,0);
end;

Code: [Select]
Function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  if R + GetPlayerStat(Shooter,'Health') <= 150 then
    DoDamage(Shooter,Shooter,-R);
  else
    DoDamage(Shooter,Shooter,GetPlayerStat(Shooter,'Health') - 150);
end; 

Procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15 then
    ForceWeapon(ID,15,255,0);
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #13 on: May 30, 2010, 04:57:16 pm »
Code: [Select]
forceweaponb -> [Error] (9:3): Identifier expectedI use this one
Code: [Select]
Function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  if R + GetPlayerStat(Shooter,'Health') <= 150 then
    DoDamage(Shooter,Shooter,-R);
  else
    DoDamage(Shooter,Shooter,GetPlayerStat(Shooter,'Health') - 150);
end; 

Procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15 then
    ForceWeapon(ID,15,255,0);
end;

Offline Silnikos

  • Soldier
  • **
  • Posts: 129
Re: 2 last script request !
« Reply #14 on: May 31, 2010, 03:42:29 am »
there you go:
Code: [Select]
Function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var R:Byte;
begin
  Result:= Damage;
  R := Random(1,11);
  if R + GetPlayerStat(Shooter,'Health') <= 150 then
    DoDamage(Shooter,Shooter,-R)
  else
    DoDamage(Shooter,Shooter,GetPlayerStat(Shooter,'Health') - 150);
end;

Procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if PrimaryNum <> 15 then
    ForceWeapon(ID,15,255,0);
end;

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: 2 last script request !
« Reply #15 on: May 31, 2010, 12:22:53 pm »
You should've said it's 2.7.0...

Code: [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer; Weapon: byte): integer;
begin
  Result:= Damage;
  DoDamage(Shooter,Shooter,Random(-10,-1));
end;

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
  if GetPlayerStat(ID,'Team') = 2 then if (PrimaryNum <> 15) and (PrimaryNum <> 255) then ForceWeapon(ID,15,255,0);
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #16 on: May 31, 2010, 04:20:22 pm »
when i got hit my server freeze and shutdown and dont right any logs
that happen because i add the Gizd script !

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: 2 last script request !
« Reply #17 on: May 31, 2010, 04:44:05 pm »
1. What server version do you use?
2. Do you add bots when the server starts?

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: 2 last script request !
« Reply #18 on: May 31, 2010, 05:26:39 pm »
yea i add bot on server start and my server version is 2.7.0

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: 2 last script request !
« Reply #19 on: June 01, 2010, 04:21:59 am »
There's the problem, adding bots right on ActivateServer will fuck off OnWeaponChange();
If you give a list of the stuff you want to have in your server I can maybe make it for you without that all these little script cause damn crashes...