Official Soldat Forums
Soldat Talk => Need Help? Report Bugs! => Topic started 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;
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
-
Why? Falcon u dev script core.
-
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.
-
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
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);
to this : (this work good)
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
-
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
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);
to this : (this work good)
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
-
This be good:
https://wiki.soldat.pl/index.php/ScriptCore3.iif
-
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.
-
Hahahah
¯\_(ツ)_/¯
-
What's the problem? Where devs help?
-
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:
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:
► / 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])
-
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..)
PlayerInfo[ID].Wep1 := iif(Players[id].Primary.Wtype>16,17,Players[id].Primary.Wtype);
and this (Result good)
if (Players[id].Primary.Wtype>16) then PlayerInfo[ID].Wep1 := 17 else PlayerInfo[ID].Wep1 := Players[id].Primary.Wtype;
should give the same results
-
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;
->
► + ~ 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.
-
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