Official Soldat Forums

Soldat Talk => Need Help? Report Bugs! => Topic started by: soldat-game on August 28, 2016, 08:21:09 am

Title: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game 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
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game on August 30, 2016, 04:38:36 pm
Why? Falcon u dev script core.
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: Falcon` 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.
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game 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
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: %%%%%%% 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
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game on September 04, 2016, 01:38:34 pm
This be good:
https://wiki.soldat.pl/index.php/ScriptCore3.iif
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: Moroes 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.
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: %%%%%%% on September 28, 2016, 03:56:21 am
Hahahah

¯\_(ツ)_/¯
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game on September 28, 2016, 10:28:50 am
What's the problem? Where devs help?
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: Mighty 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])
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game 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
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: Mighty 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.
Title: Re: Players[i].Primary.Wtype (barrett return id 56)
Post by: soldat-game 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