Difference between revisions of "TActivePlayer.ForceWeapon"
(Created page with " '''''procedure ForceWeapon(Primary, Secondary: TWeapon)''''' Primary: primary weapon Secondary: secondary weapon ==Description== Forces two weapons to a player. [[Ca...") |
(NewSecondary is now defined correctly.) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 4: | Line 4: | ||
==Description== | ==Description== | ||
Forces two weapons to a player. | Forces two weapons to a player. | ||
| + | ==Examples== | ||
| + | <syntaxhighlight lang="pascal"> | ||
| + | begin | ||
| + | // Forces 2nd Player's weapons on 1st | ||
| + | Players[1].ForceWeapon(Players[2].Primary, Players[2].Secondary) | ||
| + | end; | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | <syntaxhighlight lang="pascal"> | ||
| + | var | ||
| + | NewPrimary, NewSecondary: TNewWeapon; | ||
| + | begin | ||
| + | NewPrimary := TNewWeapon.Create(); | ||
| + | NewSecondary := TNewWeapon.Create(); | ||
| + | try | ||
| + | NewPrimary.WType := 5; //Spas | ||
| + | NewPrimary.Ammo := 7 // Full one | ||
| + | NewSecondary.WType := 255; // Hands | ||
| + | NewSecondary.Ammo := 0 // To reload - for hands it doesn't matter. | ||
| + | Player[1].ForceWeapon(TWeapon(NewPrimary), TWeapon(NewSecondary)); | ||
| + | finally | ||
| + | NewPrimary.Free(); | ||
| + | NewSecondary.Free(); | ||
| + | end; | ||
| + | end; | ||
| + | </syntaxhighlight> | ||
| + | |||
[[Category:TActivePlayer]] | [[Category:TActivePlayer]] | ||
Latest revision as of 04:58, 9 June 2015
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.WType := 255; // Hands
NewSecondary.Ammo := 0 // To reload - for hands it doesn't matter.
Player[1].ForceWeapon(TWeapon(NewPrimary), TWeapon(NewSecondary));
finally
NewPrimary.Free();
NewSecondary.Free();
end;
end;