Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Neosano on June 29, 2008, 09:55:56 am

Title: GetPlayerStat ammo after ForceWeapon
Post by: Neosano on June 29, 2008, 09:55:56 am
Code: [Select]
function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer):integer;
begin
result := Damage;
ForceWeapon(Shooter,GetPlayerStat(Shooter,'Primary'),GetPlayerStat(Shooter,'Secondary'),GetPlayerStat(Shooter,'ammo')+1);
end;
Here is what i have got after testing it(I used minimi):
I had 40 ammo, I shot the dummy once, and my ammo went down to 39 then bounced back to 40. After that, my ammo decreased normally when I carried on shooting it. Switching weapons or shooting in the air forces it to work again. And when my ammo is at 1, and I punch the dummy with the weapon, the weapon reloads instantly.

I attached the video with that bug made by Danmer
Title: Re: GetPlayerStat ammo after ForceWeapon
Post by: danmer on June 29, 2008, 11:17:41 am
Code: [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  writeln('');
  writeln('before: ' + inttostr(GetPlayerStat(shooter,'ammo')));
  forceweapon(shooter,GetPlayerStat(shooter,'primary'),GetPlayerStat(shooter,'secondary'),GetPlayerStat(shooter,'ammo')+1);
  writeln('after: ' + inttostr(GetPlayerStat(shooter,'ammo')));
 
 
end;
both values (before and after) were the same. It works fine for a couple of first shots (gives you one bullet if you hit someone), but after that starts to screw up. Also if you run around between the shots or shoot air every second time, it works too...
Title: Re: GetPlayerStat ammo after ForceWeapon
Post by: Neosano on June 29, 2008, 12:22:31 pm
looks like your ammo doesn't change (in getplayerstat) after ForceWeapon