0 Members and 1 Guest are viewing this topic.
function RealDMG(nonreal:single):single;var real,real2:string;begin real := floattostr(nonreal); real2 := Copy(GetPiece(real,'.',1),1,2); Result:=strtofloat(GetPiece(real,'.',0)+'.'+real2);end;
ShootSpeed := sqrt((Map.Bullets[BulletId].VelX*Map.Bullets[BulletId].VelX)+(Map.Bullets[BulletId].VelY*Map.Bullets[BulletId].VelY)); c := RealDMG(WeaponsINI.ReadFloat(GWN(WeaponID),'Damage',0)*ShootSpeed*WeaponsINI.ReadFloat(GWN(WeaponID),'ModifierHead',0)); c2 := RealDMG(WeaponsINI.ReadFloat(GWN(WeaponID),'Damage',0)*ShootSpeed*WeaponsINI.ReadFloat(GWN(WeaponID),'ModifierChest',0)); c3 := RealDMG(WeaponsINI.ReadFloat(GWN(WeaponID),'Damage',0)*ShootSpeed*WeaponsINI.ReadFloat(GWN(WeaponID),'ModifierLegs',0)); if (iif(Victim.Vest>0,Round(RealDMG(0.25*c)),c)=RealDMG(Damage)) then DrawTextEx(Shooter.ID,108,'Headshoot!',120,$F15D70,0.055,12,385) else if (iif(Victim.Vest>0,Round(RealDMG(0.25*c2)),c2)=RealDMG(Damage)) then DrawTextEx(Shooter.ID,108,'BODY!',120,$F15D70,0.055,12,385) else if (iif(Victim.Vest>0,Round(RealDMG(0.25*c3)),c3)=RealDMG(Damage)) then DrawTextEx(Shooter.ID,108,'LEGS!',120,$F15D70,0.055,12,385) else begin WriteLn(Floattostr(c)+' '+floattostr(Round(0.25*c))+' '+Floattostr(damage)+' '+Floattostr(RealDMG(Damage))+' '+iif(Victim.Vest>0,'1','0')+' Headshoot'); WriteLn(Floattostr(c2)+' '+floattostr(Round(0.25*c2))+' '+Floattostr(damage)+' '+Floattostr(RealDMG(Damage))+' '+iif(Victim.Vest>0,'1','0')+' Bodyshoot'); WriteLn(Floattostr(c3)+' '+floattostr(Round(0.25*c3))+' '+Floattostr(damage)+' '+Floattostr(RealDMG(Damage))+' '+iif(Victim.Vest>0,'1','0')+' Legsshoot'); end;
Victim.Vest is <=0, But the player's damage is calculate as if the player was still wearing a vest.Next bug: if player have vest, damage isnt single.Next bug: if player have vest, vest value isnt single.
floattostr(Round(0.25*c))
U be idiot?
Just trying to help.You could also use Pascal built-in function round() like below:x := 1.2345;k := round(x*100)/100; // 1.23k := round(x*1000)/1000; // 1.235Reference:http://www.askingbox.com/tutorial/delphi-lazarus-3-ways-to-round-a-number-to-x-decimal-places Quote from: soldat-game on June 27, 2017, 07:25:50 amU be idiot?
Quote from: soldat-game on June 27, 2017, 04:01:46 amVictim.Vest is <=0, But the player's damage is calculate as if the player was still wearing a vest.Next bug: if player have vest, damage isnt single.Next bug: if player have vest, vest value isnt single.Well, you used Round(), round means turn whatever float value into an integer. if value = 7.13245678, Round(value) = 7https://www.freepascal.org/docs-html/rtl/system/round.htmlCode: [Select]floattostr(Round(0.25*c))c:singleCalculated damage by yourself, not including vest value in calculation process,perfectly normal to see digits after Integer (i.e 28.3999)Damage:Singlecalculated by soldat server,"Soldat Server 2.8.1 now accept damage as Single instead of Integer",may suggest that in previous version soldat classes only accept damage value as integer, which means soldat health/damage system are all based on rounded values (Integers).Should not be surprised to see they haven't switch the whole system into using Single only, because it could be a tedious work to do.So frankly it isn't an Error.