Difference between revisions of "TActivePlayer.ForceWeapon"

From Soldat Community Wiki
Jump to: navigation, search
m (Examples)
m (Examples)
Line 22: Line 22:
 
     NewPrimary.Ammo := 7 // Full one
 
     NewPrimary.Ammo := 7 // Full one
 
     NewSecondary := 255; // Hands
 
     NewSecondary := 255; // Hands
     Player[1].ForceWeapon(NewPrimary, NewSecondary);
+
     Player[1].ForceWeapon(TWeapon(NewPrimary), TWeapon(NewSecondary));
 
   finally
 
   finally
 
     NewPrimary.Free();
 
     NewPrimary.Free();

Revision as of 18:44, 8 October 2014

procedure ForceWeapon(Primary, Secondary: TWeapon)
 Primary: primary weapon
 Secondary: secondary weapon

Description

Forces two weapons to a player.

Examples

begin
  // Forces 2nd Player's weapons on 1st
  Players[1].ForceWeapon(Players[2].Primary, Players[2].Secondary)
end;
var
  NewPrimary, NewSecondary: TNewWeapon;
begin
  NewPrimary := TNewWeapon.Create();
  NewSecondary := TNewWeapon.Create();
  try
    NewPrimary.WType := 5; //Spas
    NewPrimary.Ammo := 7 // Full one
    NewSecondary := 255; // Hands
    Player[1].ForceWeapon(TWeapon(NewPrimary), TWeapon(NewSecondary));
  finally
    NewPrimary.Free();
    NewSecondary.Free();
  end;
end;