Author Topic: Players[i].Primary.Wtype (barrett return id 56)  (Read 5542 times)

0 Members and 1 Guest are viewing this topic.

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Players[i].Primary.Wtype (barrett return id 56)
« on: August 28, 2016, 08:21:09 am »
Players.Primary.Wtype (barrett return id 56) Why barret id is 56?


example
Wep1  byte;
Code: [Select]
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);
WriteLn(inttostr(Players[id].Primary.Wtype)); //return 8
WriteLn(inttostr(PlayerInfo[ID].Wep1));    //return 56
« Last Edit: August 28, 2016, 08:29:39 am by soldat-game »

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #1 on: August 30, 2016, 04:38:36 pm »
Why? Falcon u dev script core.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #2 on: August 31, 2016, 06:07:50 pm »
I have no idea what's wrong in that code, nor in any paste you shared so far for that matter. I've tried to reproduce it, but all results came back sane.
You can send me over the whole thing with steps to reproduce, preferably via mantis private bugs system if you don't want it to leak. I'll take a look when i find a while.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #3 on: September 01, 2016, 01:35:29 pm »
Code: [Select]
type tPlayerInfo = record
Wep1: byte;
end;

PlayerInfo: array[1..32] of tPlayerInfo;

procedure WeaponAmmoChangeLimit(ID:byte);
begin
case (PlayerInfo[id].ClassID) of
3: begin
if (PlayerInfo[ID].Resp=False) then begin
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);
WriteLn(inttostr(Players[id].Primary.Wtype)); //return 8
WriteLn(inttostr(PlayerInfo[ID].Wep1));    //return 56
                                end;
                         end;
          end;
end;

procedure AppOnIdleSC3(Ticks: integer);
var i,b: byte; ReloadWep: TNewWeapon; fastkd:single;
begin
for i:= 1 to 32 do if (Players[i].Active) then begin
if (Players[i].X > PlayerInfo[i].LastX+5) or (Players[i].X < PlayerInfo[i].LastX-5) then begin
PlayerInfo[i].Resp:=false;
WeaponAmmoChangeLimit(i);
end;
end;

//lastx is singlle and change if player be respawn
if im change this : (this work bad) send 56 non 8
Code: [Select]
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);to this : (this work good)
Code: [Select]
if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
and im know im can use  down metchod but im report bug for u last work good
« Last Edit: September 01, 2016, 01:38:26 pm by soldat-game »

Offline %%%%%%%

  • Soldier
  • **
  • Posts: 205
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #4 on: September 04, 2016, 01:24:58 pm »
Code: [Select]
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);if im change this : (this work bad) send 56 non 8
Code: [Select]
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);to this : (this work good)
Code: [Select]
if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
and im know im can use  down metchod but im report bug for u last work good
There's an extra 'i' in "if" in the bad code (making it "iif"); maybe that's [part of] the problem

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #5 on: September 04, 2016, 01:38:34 pm »

Offline Moroes

  • Soldier
  • **
  • Posts: 165
    • Soldat-Game.eu
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #6 on: September 04, 2016, 02:22:25 pm »
There's an extra 'i' in "if" in the bad code (making it "iif"); maybe that's [part of] the problem

You are funny dude, made my day.

Offline %%%%%%%

  • Soldier
  • **
  • Posts: 205
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #7 on: September 28, 2016, 03:56:21 am »
Hahahah

¯\_(ツ)_/¯

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #8 on: September 28, 2016, 10:28:50 am »
What's the problem? Where devs help?

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #9 on: September 28, 2016, 02:45:27 pm »
What's the problem? Where devs help?

There is no bug. Please next time before you post a suspected bug, make sure it's not your fault:

Code: [Select]
function OnAdmCmd(p: TActivePlayer; Text: string): boolean;
var w: TNewWeapon;
begin
  if Text = '/test' then begin
    w := TNewWeapon.Create();
    try
      w.WType := WTYPE_BARRETT;
      p.ForceWeapon(w, w);
    finally
      w.Free();
    end;
  end;
 
  if Text = '/test2' then begin
    WriteLn('WType '+inttostr(iif(p.Primary.Wtype > 16, 17, p.Primary.Wtype)));
  end;
end;
Results in expected numbers:
Code: [Select]
► / 21:39:46 /test(127.0.0.1[~ Mighty])
►   21:39:49 [~ Mighty] got barret
►   21:39:53 WType 8
► /          /test2(127.0.0.1[~ Mighty])
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #10 on: September 28, 2016, 03:58:36 pm »
See full code non bad
http://pastebin.com/01TZX1r9

Non bad ... if im use iif is bad if use norma if then else.. is good.
this (result bad..)
Code: [Select]
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);and this  (Result good)
Code: [Select]
if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;should give the same results
« Last Edit: September 28, 2016, 04:03:13 pm by soldat-game »

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #11 on: September 29, 2016, 10:40:17 am »
Code: [Select]
  if Text = '/test2' then begin
    WriteLn('WType '+inttostr(iif(p.Primary.Wtype > 16, 17, p.Primary.Wtype)));
   
    if p.Primary.WType > 16 then
      WriteLn('WType 17')
    else
      WriteLn('WType '+inttostr(p.Primary.WType));
  end;
->
Code: [Select]
► +          ~ Mighty has joined alpha team.
►   17:37:39 WType 8
►            WType 8
► /          /test2(127.0.0.1[~ Mighty])

They give the same result.

@Slasher please. you're just adding spam everywhere, if you don't have anything to say, don't post.
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Players[i].Primary.Wtype (barrett return id 56)
« Reply #12 on: October 01, 2016, 12:02:57 pm »
Stop use bad your script does not represent reais...
Dont use table dont use byte variable and other...

Seee it and try normal!
https://www.youtube.com/watch?v=pTihEoEdYD4