Author Topic: Disappearing knives  (Read 1867 times)

0 Members and 1 Guest are viewing this topic.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Disappearing knives
« on: October 19, 2008, 03:45:02 am »
I made a script that is causing knife bugs. Thrown knifes disappear on hit and deal no damage.
Code: [Select]
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
begin
  if (PrimaryNum <> 255) and (PrimaryNum <> Round) then if Round = 14 then ForceWeapon(ID, 14, 14, 0) else if Round = 17 then ForceWeapon(ID, 255, 255, 0) else ForceWeapon(ID, Round, 255, 0);
end;
Anybody know why ? Or it's server fault ?
« Last Edit: February 07, 2010, 02:26:53 pm by Gizd »

Offline BombSki

  • Flagrunner
  • ****
  • Posts: 927
    • Climbing-soldiers.net
Re: Disappearing knifes
« Reply #1 on: October 19, 2008, 10:24:04 am »
are you using default wmod? i know that for example setting a really high speed will cause the knife to go through/behind polys

Offline Bolt

  • Major
  • *
  • Posts: 64
  • {MLP}
    • http://www.darkdemon.org/bolt/
Re: Disappearing knifes
« Reply #2 on: October 19, 2008, 10:18:01 pm »
He uses the default speed.

Maybe if you add an "onHit PlayerDamage" or whatever, I don't script.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #3 on: October 20, 2008, 06:59:34 am »
I tried OnPlayerDamage but these knifes doesn't activates it.
I use weapon mod for LAW and Rambo Bows(enesce blocked arrows so i changed bulletstyle) but it's not causing bugs.

Offline Rampage_Terranius

  • Major
  • *
  • Posts: 69
  • The Strategist
    • Soldat Noob Servers
Re: Disappearing knifes
« Reply #4 on: October 20, 2008, 07:57:10 am »
your not using KillObject somewhere are you?

next sometimes on contact a knife does dissapear but not always and with the knife not doing damage check onplayerdamage maybe you have disabled damage on the wrong weapon or done something like that etc....

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #5 on: October 20, 2008, 10:14:52 am »
I don't have OnPlayerDamage and KillObject in script.

[edit1-2]
I discovered error.

[edit3]
After time spent on turning off script parts piece by piece i finally know wtf is wrong !
But it's still strange for me  :o
Code: [Select]
  for i:= 1 to 32 do if GetPlayerStat(i,'Alive') then DoDamage(i,200);
« Last Edit: October 20, 2008, 10:37:31 am by Gizd »

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Disappearing knifes
« Reply #6 on: October 20, 2008, 11:51:42 am »
GetPlayerStat returns a VARIANT not a boolean.
You need to change it to "if GetPlayerStat(i,'Alive') = true then"

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #7 on: October 20, 2008, 11:58:02 am »
GetPlayerStat returns a VARIANT not a boolean.
You need to change it to "if GetPlayerStat(i,'Alive') = true then"
Actually i already solved this problem.
I replaced DoDamage(f*** bugmaker) with Boom(some M79 nades, M2 bullets with high speed, Frags and player is gone).

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Disappearing knifes
« Reply #8 on: October 20, 2008, 12:23:46 pm »
GetPlayerStat returns a VARIANT not a boolean.
You need to change it to "if GetPlayerStat(i,'Alive') = true then"
a little off topic, but is that fixed in the next scriptcore version? Like, the fact that GetPlayerStat(32,'alive/active/human/whatever') returns something other than boolean? It's not an issue as most servers don't have 32 players, but still...

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #9 on: October 21, 2008, 07:56:28 am »
To EnEsCe:
Most of times i use DoDamage something don't work until i delete it. Why it's so bugy ?


Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #11 on: October 21, 2008, 12:12:21 pm »
That makes no sense.
I agree, it makes no sense that one procedure can feck all script without any reason :?

Offline Rampage_Terranius

  • Major
  • *
  • Posts: 69
  • The Strategist
    • Soldat Noob Servers
Re: Disappearing knifes
« Reply #12 on: October 22, 2008, 12:03:48 am »
That makes no sense.
indeed it works perfect for me all the time everytime i dont know what your doing to make it error at you :-\

Offline Timer

  • Major(1)
  • Posts: 41
Re: Disappearing knifes
« Reply #13 on: February 06, 2010, 01:57:50 am »
Hey,
I know this topic is an old one and I'm not trying to piggy back ride on it, but I am now having this same problem. My script however doesn't even have any dodamage on it. I do use the setweaponactive...but for some reason the knife is disappear/not doing damage on impact. Any ideas?

Do you need me to post the script?
"I was gonna clean my room, but then I got high. I was gonna get up and find the broom, but then I got high."

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Disappearing knifes
« Reply #14 on: February 06, 2010, 06:06:16 am »
It is always good when you post your script and your problem same time, makes easier to see what you could coded wrong.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #15 on: February 06, 2010, 12:56:42 pm »
Oh, I forgot about this topic... It happened because I forgot "GetPlayerStat(i,'Active')" and it was doing damage to not existing players.

Offline Timer

  • Major(1)
  • Posts: 41
Re: Disappearing knifes
« Reply #16 on: February 07, 2010, 02:11:02 pm »
Well I don't think the knife bug has anything to do with the script, because it works. However if there is a problem with the script that is causing the disappearing/none damaging knife bug, it should definetly be added somewhere in the enesce server help place.

Code: [Select]
type tPlayer = record
time, delay: integer;
end;

var
Player: array [1..32] of tPlayer;
Color: longint;

procedure ActivateServer();
var
i: byte;
begin
for i := 1 to 32 do begin
Player[i].delay := 0;
Player[i].time := 0;
end;
end;

procedure ClearWeapons1(ID: byte);
begin
SetWeaponActive(ID,2,false);
SetWeaponActive(ID,3,false);
SetWeaponActive(ID,4,false);
SetWeaponActive(ID,6,false);
SetWeaponActive(ID,9,false);
SetWeaponActive(ID,10,false);
SetWeaponActive(ID,11,false);
SetWeaponActive(ID,12,false);
SetWeaponActive(ID,13,false);
SetWeaponActive(ID,14,false);
end;

procedure ClearWeapons2(ID: byte);
begin
SetWeaponActive(ID,1,false);
SetWeaponActive(ID,2,false);
SetWeaponActive(ID,3,false);
SetWeaponActive(ID,4,false);
SetWeaponActive(ID,5,false);
SetWeaponActive(ID,6,false);
SetWeaponActive(ID,7,false);
SetWeaponActive(ID,8,false);
SetWeaponActive(ID,9,false);
SetWeaponActive(ID,10,false);
SetWeaponActive(ID,11,false);
SetWeaponActive(ID,14,false);
end;

procedure OnMapChange(NewMap: String);
var
i: byte;
begin
for i := 1 to 32 do begin
Player[i].delay := 0;
Player[i].time := 0;
end;
end;

procedure AppOnIdle(Ticks: integer);
var
i: byte;
begin
for i := 1 to 32 do begin
if (Player[i].time <> 0) then begin
Player[i].time := Player[i].time -1;
end;
if (GetPlayerStat(i, 'Team') = 2) then if (Player[i].time = 1) then begin
Player[i].time := 25;
GiveBonus(i, 1);
exit;
end;
for i := 1 to 32 do begin
if Player[i].delay <> 0 then begin
if Player[i].delay <> 1 then Player[i].delay := Player[i].delay - 1 else begin
Player[i].delay := Player[i].delay - 1;
exit;
end;
end;
if (Player[i].delay = 1) then if (Player[i].time = 0) then begin
Player[i].time := 25;
GiveBonus(i, 1);
WriteConsole(i,'You are now stealthed!',Color);
exit;
end;
end;
end;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
if (GetPlayerStat(ID, 'Team') = 2) then if (GetPlayerStat(ID, 'Active') = true) then ClearWeapons2(ID);
if (GetPlayerStat(ID, 'Team') = 1) then if (GetPlayerStat(ID, 'Active') = true) then ClearWeapons1(ID);
end;

procedure OnPlayerRespawn(ID: Byte);
begin
if (GetPlayerStat(ID, 'Team') = 2) then if (Player[ID].delay = 0) then Player[ID].delay := 4;
GiveBonus(ID, 5);
if (GetPlayerStat(ID, 'Team') = 2) then GiveBonus(ID, 5);
end;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
if (GetPlayerStat(Victim, 'Team') = 2) then begin
GiveBonus(Killer, 5);
if (Player[Victim].time > 0) then Player[Victim].time := 0;
end;
if (GetPlayerStat(Victim, 'Team') = 1) then GiveBonus(Killer, 5);
end;
« Last Edit: February 07, 2010, 02:13:37 pm by Timer »
"I was gonna clean my room, but then I got high. I was gonna get up and find the broom, but then I got high."

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knifes
« Reply #17 on: February 07, 2010, 02:26:37 pm »
Code: [Select]
...
GiveBonus(ID, 5);
if (GetPlayerStat(ID, 'Team') = 2) then GiveBonus(ID, 5);
...
2nd line is useless...

I see you haven't heard of debug: comment out parts of code and check if bug still appears.

Offline Timer

  • Major(1)
  • Posts: 41
Re: Disappearing knives
« Reply #18 on: February 07, 2010, 04:39:49 pm »
woops posted the wrong one... anyway that still isn't the reason behind the bug.
"I was gonna clean my room, but then I got high. I was gonna get up and find the broom, but then I got high."

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Disappearing knives
« Reply #19 on: February 08, 2010, 10:00:07 am »
Quote from: me
I see you haven't heard of debug: comment out parts of code and check if bug still appears.